---
name: sr-deploy
description: Deploy Situation Room to vps-main. Syncs app.py, index.html, .env to /opt/dashboard/ and restarts the PM2 process.
disable-model-invocation: true
argument-hint: "[--skip-verify]"
---

# Situation Room Deploy

Deploy the Situation Room dashboard to vps-main (46.202.140.7).

## Files to Sync

```
situation-room/app.py           → /opt/dashboard/app.py
situation-room/llm_router.py    → /opt/dashboard/llm_router.py
situation-room/brand_system.py  → /opt/dashboard/brand_system.py
situation-room/market_monitor.py → /opt/dashboard/market_monitor.py
situation-room/static/           → /opt/dashboard/static/ (full directory: index.html + js/ modules)
situation-room/.env             → /opt/dashboard/.env
```

## Procedure

1. **Pre-check**: Verify local app.py has no syntax errors:
   ```
   python3 -c "import py_compile; py_compile.compile('situation-room/app.py', doraise=True)"
   ```

2. **Backup** current VPS version:
   ```
   ssh vps-main 'cp /opt/dashboard/app.py /opt/dashboard/app.py.bak'
   ```

3. **Sync files** to vps-main:
   ```
   rsync -avz situation-room/app.py situation-room/llm_router.py situation-room/brand_system.py situation-room/market_monitor.py situation-room/.env vps-main:/opt/dashboard/
   rsync -avz situation-room/static/ vps-main:/opt/dashboard/static/
   ```

4. **Restart** the dashboard process:
   ```
   ssh vps-main 'pm2 restart dashboard --update-env 2>/dev/null || cd /opt/dashboard && pm2 start python3 --name dashboard -- -m uvicorn app:app --host 0.0.0.0 --port 8000'
   ssh vps-main 'pm2 save --force'
   ```

5. **Verify** (unless --skip-verify):
   ```
   curl -sf https://tompickup.one/api/health/ping
   ```
   Expected: `{"status": "ok", "version": "5.x.x", ...}`

6. **Report**: Version deployed, uptime, any errors from `pm2 logs dashboard --lines 5`.

## Rollback

If deploy fails:
```
ssh vps-main 'cp /opt/dashboard/app.py.bak /opt/dashboard/app.py && pm2 restart dashboard --update-env && pm2 save'
```
