fix(deploy): retry API health check after container restart

After --force-recreate web, the API container can take >10s to become
healthy. Retry up to 5 times with 5s backoff so transient startup
latency doesn't mark a successful deploy as failed.

Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
XikaandPaperclip committed 2026-07-01 01:23:15 +00:00
1 parent 41ba0befe6
commit 20966501a8
1 file changed
+6 -1
+6 -1
View File
@@ -56,7 +56,12 @@ log "Building API + worker ($GIT_SHA)"
log "Building admin UI ($GIT_SHA)"
$COMPOSE build --build-arg GIT_SHA="$GIT_SHA" web
$COMPOSE up -d --force-recreate web
curl -sf --max-time 10 http://127.0.0.1:8000/api/health >/dev/null
for i in 1 2 3 4 5; do
curl -sf --max-time 8 http://127.0.0.1:8000/api/health >/dev/null && break
log "API not ready yet (attempt $i/5), retrying in 5s..."
sleep 5
done
curl -sf --max-time 8 http://127.0.0.1:8000/api/health >/dev/null
write_status "ok $GIT_SHA $(date -Iseconds)"
log "Deploy OK ($GIT_SHA)"
log "Refreshing deploy-hook (self-restart — runs detached)"