Skip to main content

Deployment Playbook

Step-by-step guide for deploying changes to production.

Overview​

Safe, reliable deployment process for shipping changes.

Pre-Deployment Checklist​

  • All tests passing
  • Code reviewed and approved
  • No critical bugs
  • Database migrations ready
  • Environment variables configured
  • Rollback plan documented

Deployment Process​

1. Verify Staging​

Before deploying to production:

# Check staging is up to date
git log origin/main --oneline -5

# Verify staging environment
curl https://staging.example.com/health

Test critical flows:

  • User can sign up
  • User can log in
  • Core feature works
  • No errors in logs

2. Deploy to Production​

Vercel (automatic)

# Merge to main triggers deployment
git checkout main
git merge staging
git push

Manual deployment

# Build
npm run build

# Deploy
npm run deploy

3. Post-Deployment Verification​

Immediately after deploy:

  • Check health endpoint
  • Verify homepage loads
  • Test login flow
  • Check error monitoring
  • Monitor performance metrics
# Quick health check
curl https://production.example.com/health

# Check for errors
# (check your monitoring tool)

4. Monitor​

Watch for 15-30 minutes:

  • Error rates
  • Response times
  • User complaints

Rollback Plan​

If issues are detected:

Quick Rollback (Vercel)​

  1. Go to Vercel dashboard
  2. Find last working deployment
  3. Click "Promote to Production"

Manual Rollback​

# Find last good commit
git log --oneline -10

# Revert to that commit
git revert HEAD
git push

# Or force deploy previous version
git checkout [commit-hash]
git push -f origin main # Use with caution!

Database Migrations​

If deployment includes database changes:

  1. Backup first

    pg_dump production_db > backup_$(date +%Y%m%d).sql
  2. Run migrations

    npm run db:migrate
  3. Verify data integrity

    • Check record counts
    • Verify critical data exists
    • Test queries work

Troubleshooting​

Deployment Failed​

  1. Check build logs
  2. Verify environment variables
  3. Check for missing dependencies

Site Down After Deploy​

  1. Check error logs
  2. Verify database connection
  3. Rollback if needed
  4. Fix and redeploy

Performance Degradation​

  1. Check monitoring dashboards
  2. Look for N+1 queries
  3. Check for memory leaks
  4. Scale resources if needed