fix: restore simple systemd restart — server rate-limit manually cleared
All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 40s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
WangDL 2026-05-24 13:06:54 +08:00
parent bb555d4a72
commit dffcd0192d

View File

@ -79,35 +79,16 @@ jobs:
run: |
cd /opt/zhixi/backend && npx prisma generate
- name: Start API service
- name: Restart API service
run: |
cd /opt/zhixi/backend
PORT=3000 nohup node dist/main.js > /tmp/zhixi-direct.log 2>&1 &
DIRECT_PID=$!
HEALTHY=0
for i in $(seq 1 15); do
sleep 1
if curl -sf http://localhost:3000/api > /dev/null 2>&1; then
echo "[deploy] App healthy after ${i}s"
HEALTHY=1
break
fi
if ! kill -0 $DIRECT_PID 2>/dev/null; then
echo "[deploy] App crashed — log:"
tail -30 /tmp/zhixi-direct.log
break
fi
done
kill $DIRECT_PID 2>/dev/null
wait $DIRECT_PID 2>/dev/null || true
if [ "$HEALTHY" = "1" ]; then
echo "[deploy] App verified OK, restarting via systemd..."
sudo systemctl reset-failed zhixi-api 2>/dev/null || true
sudo systemctl restart zhixi-api || true
sudo systemctl restart zhixi-api
sleep 3
curl -sf http://localhost:3000/api > /dev/null && echo "[deploy] systemd health OK" || echo "[deploy] systemd restart pending (app verified working)"
if curl -sf http://localhost:3000/api > /dev/null 2>&1; then
echo "[deploy] API health OK"
else
echo "[deploy] App failed to start"
echo "[deploy] Health check failed — checking logs:"
sudo journalctl -u zhixi-api --no-pager -n 20
exit 1
fi