plausible / community-edition

Example Docker Compose setup for hosting Plausible Community Edition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Email not working and no way of debugging

Crocmagnon opened this issue Β· comments

I'm trying to setup plausible to send weekly and monthly reports. I added the relevant variables but I don't receive the emails.

I couldn't find any way to send an email immediately, and I don't really want to wait 1 week between retries 😊

Here's my conf:

MAILER_EMAIL=plausible@mg.augendre.info
SMTP_HOST_ADDR=smtp.mailgun.org
SMTP_HOST_PORT=465
SMTP_USER_NAME=plausible@mg.augendre.info
SMTP_USER_PWD=supersecurepassword
SMTP_HOST_SSL_ENABLED=true
SMTP_RETRIES=2

I faced the same issue. You can run docker without --detach and when doing a password reset or registering a new user you get an error:

[warn] Failed to send Sentry event.Cannot send Sentry event because of invalid DSN

Which I think is weird. It happens with SMTP_HOST_ADDR set to localhost, 127.0.0.1 and the special host.docker.internal (see blow for requirement) and I guess is a bug.

Workaround that I used is letting the mail service relay it again

  mail:
    image: bytemark/smtp
    restart: always
    environment:
      RELAY_HOST: smtp.mailgun.org
      RELAY_PORT: 465
      RELAY_USERNAME: alice@example.com
      RELAY_PASSWORD: secretpassword

See: https://hub.docker.com/r/bytemark/smtp/

Add this to your service if you want to have the host addressable via host.docker.internal

    extra_hosts:
      - "host.docker.internal:host-gateway"

@Crocmagnon You can test/debug email delivery by trying to send a password reset to an existing account. You can check for any errors with docker logs <plausible-container-name>

To get weekly/monthly reports to work, you need to set CRON_ENABLED=1 in your configuration. I will cut a new release this month where this is enabled by default.

Thanks @kevinvalk. I'd like not to resort to another service since plausible should be able to speak to an existing relay.

@ukutaht, the CRON_ENABLED variable is not mentioned in the docs (here). I enabled it, will check if I get these reports πŸ™‚

I can't find a way to send a password reset. The only page I found other than the site view is this one:
image

Yes it does, thanks @metmarkosaric!
Using the URL provided in the docs on my self-hosted instance I've been able to try and send an email. My config was ok.

Thanks!

One issue still though, when I enable cron via the env variable, plausible is really not happy:

See the error log (happens at boot time)
Attaching to plausible_plausible_1
 ERROR! Config provider Config.Reader failed with:
 {"init terminating in do_boot",{badarg,[{erlang,binary_to_existing_atom,[<<"1">>,utf8],[]},{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,680}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,449}]},{elixir,recur_eval,3,[{file,"src/elixir.erl"},{line,278}]},{elixir,eval_forms,3,[{file,"src/elixir.erl"},{line,263}]},{'Elixir.Code',eval_string_with_error_handling,3,[{file,"lib/code.ex"},{line,341}]},{'Elixir.Config','__eval__!',2,[{file,"lib/config.ex"},{line,219}]},{'Elixir.Config.Reader','read!',2,[{file,"lib/config/reader.ex"},{line,57}]}]}}
 ** (ArgumentError) argument error
     :erlang.binary_to_existing_atom("1", :utf8)
     (stdlib 3.12.1) erl_eval.erl:680: :erl_eval.do_apply/6
     (stdlib 3.12.1) erl_eval.erl:449: :erl_eval.expr/5
     (elixir 1.10.4) src/elixir.erl:278: :elixir.recur_eval/3
     (elixir 1.10.4) src/elixir.erl:263: :elixir.eval_forms/3
     (elixir 1.10.4) lib/code.ex:341: Code.eval_string_with_error_handling/3
     (elixir 1.10.4) lib/config.ex:219: Config.__eval__!/2
     (elixir 1.10.4) lib/config/reader.ex:57: Config.Reader.read!/2

 init terminating in do_boot ({badarg,[{erlang,binary_to_existing_atom,[,utf8],[]},{erl_eval,do_apply,6,[{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{elixir,recur_eval,3,[{_},{_}]},{elixir,eval_forms,3,[{_},

 Crash dump is being written to: erl_crash.dump...done
 ERROR! Config provider Config.Reader failed with:
 ** (ArgumentError) argument error
     :erlang.binary_to_existing_atom("1", :utf8)
     (stdlib 3.12.1) erl_eval.erl:680: :erl_eval.do_apply/6
     (stdlib 3.12.1) erl_eval.erl:449: :erl_eval.expr/5
     (elixir 1.10.4) src/elixir.erl:278: :elixir.recur_eval/3
     (elixir 1.10.4) src/elixir.erl:263: :elixir.eval_forms/3
     (elixir 1.10.4) lib/code.ex:341: Code.eval_string_with_error_handling/3
     (elixir 1.10.4) lib/config.ex:219: Config.__eval__!/2
     (elixir 1.10.4) lib/config/reader.ex:57: Config.Reader.read!/2

 {"init terminating in do_boot",{badarg,[{erlang,binary_to_existing_atom,[<<"1">>,utf8],[]},{erl_eval,do_apply,6,[{file,"erl_eval.erl"},{line,680}]},{erl_eval,expr,5,[{file,"erl_eval.erl"},{line,449}]},{elixir,recur_eval,3,[{file,"src/elixir.erl"},{line,278}]},{elixir,eval_forms,3,[{file,"src/elixir.erl"},{line,263}]},{'Elixir.Code',eval_string_with_error_handling,3,[{file,"lib/code.ex"},{line,341}]},{'Elixir.Config','__eval__!',2,[{file,"lib/config.ex"},{line,219}]},{'Elixir.Config.Reader','read!',2,[{file,"lib/config/reader.ex"},{line,57}]}]}}
 init terminating in do_boot ({badarg,[{erlang,binary_to_existing_atom,[,utf8],[]},{erl_eval,do_apply,6,[{_},{_}]},{erl_eval,expr,5,[{_},{_}]},{elixir,recur_eval,3,[{_},{_}]},{elixir,eval_forms,3,[{_},

 Crash dump is being written to: erl_crash.dump...done

Sorry my bad. It's CRON_ENABLED=true. And apologies for not having these things documented. Like I said, it will be enabled by default in future versions.

No problem! I just pointed it out to increase the quality of the docs πŸ™‚

I can confirm that plausible boots fine with CRON_ENABLED=true! Thank you all for your help πŸ‘Œ