JB/DEPLOYMENT_RUNBOOK.md

48 lines
1.2 KiB
Markdown

# JobsBoard — Production Deployment Runbook
## Deployment Prerequisites
- Node.js 18+ (20+ LTS recommended)
- PostgreSQL 16+ running with `DATABASE_URL` configured
- Redis 7+ running with `REDIS_URL` configured
- Optional: AWS S3 or compatible object storage (`S3_BUCKET`, `S3_REGION`, `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`)
---
## Zero-Downtime Deployment Sequence
### Step 1: Pre-Flight Verification
```bash
cd web
npm test # Run 63-test regression suite
npm run test:postgres # Run dual-schema PostgreSQL integration suite
```
### Step 2: Database Schema Migration
Ensure non-destructive schema migration using Prisma:
```bash
npx prisma migrate deploy --schema=prisma/schema.postgresql.prisma
```
### Step 3: Build Production Artifacts
```bash
npm run build
```
Verify that all static and dynamic pages compile cleanly (59+ routes).
### Step 4: Graceful Service Restart
If running via systemd or process manager (e.g. PM2):
```bash
pm2 reload jobsboard-web --update-env
```
Or container rolling deployment:
```bash
podman stop jobsboard-web && podman start jobsboard-web
```
### Step 5: Post-Deployment Smoke Check
```bash
curl -s http://localhost:3000/api/health | jq .
```
Verify:
- `database.status` == "healthy"
- `uptimeSeconds` > 0