diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index de5ef89..9baf0b4 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -84,14 +84,17 @@ jobs: # ── Migrations (runs inside the container) ── docker compose exec -T waitlist alembic upgrade head - # ── Health check ── - echo "Waiting for app..." - sleep 5 - HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80/health) - if [ "$HTTP_CODE" -eq 200 ]; then - echo "✅ Waitlist service is healthy (HTTP ${HTTP_CODE})" - else - echo "❌ Health check failed (HTTP ${HTTP_CODE})" - docker compose logs waitlist --tail=50 - exit 1 - fi + # ── Health check (curl with correct Host header for Caddy) ── + echo "Waiting for app to start..." + for i in 1 2 3 4 5; do + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Host: adiuvai.com" http://localhost:80/health) + if [ "$HTTP_CODE" -eq 200 ]; then + echo "✅ Waitlist service is healthy (HTTP ${HTTP_CODE})" + exit 0 + fi + echo " Attempt $i: HTTP ${HTTP_CODE}, retrying..." + sleep 3 + done + echo "❌ Health check failed after 5 attempts" + docker compose logs waitlist --tail=50 + exit 1