Parcourir la source

fix: 修复自动部署脚本中 SERVER_PORT 配置

MyFramework User il y a 4 mois
Parent
commit
daa73ac446
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      server/deploy-auto.sh

+ 3 - 1
server/deploy-auto.sh

@@ -35,7 +35,9 @@ log "重启后端服务..."
 
 # 使用 PM2 重启
 if command -v pm2 &> /dev/null; then
-    pm2 restart server 2>&1 | tee -a "$DEPLOY_LOG" || pm2 start dist/app.js --name server 2>&1 | tee -a "$DEPLOY_LOG"
+    # 需要设置 SERVER_PORT=3100
+    pm2 delete server 2>/dev/null || true
+    SERVER_PORT=3100 pm2 start dist/app.js --name server 2>&1 | tee -a "$DEPLOY_LOG"
     pm2 save 2>&1 | tee -a "$DEPLOY_LOG"
 else
     log "PM2 未安装,跳过进程管理"