SPB Git

Repository Public

verify.sh 2.5 KB 29 lines shellscript

1#!/bin/bash2# Vérification post-déploiement : services, ports, santé, non-exposition du moteur, réponse réelle du modèle.3#   deploy/verify.sh [URL publique]     (sans argument : contrôles locaux uniquement)4set -uo pipefail5ROOT="$(cd "$(dirname "$0")/.." && pwd)"; PUBLIC="${1:-}"; fail=06ok(){ echo "  ok    $*"; }; ko(){ echo "  ÉCHEC $*"; fail=1; }7echo "== attente du moteur (chargement du modèle)"8for _ in $(seq 1 90); do curl -s -m 2 127.0.0.1:8811/internal/stats | grep -q '"ready": true' && break; sleep 2; done9curl -s -m 3 127.0.0.1:8811/internal/stats | grep -q '"ready": true' && ok "moteur MLX prêt (127.0.0.1:8811)" || ko "moteur MLX non prêt"10for _ in $(seq 1 15); do [ "$(curl -s -m 2 -o /dev/null -w '%{http_code}' 127.0.0.1:8810/ready)" = 200 ] && break; sleep 2; done11[ "$(curl -s -m 3 -o /dev/null -w '%{http_code}' 127.0.0.1:8810/health)" = 200 ] && ok "passerelle vivante (/health)" || ko "passerelle /health"12[ "$(curl -s -m 3 -o /dev/null -w '%{http_code}' 127.0.0.1:8810/ready)" = 200 ] && ok "passerelle prête (/ready)" || ko "passerelle /ready"13LAN=$(ipconfig getifaddr en0 2>/dev/null || true)14if [ -n "$LAN" ]; then15  curl -s -m 2 -o /dev/null "http://$LAN:8811/health" && ko "le moteur répond sur le LAN ($LAN:8811) : il doit rester en bouclage" || ok "moteur injoignable hors bouclage ($LAN:8811 fermé)"16fi17[ "$(curl -s -m 3 -o /dev/null -w '%{http_code}' 127.0.0.1:8810/admin/api/overview)" = 401 ] && ok "Dashboard fermé sans session (401)" || ko "Dashboard accessible sans session"18[ "$(curl -s -m 3 -o /dev/null -w '%{http_code}' 127.0.0.1:8810/v1/models)" = 401 ] && ok "API fermée sans clé (401)" || ko "API ouverte sans clé"19for l in engine gateway; do launchctl print "gui/$(id -u)/ai.spboucher.maclustr-llm.$l" >/dev/null 2>&1 && ok "launchd ai.spboucher.maclustr-llm.$l chargé" || ko "launchd $l absent"; done20if [ -n "$PUBLIC" ]; then21  echo "== public : $PUBLIC"22  [ "$(curl -s -m 10 -o /dev/null -w '%{http_code}' "$PUBLIC/health")" = 200 ] && ok "HTTPS /health" || ko "HTTPS /health"23  curl -s -m 10 "$PUBLIC/api/status" | grep -q '"operational"' && ok "statut public : operational" || ko "statut public"24  curl -sI -m 10 "$PUBLIC/" | grep -qi "strict-transport-security" && ok "HSTS présent" || ko "HSTS absent"25  [ "$(curl -s -m 10 -o /dev/null -w '%{http_code}' "$PUBLIC/admin/api/keys")" = 401 ] && ok "Dashboard public fermé (401)" || ko "Dashboard public"26fi27[ $fail = 0 ] && echo "VÉRIFICATION RÉUSSIE" || echo "VÉRIFICATION EN ÉCHEC"28exit $fail29
Files main
Menu

Theme