---
created: 2026-03-12
tags: [sop, deployment, operations]
related: ["[[03-Projects/Growth Engine]]", "[[03-Projects/The $50 App]]", "[[08-Infrastructure/Infrastructure Map]]"]
---

# SOP: Deployment

## Growth Engine API (Railway)

Railway auto-deploys on push to `main`. No manual steps needed.

```bash
# From local or VPS:
git add .
git commit -m "description"
git push origin main
# Railway detects push → builds → deploys automatically
```

**Verify:**
```bash
curl https://rateright-growth-production.up.railway.app/health/ping
```

---

## RateRight App (The $50 App)

On VPS, managed as systemd service.

> [!warning] Always restart after building
> Next.js in production (`next start`) reads build manifests once at startup and caches them in memory. If you rebuild without restarting, the server serves HTML referencing new chunk hashes while its in-memory manifest still maps old hashes — causing CSS/JS asset 404s and 500s. **`npm run build` and `systemctl restart` must always run as a pair.** See [[04-Operations/Incidents/2026-03-13 Stale Build Manifest|2026-03-13 incident]] for details.

```bash
# SSH to VPS
ssh root@134.199.153.159

# Pull latest code
cd /home/ccuser/the-50-dollar-app
git pull

# Build AND restart (always together — never build without restarting)
npm run build && systemctl restart rateright-app

# Verify
curl http://localhost:3000/health
```

---

## Control Centre (cc.rateright.com.au)

```bash
# Build locally or on VPS
cd control-centre
npm install && npm run build

# On VPS — serve built files via nginx (port 3100)
systemctl restart cc-rateright  # (if service exists)
```

---

## Admin Dashboard (admin.rateright.com.au)

```bash
cd admin
npm install && npm run build
# Static files output to admin/dist/
# Served via nginx on VPS
```

---

## VPS Code Sync

```bash
# On VPS:
cd /home/ccuser/rateright-growth
git pull

# Restart relevant services if code changed
systemctl restart clawdbot-gateway  # if Rivet code changed
```

---

## Pre-Deploy Checklist

- [ ] Tests pass locally (`npm test`)
- [ ] No secrets in committed files
- [ ] **If you ran `npm run build` on any SSR app (Next.js, Nuxt, Remix) — restart its service immediately**
- [ ] Health check responds after deploy
- [ ] CSS/JS assets return 200 (not 404/500) after deploy
- [ ] Check Railway logs if API deploy fails
