community-edition icon indicating copy to clipboard operation
community-edition copied to clipboard

Remove mail container, no longer used or needed

Open chill117 opened this issue 2 years ago • 10 comments

The bytemark/smtp image hasn't been updated in 4 years. And plausible is able to send email via SMTP without this container. So I assume it is no longer used or needed.

chill117 avatar Feb 12 '22 13:02 chill117

@tckb thoughts?

ukutaht avatar Feb 25 '22 17:02 ukutaht

hey @chill117 If this mechanism is now natively handled by plausible (I am not current on the recent changes) then, its okay to be removed.

PS: Apologies, I am not sure why, I didn't get any notifications of mentions at all, until now! I will try to go through the places I was tagged and will try to add my notes if possible.

tckb avatar Feb 25 '22 22:02 tckb

I'm confused as to why the container was needed in the first place? I didn't change anything about this knowingly

ukutaht avatar Mar 01 '22 20:03 ukutaht

I'm confused as to why the container was needed in the first place? I didn't change anything about this knowingly

That's a good question.. my original compose file, didn't have this image. I used mailhog to be replaced by an actual smtp server. was this container added recently?

for some reason this container is used as a deployment too: https://github.com/plausible/hosting/blob/master/kubernetes/plausible-mail.yaml#L24

tckb avatar Mar 01 '22 21:03 tckb

OK this is weird. I'll test at some point removing the container from my self-hosted installation to see if it has any negative effect.

ukutaht avatar Mar 03 '22 20:03 ukutaht

Sure! I'll to dig up my K8rs installation manifests to check. At some point, I will create a PR to clean up a bit.

tckb avatar Mar 04 '22 08:03 tckb

IIUC because we have bytemark/smtp, we don't have to use any external SMTP server by modifying the Plausible SMTP_* configurations. In my case the mails go out via the machine where Plausible is running, the machine has a public IP. Basically Plausible uses the SMTP server from the container image. Is this functionality built into Plausible? If it is, then we can remove the container.

And I agree that the container image is very old, so is the exim server inside it. Should be either replaced or updated.

bhavin192 avatar Apr 24 '22 07:04 bhavin192

I'm running the container without the SMTP container and it's working flawlessly.

sebdanielsson avatar Apr 24 '22 08:04 sebdanielsson

@SebDanielsson have you changed any SMTP_* settings in your setup? https://plausible.io/docs/self-hosting-configuration#mailersmtp-setup as in are you using an external SMTP server, if yes, I think that will work without bytemark/smtp as it uses the Bamboo.SMTPAdapter.

I stopped mail container in my setup (v1.4.4), and tried resetting password. Here is what I get in the Plausible container's logs.

05:11:07.444 [error] Task #PID<0.2744.0> started from #PID<0.2743.0> terminating
** (ArgumentError) raise/1 and reraise/2 expect a module name, string or exception as the first argument, got: {:network_failure, 'mail', {:error, :nxdomain}}
    (bamboo 2.2.0) lib/bamboo/strategies/task_supervisor_strategy.ex:25: anonymous fn/3 in Bamboo.TaskSupervisorStrategy.deliver_later/3
    (elixir 1.12.2) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.129554985/0 in Bamboo.TaskSupervisorStrategy.deliver_later/3>

Setting SMTP_HOST_ADDR to localhost also gives similar error.

05:04:16.278 [error] Task #PID<0.2748.0> started from #PID<0.2747.0> terminating
** (ArgumentError) raise/1 and reraise/2 expect a module name, string or exception as the first argument, got: {:network_failure, 'localhost', {:error, :econnrefused}}
    (bamboo 2.2.0) lib/bamboo/strategies/task_supervisor_strategy.ex:25: anonymous fn/3 in Bamboo.TaskSupervisorStrategy.deliver_later/3
    (elixir 1.12.2) lib/task/supervised.ex:90: Task.Supervised.invoke_mfa/2
    (stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Function: #Function<0.129554985/0 in Bamboo.TaskSupervisorStrategy.deliver_later/3>

Basically, the mail container is required if you are not using any external SMTP server.

bhavin192 avatar May 01 '22 05:05 bhavin192

Yes I'm using an external SMTP server. I think it's unneccessary for Plausible to have one in the compose file by default.

sebdanielsson avatar May 01 '22 06:05 sebdanielsson

I think this container is indeed not needed. gen_smtp can send email without an external relay server.

ruslandoga avatar Apr 19 '23 08:04 ruslandoga

I'm a bit out of touch with the changes. But it seems this is indeed no longer needed. @ukutaht perhaps its time to remove it. The PR seems to be open for a while :)

Related #70

tckb avatar Apr 22 '23 06:04 tckb