Skip to content

Commit fda322d

Browse files
committed
Use infinite restarts for xsnippet-api.service
systemd defaults are fairly strict (<= 5 restarts within 10s) before it gives up on the service. And we would prefer the service to recover automatically after transient failures even if takes longer than that. E.g. yesterday, I found that xsnippet-api had been down after the last machine reboot because it could not fetch the Auth0 key on start, but the same thing could happen with database connection as well.
1 parent 106e24b commit fda322d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

roles/xsnippet_api/templates/systemd.service.j2

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Description = XSnippet API
33
After = network.target network-online.target
44
Wants = network-online.target
5+
StartLimitIntervalSec = 0
56

67
[Service]
78
WorkingDirectory = {{ xsnippet_api_root }}
@@ -11,6 +12,7 @@ Group = {{ xsnippet_api_user }}
1112
ExecStartPre = {{ xsnippet_api_database_upgrade_bin }}
1213
ExecStart = {{ xsnippet_api_bin }}
1314
Restart = on-failure
15+
RestartSec = 30
1416

1517
[Install]
1618
WantedBy = multi-user.target

0 commit comments

Comments
 (0)