Menu
Public repository / 054e5cda0171bd13facff3c16a38f2048a1052cc
AkurAI-Mail / scripts/validate.sh
Latest change 054e5cda0171bd13facff3c16a38f2048a1052cc - OLI-249: compose, settings, admin console and sign-in on the framework; SvelteKit removed by Ólafur Búi Ólafsson
#!/usr/bin/env bash
# scripts/validate.sh — Post-deploy validation for the AkurAI mail service
# (Rust akurai-mail-api + the framework UI in build/, deployed as one unit: akurai-mail-ui).
# Canonical copy lives in AkurAI-Mail; AkurAI-MailAPI carries a byte-identical copy
# (enforced by AkurAI-MailAPI/scripts/check-validate-sync.sh).
set -euo pipefail
: "${DOMAIN:=mail.olibuijr.com}"
: "${PORT:=3000}"
: "${APP_NAME:=akurai-mail-ui}"
RED='\033[0;31m'; GRN='\033[0;32m'; NC='\033[0m'
pass=0; fail=0
pass_() { printf " ${GRN}PASS${NC} %s\n" "$*"; ((++pass)); }
fail_() { printf " ${RED}FAIL${NC} %s\n" "$*"; ((++fail)); }
echo "=== Post-deploy validation: ${APP_NAME} ==="
systemctl is-active --quiet "${APP_NAME}.service" 2>/dev/null && pass_ "systemd active" || fail_ "systemd not active"
curl -fsS --max-time 5 "http://127.0.0.1:${PORT}/" > /dev/null 2>&1 && pass_ "loopback reachable" || fail_ "loopback unreachable"
curl -fsS --max-time 10 "https://${DOMAIN}/" > /dev/null 2>&1 && pass_ "public reachable" || fail_ "public unreachable"
curl -fsS --max-time 5 "http://127.0.0.1:${PORT}/login" 2>/dev/null | grep -qi 'login\|password\|sign' && pass_ "login page renders" || fail_ "login page not found"
curl -fsS --max-time 5 "https://${DOMAIN}/api/health" 2>/dev/null | python3 -c 'import sys,json; d=json.load(sys.stdin); assert d["app"] and d["version"] and d["status"]=="ok"' 2>/dev/null && pass_ "health contract {app,version,status}" || fail_ "health contract failed"
curl -fsS --max-time 5 "https://${DOMAIN}/api/auth/check" > /dev/null 2>&1 && pass_ "auth check endpoint" || fail_ "auth check endpoint failed"
echo "━━━━━━━━━━━━━━━━━━━━━━━━"
echo -e "${GRN}Pass: $pass${NC} ${RED}Fail: $fail${NC}"
[ "$fail" -eq 0 ] || exit 1