1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +00:00
webvirtcloud/conf/docker/healthcheck
catborise 80a66dc8b5 build(docker): the image is Ubuntu 26.04 with supervisord in place of phusion's runit
phusion/baseimage brought sshd, syslog-ng, my_init and runit's per
service scripts, and an nginx log forwarder tailing a file. The image
is now ubuntu:26.04 with Ubuntu's supervisor: conf/docker holds the
start script (settings, secret key, ownership, migrations as www-data),
one supervisord.conf for the six processes, nginx's config with errors
to docker logs, the backup's cron line and the health check. A stop
signals every process at once, so the worker keeps its 60 s drain
within the 95 s grace. The same volumes and container name work as
before; README runs commands with exec -u www-data in place of
/sbin/setuser. The image goes from 805 MB to 642 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
2026-11-08 16:09:21 +03:00

10 lines
688 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 through nginx.
# 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/accounts/login/', headers={'X-Forwarded-Proto': 'https'}), timeout=5)"