add production readiness and recovery assets

This commit is contained in:
Marco0300
2026-09-03 12:38:27 +02:00
parent 537a2a6f0a
commit 6b41d5b9ee
25 changed files with 540 additions and 18 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/bin/sh
set -eu
URL=${HEALTHCHECK_URL:-http://127.0.0.1:8000/api/v1/health/ready}
TIMEOUT=${HEALTHCHECK_TIMEOUT:-5}
python3 - "$URL" "$TIMEOUT" <<'PY'
import json, sys, urllib.request
url, timeout = sys.argv[1], float(sys.argv[2])
try:
with urllib.request.urlopen(url, timeout=timeout) as response:
payload=json.loads(response.read())
if response.status != 200 or payload.get('status') != 'ok' or payload.get('ready') is not True:
raise RuntimeError('service is not ready')
if payload.get('outreach_enabled') is not False: raise RuntimeError('outreach safety check failed')
except Exception as exc:
print(f'healthcheck failed: {type(exc).__name__}', file=sys.stderr)
raise SystemExit(1)
print('ok')
PY