s6-auth-verify.sh 1.8 KB

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