From efbbe3408095bf5382e14d76994d7ce13cd1be13 Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Tue, 3 Feb 2026 20:42:59 -0600 Subject: [PATCH] fix: add backend health check step to production workflow Add "Wait for backend health" step using docker exec to verify backend is responding before attempting external health check. Matches staging workflow pattern. Co-Authored-By: Claude Opus 4.5 --- .gitea/workflows/production.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitea/workflows/production.yaml b/.gitea/workflows/production.yaml index 27a6bb7..e6dda30 100644 --- a/.gitea/workflows/production.yaml +++ b/.gitea/workflows/production.yaml @@ -296,6 +296,22 @@ jobs: fi done + - name: Wait for backend health + run: | + for i in 1 2 3 4 5 6; do + if docker exec mvp-backend-$TARGET_STACK curl -sf http://localhost:3001/health > /dev/null 2>&1; then + echo "OK: Backend health check passed" + exit 0 + fi + if [ $i -eq 6 ]; then + echo "ERROR: Backend health check failed after 6 attempts" + docker logs mvp-backend-$TARGET_STACK --tail 100 + exit 1 + fi + echo "Attempt $i/6: Backend not ready, waiting 10s..." + sleep 10 + done + - name: External health check run: | REQUIRED_FEATURES='["admin","auth","onboarding","vehicles","documents","fuel-logs","stations","maintenance","platform","notifications","user-profile","user-preferences","user-export"]'