Giter Club home page Giter Club logo

plausible_on_dokku's Introduction

Heill ! ๐Ÿ‘‹

d1ceward.com Twitter Mastodon StackOverflow

I'm a french 27 years old developper living in Paris ๐Ÿ‡ซ๐Ÿ‡ท, passionate about technology and nordic mythology. Amateur guitarist ๐ŸŽธ

๐Ÿข Work: Chief Technology Officer at @HappyRenting

๐Ÿ“• Main languages: Ruby & Crystal

๐Ÿ’ป Personal project: A web browser economy game written in Crystal

plausible_on_dokku's People

Contributors

d1ceward avatar neamar avatar weisisheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

plausible_on_dokku's Issues

App container failed to start

Thanks a lot for this project, seems exactly what I'm looking for.

However, I can't deploy: I followed the whole process, but when pushing to dokku, I get an error.

To Reproduce
Here is the config I have:

ADMIN_USER_EMAIL:         [email protected]
ADMIN_USER_NAME:          neamar
ADMIN_USER_PWD:           REDACTED
BASE_URL:                 https://t.neamar.fr
CLICKHOUSE_DATABASE_URL:  http://plausible:c9b6601cd1fd4b69@dokku-clickhouse-plausible:8123/plausible
CLICKHOUSE_URL:           clickhouse://plausible:c9b6601cd1fd4b69@dokku-clickhouse-plausible:9000/plausible
DATABASE_URL:             postgres://postgres:ef34cc68e444ce7aefff9a5b40a35bdb@dokku-postgres-plausible:5432/plausible
DOKKU_APP_TYPE:           dockerfile
DOKKU_DOCKERFILE_PORTS:   8000/tcp
DOKKU_PROXY_PORT:         80
DOKKU_PROXY_PORT_MAP:     http:80:8000 https:443:8000
GIT_REV:                  371778923a0f37172fec59ed71e1e944efdceb09
SECRET_KEY_BASE:          398a6f5c1dbc48c8e90bdc0cad45a71e4a919735edfea1202ecdf118e7a985842c5df28c21c511434ef5505ab3d53a5821ff1ef63eb55195a3b9e2c6070ee

I did create CLICKHOUSE_DATABASE_URL, changing the protocol and port (your doc mentioned that user and password should change too, but your example kept the same values).

When pushing:

Enumerating objects: 58, done.
Counting objects: 100% (58/58), done.
Delta compression using up to 16 threads
Compressing objects: 100% (34/34), done.
Writing objects: 100% (58/58), 65.73 KiB | 65.73 MiB/s, done.
Total 58 (delta 20), reused 58 (delta 20), pack-reused 0
-----> Cleaning up...
-----> Building plausible from Dockerfile
remote: build context to Docker daemon  44.03kB
Step 1/6 : ARG PLAUSIBLE_VERSION="v1.3.0"
Step 2/6 : FROM plausible/analytics:$PLAUSIBLE_VERSION
 ---> ea787e180e98
Step 3/6 : CMD ["sh", "-c", "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run"]
 ---> Using cache
 ---> fcc5dbdc7549
Step 4/6 : LABEL dokku=
 ---> Using cache
 ---> 1844141faf62
Step 5/6 : LABEL org.label-schema.schema-version=1.0
 ---> Using cache
 ---> 05672afe4c04
Step 6/6 : LABEL org.label-schema.vendor=dokku
 ---> Running in 89e0b84f44d9
Removing intermediate container 89e0b84f44d9
 ---> 7bc3665487c5
Successfully built 7bc3665487c5
Successfully tagged dokku/plausible:latest
-----> Releasing plausible...
-----> Deploying plausible...
-----> Checking for predeploy task
       No predeploy task found, skipping
-----> Checking for release task
       No release task found, skipping
-----> No Procfile found in app image
-----> DOKKU_SCALE file exists
=====> Processing deployment checks
       No CHECKS file found. Simple container checks will be performed.
       For more efficient zero downtime deployments, create a CHECKS file. See https://dokku.com/docs/deployment/zero-downtime-deploys/ for examples
remote:  !     No procfile found
remote: 2021/04/16 00:27:22 exit status 1
-----> Attempting pre-flight checks (web.1)
       Waiting for 10 seconds ...
