1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 08:56:07 +00:00
webvirtcloud/conf/docker/healthcheck
catborise 7b23c75bf5 fix: the API verifies a backup and shows what was found; Docker's health check reads /healthz
The backups API had every backup action but Verify, and did not show a
backup's verified_at and damage: a script restoring through it got no sign
of a damaged chain. Docker's health check asked for the login page, so a
hung job worker left the container healthy; it now reads /healthz.
2026-11-19 21:03:54 +03:00

11 lines
765 B
Bash

#!/bin/sh
# Docker's health check: every process has run for 5 s at least (one that
# keeps failing never has) and the panel answers /healthz through nginx: its
# database answers and the job worker beats (a hung worker runs still).
# X-Forwarded-Proto: https keeps the HTTPS profile from redirecting it.
# "webvirtcloud:worker RUNNING pid 27, uptime 0:00:10" (or "1 day, 0:00:10")
supervisorctl status | awk '
$2 != "RUNNING" { print; bad = 1; next }
$0 !~ / day/ { split($NF, t, ":"); if (t[1] * 3600 + t[2] * 60 + t[3] < 5) { print; bad = 1 } }
END { exit bad }' || exit 1
exec /srv/webvirtcloud/venv/bin/python3 -c "import urllib.request as u; u.urlopen(u.Request('http://127.0.0.1/healthz', headers={'X-Forwarded-Proto': 'https'}), timeout=5)"