部署修复:sleep 5 改重试循环,等 backend 真正 ready 再 smoke test
backend Python imports 需要 10-15s,固定 sleep 5 不够。
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user