feat(ops): add database readiness probe

This commit is contained in:
cesnimda
2026-08-31 11:54:36 +02:00
parent 2f146f743c
commit b9e703ee7c
6 changed files with 56 additions and 2 deletions
+6 -2
View File
@@ -305,9 +305,13 @@ than merely "running".
- **Backend:** `curl -fsS http://127.0.0.1:8080/health`. Anonymous, and deliberately **does not touch
the database** — a health check that queried MariaDB would restart a healthy backend whenever the
database blipped. `start_period` is 90s to cover first-boot schema reconciliation.
- **API/database readiness:** `curl -fsS https://<host>/ready`. This checks that the API can reach its
configured database and returns only `ready` or `unavailable`; detailed diagnostics remain admin-only.
Deployment validation requires this probe, while Docker restart policy continues to use liveness.
- **Frontend:** `wget` against nginx on port 80.
- `frontend` waits for `backend` to be *healthy*, not merely started, because nginx proxies `/api` to
it and refuses to start if the upstream cannot be resolved.
A backend that cannot reach its database exits and is reported `unhealthy`, so a broken deploy does not
present as a running stack.
A backend that cannot reach its database during startup exits and is reported `unhealthy`. A dependency
failure after startup leaves the process alive but makes `/ready` return 503, so deployment validation
cannot mistake a live-but-unready stack for a successful release.
+10
View File
@@ -550,6 +550,16 @@ if ! curl -fsS "${public_base}/" >/dev/null; then
exit 1
fi
if ! curl -fsS "${public_base}/health" >/dev/null; then
echo "Public API liveness check failed for ${public_base}/health"
exit 1
fi
if ! curl -fsS "${public_base}/ready" >/dev/null; then
echo "Public API/database readiness check failed for ${public_base}/ready"
exit 1
fi
if ! curl -fsS -D "$auth_config_headers_file" -o "$auth_config_body_file" "${public_base}/api/auth/config"; then
echo "Public API smoke check failed for ${public_base}/api/auth/config"
exit 1