From 2c24032ec30240dbc2511a0844b501918e4c72b1 Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Tue, 1 Dec 2026 20:45:14 +0200 Subject: [PATCH] Health check do publicador em /up e /login em vez de /dashboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /dashboard exige sessão e responde 302 para /login, também na entrega activa; o publicador fazia rollback de todas as entregas (c574df4 a 01/12: cinco tentativas com HTTP 302). Passa a exigir HTTP 200 em /up e em /login. Co-Authored-By: Claude Opus 5.5 --- scripts/deployment/compras-tempo-deploy.sh | 31 +++++++++++++--------- 1 file changed, 18 insertions(+), 13 deletions(-) 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