From f5aefb27e3d2b04890237b44ff38c0d25873d3e7 Mon Sep 17 00:00:00 2001 From: "2569718930@qq.com" <2569718930@qq.com> Date: Tue, 26 May 2026 03:55:21 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E7=BD=B2=E4=BF=AE=E5=A4=8D=EF=BC=9Asl?= =?UTF-8?q?eep=205=20=E6=94=B9=E9=87=8D=E8=AF=95=E5=BE=AA=E7=8E=AF?= =?UTF-8?q?=EF=BC=8C=E7=AD=89=20backend=20=E7=9C=9F=E6=AD=A3=20ready=20?= =?UTF-8?q?=E5=86=8D=20smoke=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit backend Python imports 需要 10-15s,固定 sleep 5 不够。 --- deploy.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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