YunoHost-Apps / listmonk_ynh

Listmonk package for YunoHost
https://listmonk.app/
GNU General Public License v3.0
4 stars 2 forks source link

Listmonk service often fails to start after server restart #35

Closed CodeShakingSheep closed 10 months ago

CodeShakingSheep commented 1 year ago

Describe the bug

After I restart my whole yunohost server, listmonk service often fails to restart. According to the logs the problem seems to be that the service tries to start before the DB is up again. When I start listmonk service manually after server is up again there is no issue. So, may be a solution would be to tell listmonk service to wait until DB is up again before restarting. I have a lot of systemd services running and listmonk is the only one with this problem. Thank you for help.

Context

Steps to reproduce

Just restart whole Yunohost server and wait if listmonk systemd service starts successfully.

Expected behavior

Listmonk systemd service should start successfully after server restart.

Logs

Here are the logs: https://paste.yunohost.org/lejehupavu

CodeShakingSheep commented 11 months ago

I just took some time to investigate this issue myself. I found these log lines which seem to be relevant:

Aug 02 10:38:17 systemd[1]: listmonk.service: Start request repeated too quickly.
Aug 02 10:38:17 systemd[1]: listmonk.service: Failed with result 'exit-code'.

4 of 5 attempts for starting the service are executed in the exact same second. To fix the issue that the start request is repeated too quickly, a possible solution would be to specify RestartSec=2s in systemd service file or perhaps the number of seconds between the start attempts even needs to be increased.

Setting RestartSec=2c is also done in Vikunja, see here which seems to work great (at least I never encountered any failed Vikunja service startups and I'm running Vikunja on the same server as Listmonk). Would you accept a PR for this @navanchauhan ?

navanchauhan commented 10 months ago

Let me look into this over the weekend, been a bit too busy lately

CodeShakingSheep commented 10 months ago

It has already been fixed, see https://github.com/YunoHost-Apps/listmonk_ynh/commit/0c499382910c5d506d790f5b671cdfc92fbd4529 .