forge
Explore
Log in

Don't you dare go Hollow

Retry a failed compose-up instead of staying down

Browse files at this commit

f195e7a6f770d97857b5340e308de462b2369eaeAhmet Kaan GümüşParent: 2918040
  • fix
    • retry a failed compose-up instead of staying down
Show full message
fix: retry a failed compose-up instead of staying down

Keep Type=oneshot and `up -d`. systemd 259 honors Restart=on-failure
for oneshot (measured: the restart counter advanced). Attached
`podman compose up` does not: podman-compose 1.6 only runs down on
SIGINT, and a container start failure exits 0, so Type=simple
Restart= would never see the failure. RestartSec=1500s is past the
longest deploy health gate (rag, 960s), so a background retry cannot
undo a rollback.
deploy/hezarfen_backend_compose.servicemodified+9 -0
@@ -26,6 +26,13 @@
26 # Env-only restart (restart re-runs `compose up -d`, recreating containers26 # Env-only restart (restart re-runs `compose up -d`, recreating containers
27 # whose environment changed):27 # whose environment changed):
28 # systemctl --user restart hezarfen_backend_compose28 # systemctl --user restart hezarfen_backend_compose
29+#
30+# A failed ExecStart (boot-time `compose up`, or a restart) is retried after
31+# 1500s until one succeeds. systemd 259 honors Restart= on Type=oneshot.
32+# Attached `podman compose up` is not used: podman-compose 1.6 only runs
33+# `down` on SIGINT, and a container that fails to start exits 0, so Restart=
34+# would never see that failure. 1500s is past the longest deploy health gate
35+# (rag, 960s) so a background retry cannot undo a rollback.
29 36
30 [Unit]37 [Unit]
31 Description=Hezarfen backend compose stack (postgres + backend + openobserve)38 Description=Hezarfen backend compose stack (postgres + backend + openobserve)
@@ -35,6 +42,8 @@ Wants=network-online.target
35 [Service]42 [Service]
36 Type=oneshot43 Type=oneshot
37 RemainAfterExit=yes44 RemainAfterExit=yes
45+Restart=on-failure
46+RestartSec=1500s
38 WorkingDirectory=%h/hezarfen_backend47 WorkingDirectory=%h/hezarfen_backend
39 # ORTAM IKI KANALDAN GELIR -- bu bir tercih degil, saglayicinin siniridir:48 # ORTAM IKI KANALDAN GELIR -- bu bir tercih degil, saglayicinin siniridir:
40 # * operatorun ayar dosyasi -> `EnvironmentFile=` (systemd dosyayi unit'in49 # * operatorun ayar dosyasi -> `EnvironmentFile=` (systemd dosyayi unit'in