diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index f7cb632..146f85e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -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