diff --git a/scripts/deployment/compras-tempo-deploy.sh b/scripts/deployment/compras-tempo-deploy.sh index a67cfd9..ac0382c 100644 --- a/scripts/deployment/compras-tempo-deploy.sh +++ b/scripts/deployment/compras-tempo-deploy.sh @@ -185,22 +185,27 @@ log "Executar health check local." HEALTH_OK=0 +# /dashboard exige sessão e responde 302 para /login; o health check usa +# /up (arranque do Laravel) e /login (página pública renderizada). +health_code() { + /usr/bin/curl \ + --noproxy '*' \ + --silent \ + --show-error \ + --output /dev/null \ + --write-out '%{http_code}' \ + --resolve "$HOST:443:127.0.0.1" \ + --max-time 15 \ + "https://$HOST$1" || true +} + for attempt in 1 2 3 4 5; do - HTTP_CODE="$( - /usr/bin/curl \ - --noproxy '*' \ - --silent \ - --show-error \ - --output /dev/null \ - --write-out '%{http_code}' \ - --resolve "$HOST:443:127.0.0.1" \ - --max-time 15 \ - "https://$HOST/dashboard" || true - )" + UP_CODE="$(health_code /up)" + LOGIN_CODE="$(health_code /login)" - log "Health check $attempt: HTTP $HTTP_CODE" + log "Health check $attempt: /up HTTP $UP_CODE, /login HTTP $LOGIN_CODE" - if [ "$HTTP_CODE" = "200" ]; then + if [ "$UP_CODE" = "200" ] && [ "$LOGIN_CODE" = "200" ]; then HEALTH_OK=1 break fi