diff --git a/deploy.sh b/deploy.sh index 7b8c7753..9e18ffbf 100644 --- a/deploy.sh +++ b/deploy.sh @@ -20,11 +20,21 @@ fi export IMAGE_TAG="$NEW_TAG" docker compose pull docker compose up -d -sleep 5 + +# Wait for backend to be ready (retry up to 60s) +echo "Waiting for backend..." +for i in $(seq 1 12); do + sleep 5 + if curl -fsSo /dev/null --max-time 5 "https://api.polyweather.top/healthz"; then + echo "✅ healthz ready after ${i}x5s" + break + fi + echo " retry $i/12..." +done FAILED=0 -curl -fsSo /dev/null --max-time 10 "https://api.polyweather.top/healthz" && echo "✅ healthz" || { echo "❌ healthz"; FAILED=1; } -curl -fsSo /dev/null --max-time 10 "https://api.polyweather.top/api/scan/terminal?limit=1" && echo "✅ scan" || { echo "❌ scan"; FAILED=1; } +curl -fsSo /dev/null --max-time 15 "https://api.polyweather.top/healthz" && echo "✅ healthz" || { echo "❌ healthz"; FAILED=1; } +curl -fsSo /dev/null --max-time 15 "https://api.polyweather.top/api/scan/terminal?limit=1" && echo "✅ scan" || { echo "❌ scan"; FAILED=1; } curl -fsSo /dev/null --max-time 10 "https://www.polyweather.top/" && echo "✅ frontend" || { echo "❌ frontend"; FAILED=1; } if [ "$FAILED" = "1" ]; then