aa435deebdf0755526490c92e4ba06599ce25286db947fcb8b720b3066b760d2
remote:  !     App container failed to start!!
=====> plausible web container output:
       Loading plausible..
       Starting dependencies..
       Starting repos..
       create Plausible.Repo database if it doesn't exist
       create Plausible.ClickhouseRepo database if it doesn't exist
       22:27:34.051 [error] Clickhousex.Protocol (#PID<0.179.0>) failed to connect: ** (ErlangError) Erlang error: :nxdomain
       22:27:34.051 [error] Clickhousex.Protocol (#PID<0.178.0>) failed to connect: ** (ErlangError) Erlang error: :nxdomain
       22:27:34.053 [error] GenServer #PID<0.201.0> terminating
       ** (UndefinedFunctionError) function :nxdomain.exception/1 is undefined (module :nxdomain is not available)
           :nxdomain.exception([])
           (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
           (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
           (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
       Last message: nil
       22:27:34.059 [error] GenServer #PID<0.203.0> terminating
       ** (UndefinedFunctionError) function :nxdomain.exception/1 is undefined (module :nxdomain is not available)
           :nxdomain.exception([])
           (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
           (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
           (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
       Last message: nil
       22:27:34.061 [error] GenServer #PID<0.205.0> terminating
       ** (UndefinedFunctionError) function :nxdomain.exception/1 is undefined (module :nxdomain is not available)
           :nxdomain.exception([])
           (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
           (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
           (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
       Last message: nil
       22:27:34.065 [error] GenServer #PID<0.207.0> terminating
       ** (UndefinedFunctionError) function :nxdomain.exception/1 is undefined (module :nxdomain is not available)
           :nxdomain.exception([])
           (db_connection 2.2.2) lib/db_connection/connection.ex:87: DBConnection.Connection.connect/2
           (connection 1.0.4) lib/connection.ex:622: Connection.enter_connect/5
           (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
       Last message: nil
       ** (MatchError) no match of right hand side value: {:error, "killed"}
           (plausible 0.0.1) lib/plausible_release.ex:48: anonymous fn/2 in Plausible.Release.createdb/0
           (elixir 1.11.3) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
           (plausible 0.0.1) lib/plausible_release.ex:47: Plausible.Release.createdb/0
           (stdlib 3.14) erl_eval.erl:680: :erl_eval.do_apply/6
           (elixir 1.11.3) lib/code.ex:341: Code.eval_string_with_error_handling/3
=====> end plausible web container output
remote: 2021/04/16 00:27:36 exit status 1
remote: 2021/04/16 00:27:36 exit status 1
remote: 2021/04/16 00:27:36 exit status 1
To neamar.fr:plausible
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'neamar.fr:plausible'

It feels like the app can't connect to clickhouse (I confirmed that it has been linked to the app however).

Thanks for your help!

Docs

I'm trying to set up a plausible instance and I would like to manage it via Dokku.

Is this plugin already working? If so, are there documentation or a blog post to check?

Happy to help if you need a hand.

Selfhosted Emails with Sendgrid

Describe the bug
E-Mails are not getting sent on self-hosted version with sendgrid

To Reproduce
I am reproducing this when I try to reset my password

Screenshots
This is the docker log from the mail container
Connecting to aspmx.l.google.com [xxxx:xxxx:xxxx:c07::1b]:25 ... failed: Cannot assign requested address H=aspmx.l.google.com [xxxx:xxxx:xxxx:c07::1b] Cannot assign requested address

Additional context
This is my docker-compose.yaml

version: "3.3"
services:
  mail:
    image: bytemark/smtp
    restart: always
    environment:
      MAILER_EMAIL: [email protected]
      SMTP_HOST_ADDR: smtp.sendgrid.net
      SMTP_HOST_PORT: 587
      SMTP_HOST_SSL_ENABLED: 1
      SMTP_USER_NAME: apikey
      SMTP_USER_PWD: SENDGRID_API_PASSWORD

  plausible_db:
    image: postgres:12
    restart: always
    volumes:
      - db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=postgres

  plausible_events_db:
    image: yandex/clickhouse-server:21.3.2.5
    restart: always
    volumes:
      - event-data:/var/lib/clickhouse
      - ./clickhouse/clickhouse-config.xml:/etc/clickhouse-server/config.d/logging.xml:ro
      - ./clickhouse/clickhouse-user-config.xml:/etc/clickhouse-server/users.d/logging.xml:ro
    ulimits:
      nofile:
        soft: 262144
        hard: 262144

  plausible:
    image: plausible/analytics:latest
    restart: always
    command: sh -c "sleep 10 && /entrypoint.sh db createdb && /entrypoint.sh db migrate && /entrypoint.sh db init-admin && /entrypoint.sh run"
    depends_on:
      - plausible_db
      - plausible_events_db
      - mail
    ports:
      - 127.0.0.1:8000:8000
    env_file:
      - plausible-conf.env

volumes:
  db-data:
    driver: local
  event-data:
    driver: local
  geoip:
    driver: local

Upgrading to v1.3.0: Syntax error: failed at position 27: SAMPLE BY user_id when running migrations

When trying to push image plausible/analytics:v1.3.0 (updating from 1.2.0), I get this error:

       Running migrations for Elixir.Plausible.Repo
       Running migrations for Elixir.Plausible.ClickhouseRepo
       ** (Clickhousex.Error) Code: 62, e.displayText() = DB::Exception: Syntax error: failed at position 27: SAMPLE BY user_id
       . Expected one of: TTL, COLUMN, ORDER BY, SETTING, QUERY (version 20.3.8.53 (official build))
           (ecto_sql 3.5.3) lib/ecto/adapters/sql.ex:751: Ecto.Adapters.SQL.raise_sql_call_error/1
           (elixir 1.11.3) lib/enum.ex:1411: Enum."-map/2-lists^map/1-0-"/2
           (ecto_sql 3.5.3) lib/ecto/adapters/sql.ex:838: Ecto.Adapters.SQL.execute_ddl/4
           (ecto_sql 3.5.3) lib/ecto/migration/runner.ex:343: Ecto.Migration.Runner.log_and_execute_ddl/3
           (ecto_sql 3.5.3) lib/ecto/migration/runner.ex:117: anonymous fn/6 in Ecto.Migration.Runner.flush/0
           (elixir 1.11.3) lib/enum.ex:2193: Enum."-reduce/3-lists^foldl/2-0-"/3
           (ecto_sql 3.5.3) lib/ecto/migration/runner.ex:116: Ecto.Migration.Runner.flush/0
           (stdlib 3.14) timer.erl:166: :timer.tc/1

Is this a bug from Plausible or is it because of one of the launch commands of the Dockerfile of this repo?

Unable to access plausible after deploy

Describe the bug
Followed the process as described in the readme and am able to follow it completely to the end without any errors. However when trying to go to the URL, I get the Dokku blue screen:
image

I have repeated this same process at least 4 times and tried out some things like updating the postgres url scheme to postgresql but always the same outcome.

To Reproduce
Steps to reproduce the behavior:
Followed the steps as explained in the readme.

Expected behavior
I would expect plausible to be accessible.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
I see no errors when running dokku logs plausible

This is my config with some info obviously redacted:

=====> plausible env vars
ADMIN_USER_EMAIL:          [email protected]
ADMIN_USER_NAME:           myusername
ADMIN_USER_PWD:            somepassword
BASE_URL:                  https://plausible.mydomain.com
CLICKHOUSE_DATABASE_URL:   http://plausible:35d64e82bfdab338@dokku-clickhouse-plausible:8123/plausible
CLICKHOUSE_URL:            clickhouse://plausible:35d64e82bfdab338@dokku-clickhouse-plausible:9000/plausible
DATABASE_URL:              postgres://postgres:f14bab921a5f9f947f22f217be785732@dokku-postgres-plausible:5432/plausible
DOKKU_APP_RESTORE:         1
DOKKU_APP_TYPE:            dockerfile
DOKKU_DOCKERFILE_PORTS:    80/tcp
DOKKU_LETSENCRYPT_EMAIL:   [email protected]
DOKKU_PROXY_PORT_MAP:      http:80:5000 https:443:5000
DOKKU_PROXY_SSL_PORT:      443
GIT_REV:                   50853d6db6365e0edd3f227b2013611f986abf6c
MAILER_EMAIL:              [email protected]
SECRET_KEY_BASE:           0f7e5166a668848b587bfa547ef0305d781bb7dd80a31113f8c26817bc003b0699db54fd972b10086ee12e921fe533b1844d563362fbab4c9785a5811a35cfe3
SMTP_HOST_ADDR:            mymailhostaddress
SMTP_HOST_PORT:            465
SMTP_HOST_SSL_ENABLED:     true
SMTP_USER_NAME:            myusername
SMTP_USER_PWD:             somepassword

Logs

2021-05-07T19:38:40.818372303Z app[web.1]: Starting dependencies..
2021-05-07T19:38:41.051131171Z app[web.1]: Starting repos..
2021-05-07T19:38:41.262658070Z app[web.1]: create Plausible.Repo database if it doesn't exist
2021-05-07T19:38:41.440762311Z app[web.1]: create Plausible.ClickhouseRepo database if it doesn't exist
2021-05-07T19:38:41.570990278Z app[web.1]: Creation of Db successful!
2021-05-07T19:38:42.101389400Z app[web.1]: Loading plausible..
2021-05-07T19:38:42.112409226Z app[web.1]: Starting dependencies..
2021-05-07T19:38:42.311824228Z app[web.1]: Starting repos..
2021-05-07T19:38:42.473638822Z app[web.1]: Running migrations for Elixir.Plausible.Repo
2021-05-07T19:38:52.877989718Z app[web.1]: Running migrations for Elixir.Plausible.ClickhouseRepo
2021-05-07T19:38:53.721905782Z app[web.1]: Migrations successful!
2021-05-07T19:38:54.893397159Z app[web.1]: Loading plausible..
2021-05-07T19:38:54.916777163Z app[web.1]: Starting dependencies..
2021-05-07T19:38:55.375956008Z app[web.1]: Starting repos..
2021-05-07T19:38:57.160980845Z app[web.1]: Admin user created successful!

App fails to start

Describe the bug

Hi, I don't seem to be able to make this app work. App creation and linking works fine, but I keep getting the following error while trying to git push. I went through some other issues and also tried the proxy commands. Right now my environment is:

=====> plausible env vars
ADMIN_USER_EMAIL:         [email protected]
ADMIN_USER_NAME:          username
ADMIN_USER_PWD:           password
BASE_URL:                 https://plausible.domain.com/
CLICKHOUSE_DATABASE_URL:  http://plausible:<redacted>@dokku-clickhouse-plausible:8123/plausible
CLICKHOUSE_URL:           clickhouse://plausible:<redacted>@dokku-clickhouse-plausible:9000/plausible
DATABASE_URL:             postgres://postgres:<redacted>@dokku-postgres-plausible:5432/plausible
DOKKU_APP_TYPE:           dockerfile
DOKKU_DOCKERFILE_PORTS:   5000/tcp
DOKKU_PROXY_PORT:         80
DOKKU_PROXY_PORT_MAP:     http:80:5000
GIT_REV:                  1c55839279858d34b484308b6b79cd54d4a4b353
MAILER_EMAIL:             [email protected]
SECRET_KEY_BASE:          <redacted>
SMTP_HOST_ADDR:           smtp.server.com
SMTP_HOST_PORT:           587
SMTP_HOST_SSL_ENABLED:    1
SMTP_USER_NAME:           [email protected]
SMTP_USER_PWD:            password
Error
remote:  !     App container failed to start!!
=====> Start of plausible web container output:
       00:28:19.794 [error] Clickhousex.Protocol (#PID<0.2571.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
remote: 2021/09/24 02:28:32 exit status 1
       00:28:19.794 [error] Clickhousex.Protocol (#PID<0.2568.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.794 [error] Clickhousex.Protocol (#PID<0.2567.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.795 [error] Clickhousex.Protocol (#PID<0.2570.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.795 [error] Clickhousex.Protocol (#PID<0.2569.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.799 [error] Clickhousex.Protocol (#PID<0.2574.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.799 [error] Clickhousex.Protocol (#PID<0.2576.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.801 [error] Clickhousex.Protocol (#PID<0.2578.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.812 [error] Clickhousex.Protocol (#PID<0.2581.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:19.815 [error] Clickhousex.Protocol (#PID<0.2583.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       {"Kernel pid terminated",application_controller,"{application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.Plausible.Session.Salts',{#{'__exception__' => true,'__struct__' => 'Elixir.Postgrex.Error',connection_id => 151,message => nil,postgres => #{code => undefined_table,file => <<\"parse_relation.c\">>,line => <<\"1194\">>,message => <<\"relation \\"salts\\" does not exist\">>,pg_code => <<\"42P01\">>,position => <<\"13\">>,routine => <<\"parserOpenTable\">>,severity => <<\"ERROR\">>,unknown => <<\"ERROR\">>},query => <<\"DELETE FROM \\"salts\\" AS s0 WHERE (s0.\\"inserted_at\\" < now() - '48 hours'::interval)\">>},[{'Elixir.Ecto.Adapters.SQL',raise_sql_call_error,1,[{file,\"lib/ecto/adapters/sql.ex\"},{line,751}]},{'Elixir.Ecto.Adapters.SQL',execute,5,[{file,\"lib/ecto/adapters/sql.ex\"},{line,684}]},{'Elixir.Plausible.Session.Salts','-start_link/1-fun-0-',0,[{file,\"lib/plausible/session/salts.ex\"},{line,8}]},{'Elixir.Agent.Server',init,1,[{file,\"lib/agent/server.ex\"},{line,8}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,417}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,385}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{lremote: ]}]}}},{'Elixir.Plausible.Application',start,[normal,[]]}}}"}
       Kernel pid terminated (application_controller) ({application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.Plausible.Sessionremote: {#{'__exception__' => true,'__struct__' => 'Elix
remote: 
remote: rash dump is being written to: erl_crash.dump...done
       00:28:25.665 [error] Clickhousex.Protocol (#PID<0.2568.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.666 [error] Clickhousex.Protocol (#PID<0.2571.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.666 [error] Clickhousex.Protocol (#PID<0.2567.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.667 [error] Clickhousex.Protocol (#PID<0.2570.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.667 [error] Clickhousex.Protocol (#PID<0.2569.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.670 [error] Clickhousex.Protocol (#PID<0.2574.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.670 [error] Clickhousex.Protocol (#PID<0.2576.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.671 [error] Clickhousex.Protocol (#PID<0.2578.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.675 [error] Clickhousex.Protocol (#PID<0.2581.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:25.677 [error] Clickhousex.Protocol (#PID<0.2583.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       {"Kernel pid terminated",application_controller,"{application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.Plausible.Session.Salts',{#{'__exception__' => true,'__struct__' => 'Elixir.Postgrex.Error',connection_id => 161,message => nil,postgres => #{code => undefined_table,file => <<\"parse_relation.c\">>,line => <<\"1194\">>,message => <<\"relation \\"salts\\" does not exist\">>,pg_code => <<\"42P01\">>,position => <<\"13\">>,routine => <<\"parserOpenTable\">>,severity => <<\"ERROR\">>,unknown => <<\"ERROR\">>},query => <<\"DELETE FROM \\"salts\\" AS s0 WHERE (s0.\\"inserted_at\\" < now() - '48 hours'::interval)\">>},[{'Elixir.Ecto.Adapters.SQL',raise_sql_call_error,1,[{file,\"lib/ecto/adapters/sql.ex\"},{line,751}]},{'Elixir.Ecto.Adapters.SQL',execute,5,[{file,\"lib/ecto/adapters/sql.ex\"},{line,684}]},{'Elixir.Plausible.Session.Salts','-start_link/1-fun-0-',0,[{file,\"lib/plausible/session/salts.ex\"},{line,8}]},{'Elixir.Agent.Server',init,1,[{file,\"lib/agent/server.ex\"},{line,8}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,417}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,385}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{lremote: ]}]}}},{'Elixir.Plausible.Application',start,[normal,[]]}}}"}
       Kernel pid terminated (application_controller) ({application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.Plausible.Sessionremote: {#{'__exception__' => true,'__struct__' => 'Elix
remote: 
remote: rash dump is being written to: erl_crash.dump...done
       00:28:30.797 [error] Clickhousex.Protocol (#PID<0.2568.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.798 [error] Clickhousex.Protocol (#PID<0.2571.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.798 [error] Clickhousex.Protocol (#PID<0.2567.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.799 [error] Clickhousex.Protocol (#PID<0.2570.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.799 [error] Clickhousex.Protocol (#PID<0.2569.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.802 [error] Clickhousex.Protocol (#PID<0.2574.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.802 [error] Clickhousex.Protocol (#PID<0.2576.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.803 [error] Clickhousex.Protocol (#PID<0.2578.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.807 [error] Clickhousex.Protocol (#PID<0.2581.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       00:28:30.809 [error] Clickhousex.Protocol (#PID<0.2583.0>) failed to connect: ** (ErlangError) Erlang error: :econnrefused
       {"Kernel pid terminated",application_controller,"{application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.Plausible.Session.Salts',{#{'__exception__' => true,'__struct__' => 'Elixir.Postgrex.Error',connection_id => 167,message => nil,postgres => #{code => undefined_table,file => <<\"parse_relation.c\">>,line => <<\"1194\">>,message => <<\"relation \\"salts\\" does not exist\">>,pg_code => <<\"42P01\">>,position => <<\"13\">>,routine => <<\"parserOpenTable\">>,severity => <<\"ERROR\">>,unknown => <<\"ERROR\">>},query => <<\"DELETE FROM \\"salts\\" AS s0 WHERE (s0.\\"inserted_at\\" < now() - '48 hours'::interval)\">>},[{'Elixir.Ecto.Adapters.SQL',raise_sql_call_error,1,[{file,\"lib/ecto/adapters/sql.ex\"},{line,751}]},{'Elixir.Ecto.Adapters.SQL',execute,5,[{file,\"lib/ecto/adapters/sql.ex\"},{line,684}]},{'Elixir.Plausible.Session.Salts','-start_link/1-fun-0-',0,[{file,\"lib/plausible/session/salts.ex\"},{line,8}]},{'Elixir.Agent.Server',init,1,[{file,\"lib/agent/server.ex\"},{line,8}]},{gen_server,init_it,2,[{file,\"gen_server.erl\"},{line,417}]},{gen_server,init_it,6,[{file,\"gen_server.erl\"},{line,385}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{lremote: ]}]}}},{'Elixir.Plausible.Application',start,[normal,[]]}}}"}
       Kernel pid terminated (application_controller) ({application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.Plausible.Sessionremote: {#{'__exception__' => true,'__struct__' => 'Elix
remote: 
remote: rash dump is being written to: erl_crash.dump...done
=====> End of plausible web container output
remote: 2021/09/24 02:28:33 exit status 1
remote: 2021/09/24 02:28:33 exit status 1
To domain.com:plausible
 ! [remote rejected] master -> master (pre-receive hook declined)

Updated from 1.2 to 1.3 => 502 Bad Gateway

I'm getting a Dokku error page:
CleanShot 2021-05-09 at 18 02 30

I checked the network tab and it's a 502 Bad Gateway error.

I checked the logs, everything looks good:

dokku logs plausible
2021-05-09T15:55:06.006771840Z app[web.1]: Loading plausible..
2021-05-09T15:55:06.015990825Z app[web.1]: Starting dependencies..
2021-05-09T15:55:06.164684796Z app[web.1]: Starting repos..
2021-05-09T15:55:06.306541891Z app[web.1]: create Plausible.Repo database if it doesn't exist
2021-05-09T15:55:06.422965721Z app[web.1]: create Plausible.ClickhouseRepo database if it doesn't exist
2021-05-09T15:55:06.474647107Z app[web.1]: Creation of Db successful!
2021-05-09T15:55:06.952071052Z app[web.1]: Loading plausible..
2021-05-09T15:55:06.963677398Z app[web.1]: Starting dependencies..
2021-05-09T15:55:07.140013009Z app[web.1]: Starting repos..
2021-05-09T15:55:07.241909828Z app[web.1]: Running migrations for Elixir.Plausible.Repo
2021-05-09T15:55:07.460428966Z app[web.1]: Running migrations for Elixir.Plausible.ClickhouseRepo
2021-05-09T15:55:07.510057808Z app[web.1]: Migrations successful!
2021-05-09T15:55:07.883735717Z app[web.1]: Loading plausible..
2021-05-09T15:55:07.900535414Z app[web.1]: Starting dependencies..
2021-05-09T15:55:08.048857607Z app[web.1]: Starting repos..
2021-05-09T15:55:08.402104083Z app[web.1]: Admin user already exists. I won't override, bailing

I checked the proxied port, looks OK as well:

$ dokku proxy:report

=====> plausible proxy information
       Proxy enabled:                 true
       Proxy port map:                http:80:8000 https:443:8000
       Proxy type:                    nginx

also, docker ps:

e85ab3a8b6f5   dokku/plausible:latest                "/entrypoint.sh sh -โ€ฆ"   11 minutes ago   Up 11 minutes   80/tcp, 8000/tcp               plausible.web.1
d20fc6863a56   yandex/clickhouse-server:20.8.17.25   "/entrypoint.sh"         31 minutes ago   Up 31 minutes   8123/tcp, 9000/tcp, 9009/tcp   dokku.clickhouse.plausible
f39269b35524   postgres:12                           "docker-entrypoint.sโ€ฆ"   3 weeks ago      Up 3 weeks      5432/tcp                       dokku.postgres.plausible

It was working perfectly with the previous version, I pulled your updates for 1.3.0, I updated clickhouse container etc...

What could be wrong here?

Permission error when ranch tries to bind to port 80 (:eacces (permission denied))

With a fresh app build, I'm getting this error when trying to bring up plausible, both in 1.3.0 and 1.2.0.

dokku version 0.16.4

2021-07-03T20:39:49.271064411Z app[web.1]: Loading plausible..
2021-07-03T20:39:49.281241017Z app[web.1]: Starting dependencies..
2021-07-03T20:39:49.411705513Z app[web.1]: Starting repos..
2021-07-03T20:39:49.503887300Z app[web.1]: create Plausible.Repo database if it doesn't exist
2021-07-03T20:39:49.592087674Z app[web.1]: create Plausible.ClickhouseRepo database if it doesn't exist
2021-07-03T20:39:49.624973835Z app[web.1]: Creation of Db successful!
2021-07-03T20:39:49.940260244Z app[web.1]: Loading plausible..
2021-07-03T20:39:49.947982364Z app[web.1]: Starting dependencies..
2021-07-03T20:39:50.055513320Z app[web.1]: Starting repos..
2021-07-03T20:39:50.110671691Z app[web.1]: Running migrations for Elixir.Plausible.Repo
2021-07-03T20:39:50.277077631Z app[web.1]: Running migrations for Elixir.Plausible.ClickhouseRepo
2021-07-03T20:39:50.316686247Z app[web.1]: Migrations successful!
2021-07-03T20:39:50.631672118Z app[web.1]: Loading plausible..
2021-07-03T20:39:50.637919319Z app[web.1]: Starting dependencies..
2021-07-03T20:39:50.759768218Z app[web.1]: Starting repos..
2021-07-03T20:39:50.981839327Z app[web.1]: Admin user already exists. I won't override, bailing
2021-07-03T20:39:52.815603815Z app[web.1]: 20:39:52.812 [error] Failed to start Ranch listener PlausibleWeb.Endpoint.HTTP in :ranch_tcp:listen([cacerts: :..., key: :..., cert: :..., port: 80]) for reason :eacces (permission denied)
2021-07-03T20:39:52.815660840Z app[web.1]: 
2021-07-03T20:39:54.387741176Z app[web.1]: {"Kernel pid terminated",application_controller,"{application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.PlausibleWeb.Endpoint',{shutdown,{failed_to_start_child,{ranch_listener_sup,'Elixir.PlausibleWeb.Endpoint.HTTP'},{shutdown,{failed_to_start_child,ranch_acceptors_sup,{listen_error,'Elixir.PlausibleWeb.Endpoint.HTTP',eacces}}}}}}},{'Elixir.Plausible.Application',start,[normal,[]]}}}"}
2021-07-03T20:39:54.388240332Z app[web.1]: Kernel pid terminated (application_controller) ({application_start_failure,plausible,{{shutdown,{failed_to_start_child,'Elixir.PlausibleWeb.Endpoint',{shutdown,{failed_to_start_child,{ranch_listener_s
2021-07-03T20:39:54.390904832Z app[web.1]: 
2021-07-03T20:39:54.544525665Z app[web.1]: Crash dump is being written to: erl_crash.dump...done

Here's the port config. I assume these should point to container port 80, but I don't think that's stopping the web process.

$ dokku proxy:ports plausible
-----> Port mappings for plausible
-----> scheme             host port                 container port                                     
http                      80                        5000                                               
https                     443                       5000

Invalid default port mappings

I saw your commit on 50853d6 and tried reinstalling from scratch.

For some reason, even on this new app, Dokku generated a default proxy port mapping:

-----> Port mappings for plausible
    -----> scheme  host port  container port
    http           80         5000
    https          443        5000

To get things working, I had to add this: dokku proxy:ports-set plausible https:443:80 otherwise nginx was unable to connect to port 5000.

I checked other apps, and using port 5000 on the container seems to be the default, so maybe this line needs to be added to the README?

Thanks for your time!

Unable to send email

Describe the bug
Any time I try to send an email (password reset, new account), I get an error 500.

logs display Failed to send Sentry event. Cannot send Sentry event because of invalid DSN

Expected behavior
An email is sent, and no error 500 gets displayed.

Additional context
I tried this with no mail-related environment variables, and with a valid smtp config: same results in both cases.

Probably kinda related to plausible/community-edition#30?
Running through docker-compose works fine (and sends email).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.