homelab-codex-ws/services/kb-site/healthcheck.sh

22 lines
711 B
Bash
Raw Normal View History

#!/bin/bash
# Healthcheck for kb-site (nginx:alpine serving the generated public KB)
# Container must be running
if ! docker ps --filter "name=kb-site" --filter "status=running" | grep -qw "kb-site"; then
echo "[FAIL] kb-site container is not running"
exit 1
fi
# The index is generated on every run, so both the bare root and /index.html
# must answer. An empty volume means the content was never loaded — see
# kb/runbooks/kb-site-deploy.md.
for path in "" index.html; do
if ! curl -sf -o /dev/null "http://127.0.0.1:8250/${path}"; then
echo "[FAIL] kb-site is not serving /${path} on 127.0.0.1:8250 (content loaded?)"
exit 1
fi
done
echo "[OK] kb-site is healthy"
exit 0