Skip to content

Commit 584b8bb

Browse files
committed
(podman) rollback systemd unit watchdog feature
1 parent a362289 commit 584b8bb

File tree

2 files changed

+0
-35
lines changed

2 files changed

+0
-35
lines changed

roles/podman/files/application_execstart.sh

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ set -euo pipefail
55
TIMEOUT="${TIMEOUT:-300}"
66
INTERVAL="${INTERVAL:-5}"
77

8-
# --- Phase 1: Startup health wait ---
9-
108
# Read container IDs into array, one per line, then put it into the CONTAINERS var
119
mapfile -t CONTAINERS < <(podman-compose ps -q)
1210
TOTAL=${#CONTAINERS[@]}
@@ -46,32 +44,3 @@ while true; do
4644
done
4745

4846
systemd-notify --ready --status="All ${TOTAL} containers healthy"
49-
50-
# --- Phase 2: Watchdog loop ---
51-
52-
# WATCHDOG_USEC is set automatically by systemd from WatchdogSec= (in microseconds).
53-
# We convert to seconds and halve it so we actually check in well before the deadline.
54-
# We also hardcode on purpose the minimal healcheck interval to 5 seconds.
55-
WATCHDOG_USEC="${WATCHDOG_USEC:-60000000}"
56-
WATCHDOG_SEC=$((WATCHDOG_USEC / 1000000 / 2))
57-
[ "$WATCHDOG_SEC" -lt 5 ] && WATCHDOG_SEC=5
58-
59-
while true; do
60-
sleep "$WATCHDOG_SEC"
61-
62-
for c in "${CONTAINERS[@]}"; do
63-
STATE=$(podman inspect --format "{{.State.Status}}" "$c" 2>/dev/null || true)
64-
if [ "$STATE" != "running" ]; then
65-
echo "Container $c is no longer running (state: ${STATE:-gone})"
66-
exit 1
67-
fi
68-
69-
HEALTH=$(podman inspect --format "{{.State.Health.Status}}" "$c" 2>/dev/null || true)
70-
if [ "$HEALTH" = "unhealthy" ]; then
71-
echo "Container $c became unhealthy"
72-
exit 1
73-
fi
74-
done
75-
76-
systemd-notify WATCHDOG=1 --status="Watchdog: ${TOTAL} containers healthy"
77-
done

roles/podman/templates/application_systemd_unit.j2

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,5 @@ Environment=TIMEOUT={{ st_podman_application_timeout }}
2424
# TIMEOUT + 30s buffer for podman-compose overhead (pulling, network setup, etc.)
2525
TimeoutStartSec={{ st_podman_application_timeout + 30 }}
2626

27-
# How often systemd expects a heartbeat from the ExecStart script.
28-
# If no check-in within this window, systemd considers the service hung.
29-
WatchdogSec=60
30-
3127
[Install]
3228
WantedBy=default.target

0 commit comments

Comments
 (0)