fix: use port 3001 for test-run to avoid systemd port conflict
Some checks failed
Deploy API Server / build-and-deploy (push) Failing after 32s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 12:20:51 +08:00
parent 257693676c
commit 8103d547e1

View File

@ -87,19 +87,16 @@ jobs:
- name: Test-run and health check
run: |
# Stop systemd service first to free the port
sudo systemctl stop zhixi-api 2>/dev/null || true
sleep 1
# Run app directly in background
# Run app directly on alternate port to avoid systemd conflict
cd /opt/zhixi/backend
PORT=3000 node dist/main.js > /tmp/zhixi-startup.log 2>&1 &
PORT=3001 node dist/main.js > /tmp/zhixi-startup.log 2>&1 &
APP_PID=$!
echo "[deploy] App PID: $APP_PID"
echo "[deploy] App PID: $APP_PID (port 3001)"
# Wait for app to start (up to 30s)
for i in $(seq 1 30); do
sleep 1
if curl -sf http://localhost:3000/api > /dev/null 2>&1; then
echo "[deploy] API healthy after ${i}s!"
if curl -sf http://localhost:3001/api > /dev/null 2>&1; then
echo "[deploy] API healthy on port 3001 after ${i}s!"
break
fi
if ! kill -0 $APP_PID 2>/dev/null; then