From f8824ac43f68c077959c7c86668549c8179ce8ad Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 14:45:42 +0000 Subject: [PATCH] fix: restart zhuyuan-preview PM2 process on deploy + add 3801 health check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: deploy workflow only deleted zhuyuan-server before PM2 restart, leaving zhuyuan-preview in errored state. Since guanghulab.online is the preview domain (Nginx §2 → port 3801), requests to /api/* got 502. Fix: delete BOTH zhuyuan-server AND zhuyuan-preview before pm2 start. Add health check for port 3801 to detect this failure in future deploys. Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/04495ae8-6c76-4458-bbb0-262e3205dccd Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- .github/workflows/deploy-to-zhuyuan-server.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-to-zhuyuan-server.yml b/.github/workflows/deploy-to-zhuyuan-server.yml index 6a75b63b..51c40f5a 100644 --- a/.github/workflows/deploy-to-zhuyuan-server.yml +++ b/.github/workflows/deploy-to-zhuyuan-server.yml @@ -356,8 +356,9 @@ jobs: sudo nginx -t && sudo systemctl reload nginx - # PM2 重启 · 主应用 + # PM2 重启 · 主应用 + 预览进程 (两个都要清理·否则残留errored进程导致502) pm2 delete zhuyuan-server 2>/dev/null || true + pm2 delete zhuyuan-preview 2>/dev/null || true pm2 start /opt/zhuyuan/config/pm2/ecosystem.config.js pm2 save @@ -407,13 +408,15 @@ jobs: cd /opt/age-os && pm2 start ecosystem.config.js pm2 save - # 健康检查 + # 健康检查 · 主应用(3800) + 预览进程(3801) + MCP(3100) sleep 3 curl -sf http://localhost:3800/api/health || echo "⚠️ 主应用健康检查失败,等待更长时间..." + curl -sf http://localhost:3801/api/health || echo "⚠️ 预览进程健康检查失败,等待更长时间..." curl -sf http://localhost:3100/health || echo "⚠️ MCP Server健康检查失败,等待更长时间..." sleep 5 - curl -sf http://localhost:3800/api/health && echo "✅ 主应用已上线" || echo "❌ 主应用启动失败" - curl -sf http://localhost:3100/health && echo "✅ MCP Server已上线" || echo "❌ MCP Server启动失败" + curl -sf http://localhost:3800/api/health && echo "✅ 主应用已上线 (3800)" || echo "❌ 主应用启动失败 (3800)" + curl -sf http://localhost:3801/api/health && echo "✅ 预览进程已上线 (3801)" || echo "❌ 预览进程启动失败 (3801) · guanghulab.online 可能502" + curl -sf http://localhost:3100/health && echo "✅ MCP Server已上线 (3100)" || echo "❌ MCP Server启动失败 (3100)" # 记录部署操作 curl -sf -X POST http://localhost:3800/api/operations \