s6-auth-verify.sh58 lines · main
| 1 | #!/usr/bin/env bash |
| 2 | # S6 auth reliability verify — safe, read-only probes (no deploy, no Redis kill). |
| 3 | # Usage: ./scripts/s6-auth-verify.sh [api_origin] |
| 4 | set -euo pipefail |
| 5 | |
| 6 | API="${1:-https://api.briven.tech}" |
| 7 | |
| 8 | echo "== S6 auth reliability verify ==" |
| 9 | echo "api: $API" |
| 10 | echo |
| 11 | |
| 12 | echo "-- /health --" |
| 13 | curl -sS -m 8 "$API/health" | tee /tmp/s6-health.json |
| 14 | echo |
| 15 | echo |
| 16 | |
| 17 | echo "-- /ready --" |
| 18 | READY_CODE=$(curl -sS -m 8 -o /tmp/s6-ready.json -w '%{http_code}' "$API/ready" || true) |
| 19 | cat /tmp/s6-ready.json |
| 20 | echo |
| 21 | echo "http: $READY_CODE" |
| 22 | echo |
| 23 | |
| 24 | echo "-- /info --" |
| 25 | curl -sS -m 8 "$API/info" | tee /tmp/s6-info.json |
| 26 | echo |
| 27 | echo |
| 28 | |
| 29 | python3 - <<'PY' |
| 30 | import json, sys |
| 31 | ready = json.load(open("/tmp/s6-ready.json")) |
| 32 | health = json.load(open("/tmp/s6-health.json")) |
| 33 | info = json.load(open("/tmp/s6-info.json")) |
| 34 | checks = ready.get("checks") or {} |
| 35 | ok = True |
| 36 | def need(cond, msg): |
| 37 | global ok |
| 38 | mark = "PASS" if cond else "FAIL" |
| 39 | if not cond: ok = False |
| 40 | print(f" [{mark}] {msg}") |
| 41 | |
| 42 | print("== verdict ==") |
| 43 | need(health.get("status") == "ok", "health status ok") |
| 44 | need(health.get("env") == "production" or health.get("env") == "development", f"env={health.get('env')}") |
| 45 | need(ready.get("status") == "ready", "ready status ready") |
| 46 | need(checks.get("redis") in ("ok", "not_configured"), f"redis={checks.get('redis')}") |
| 47 | need(checks.get("control_postgres") == "ok", f"control_postgres={checks.get('control_postgres')}") |
| 48 | need(bool(info.get("buildSha")), f"buildSha={str(info.get('buildSha'))[:12]}") |
| 49 | print() |
| 50 | if ok: |
| 51 | print("S6 platform probes PASS.") |
| 52 | print("Still required for full S6 product claim:") |
| 53 | print(" - Human AUTH-GO-LIVE rows 1–4 + 7 on pilot project") |
| 54 | print(" - Second-project isolation in dashboard (see docs/S6-RELIABILITY.md)") |
| 55 | sys.exit(0) |
| 56 | print("S6 platform probes FAIL — fix /ready before pilot sign-off.") |
| 57 | sys.exit(1) |
| 58 | PY |