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]
4set -euo pipefail
5
6API="${1:-https://api.briven.tech}"
7
8echo "== S6 auth reliability verify =="
9echo "api: $API"
10echo
11
12echo "-- /health --"
13curl -sS -m 8 "$API/health" | tee /tmp/s6-health.json
14echo
15echo
16
17echo "-- /ready --"
18READY_CODE=$(curl -sS -m 8 -o /tmp/s6-ready.json -w '%{http_code}' "$API/ready" || true)
19cat /tmp/s6-ready.json
20echo
21echo "http: $READY_CODE"
22echo
23
24echo "-- /info --"
25curl -sS -m 8 "$API/info" | tee /tmp/s6-info.json
26echo
27echo
28
29python3 - <<'PY'
30import json, sys
31ready = json.load(open("/tmp/s6-ready.json"))
32health = json.load(open("/tmp/s6-health.json"))
33info = json.load(open("/tmp/s6-info.json"))
34checks = ready.get("checks") or {}
35ok = True
36def 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
42print("== verdict ==")
43need(health.get("status") == "ok", "health status ok")
44need(health.get("env") == "production" or health.get("env") == "development", f"env={health.get('env')}")
45need(ready.get("status") == "ready", "ready status ready")
46need(checks.get("redis") in ("ok", "not_configured"), f"redis={checks.get('redis')}")
47need(checks.get("control_postgres") == "ok", f"control_postgres={checks.get('control_postgres')}")
48need(bool(info.get("buildSha")), f"buildSha={str(info.get('buildSha'))[:12]}")
49print()
50if 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)
56print("S6 platform probes FAIL — fix /ready before pilot sign-off.")
57sys.exit(1)
58PY