fix(deploy): 等待维护入口完成重载
NGINX 优雅重载期间旧 worker 可能短暂继续返回 200,单次状态码断言会误触发安全回滚。改为最多轮询 15 秒等待维护页返回 503。\n\n验证:bash -n、ShellCheck、git diff --check、真实维护页 503 与恢复后公网 200。
This commit is contained in:
@@ -138,9 +138,17 @@ chmod 0600 "$old_site_backup"
|
|||||||
install -m 0644 /etc/nginx/sites-available/ai.51easyai.com-maintenance "$active_site"
|
install -m 0644 /etc/nginx/sites-available/ai.51easyai.com-maintenance "$active_site"
|
||||||
nginx -t
|
nginx -t
|
||||||
systemctl reload nginx
|
systemctl reload nginx
|
||||||
curl -ksS --resolve ai.51easyai.com:443:127.0.0.1 \
|
maintenance_code=
|
||||||
-o /dev/null -w '%{http_code}' https://ai.51easyai.com/api/v1/healthz |
|
for _ in $(seq 1 15); do
|
||||||
grep -qx 503
|
maintenance_code=$(curl -ksS --resolve ai.51easyai.com:443:127.0.0.1 \
|
||||||
|
-o /dev/null -w '%{http_code}' https://ai.51easyai.com/api/v1/healthz || true)
|
||||||
|
[[ $maintenance_code == 503 ]] && break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
[[ $maintenance_code == 503 ]] || {
|
||||||
|
echo "maintenance NGINX did not become active: HTTP $maintenance_code" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
docker stop --time 60 easyai-ai-gateway-api-1 >/dev/null
|
docker stop --time 60 easyai-ai-gateway-api-1 >/dev/null
|
||||||
postgres_user=$(docker inspect easyai-ai-gateway-postgres-1 \
|
postgres_user=$(docker inspect easyai-ai-gateway-postgres-1 \
|
||||||
|
|||||||
Reference in New Issue
Block a user