Mastodon .env.production resets after update or restart
-
Hi,
I’m running Mastodon on my server (Cloudron-based setup), and I’ve noticed that after every app update or container restart, the file
/app/data/.env.production — which I edit via nano — gets reset to its default values.Because of this, all my custom mail server (SMTP) settings are lost each time the app restarts or updates.
Is there a way to make these environment variables persistent across updates and restarts in Mastodon?
Should I store them in another location (like cloudron.env) or configure them differently so they won’t be overwritten?Thanks in advance for your help!
-
Hello @yossi6206
Can you elaborate why you need to configure a custom mail server in the config file?
Since you can configure Cloudron to use Relay outbound mails that would handle it for you. -
Hi,
I configured the SMTP directly inside the app so that registration emails could be sent.
In the Mail FROM Address section, the app is configured to send mails using the address below and examplemail.com’s Outbound Email settings.When I test with “Send test email” from the Mastodon admin panel, it works — I receive the test email successfully.
However, inside the application itself (for example, when a new user registers), the confirmation email is not sent.So it seems that the SMTP settings work for the test function but not for real registration emails, which is why I tried setting it directly in .env.production.
-
@james
Hi,
I’ve resolved the issue. I realized registration emails are sent via Sidekiq (background jobs), not via the test mail path. Checking the Sidekiq logs pointed me to the misconfiguration and I fixed it.For reference, I used:
systemd:
sudo journalctl -u mastodon-sidekiq -f
Docker Compose:
docker-compose logs -f sidekiq
-
Hello @yossi6206
I am a little confused.You state here:
@yossi6206 said in Mastodon .env.production resets after update or restart:I’m running Mastodon on my server (Cloudron-based setup)
and now:
@yossi6206 said in Mastodon .env.production resets after update or restart:docker-compose logs -f sidekiq
So, are you hosting Mastodon on Cloudron or custom with docker-compose?