Retry a failed compose-up instead of staying down
Browse files at this commitf195e7a6f770d97857b5340e308de462b2369eaeParent: 2918040- fix
- retry a failed compose-up instead of staying down
1 changed file +9 -0
deploy/hezarfen_backend_compose.servicemodified+9 -0
| @@ -26,6 +26,13 @@ | |||
| 26 | # Env-only restart (restart re-runs `compose up -d`, recreating containers | 26 | # 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_compose | 28 | # 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=oneshot | 43 | Type=oneshot |
| 37 | RemainAfterExit=yes | 44 | RemainAfterExit=yes |
| 45 | +Restart=on-failure | ||
| 46 | +RestartSec=1500s | ||
| 38 | WorkingDirectory=%h/hezarfen_backend | 47 | 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'in | 49 | # * operatorun ayar dosyasi -> `EnvironmentFile=` (systemd dosyayi unit'in |