Aller au contenu principal

EMTB Production Deployment Checklist

Project: EMTB Consulting Platform Environment: Production (Dokploy) Last Updated: 2025-11-23


Pre-Deployment Checklist​

✅ Code Quality​

  • All tests passing locally (pnpm run test)
  • TypeScript compilation successful (pnpm run type:check)
  • Build successful locally (pnpm run build)
  • No ESLint errors
  • Code reviewed (if applicable)

✅ Git​

  • All changes committed
  • Meaningful commit message
  • Pushed to main branch
  • No uncommitted files

✅ Environment Variables​

  • All required env vars set in Dokploy
  • Database credentials verified
  • JWT secrets configured
  • API URLs correct
  • Email service (Brevo) configured

✅ Database​

  • Migrations reviewed
  • Backup created (if needed)
  • No destructive migrations without confirmation

Deployment Process​

Step 1: Trigger Deployment​

  • Navigate to Dokploy dashboard
  • Select API or Frontend application
  • Click "Deploy" or wait for auto-deploy

Step 2: Monitor Deployment​

  • Watch build logs in Dokploy
  • Check for build errors
  • Monitor health checks
  • Watch for container status: healthy

Step 3: Verify Health Checks​

  • API health check passing: /health
  • Frontend health check passing: /health
  • Container status shows "healthy"
  • No restart loops

Step 4: Test Application​

  • Open https://app.emtb.consulting
  • Test login functionality
  • Test main features
  • Check browser console for errors
  • Test on mobile (responsive)

Post-Deployment Verification​

✅ Functional Testing​

  • Authentication: Sign in/out works
  • Dashboard: Loads correctly
  • Clients: List, view, create, edit
  • Sites: List, view, create, edit
  • Reclamations: List, view, create, edit
  • Users (Admin): List, create, edit
  • Password Reset: Forgot password flow

✅ Performance​

  • Page load times acceptable (<3s)
  • API responses fast (<500ms)
  • No console errors
  • No memory leaks (check container stats)

✅ Security​

  • HTTPS working correctly
  • No mixed content warnings
  • CORS configured properly
  • Authentication required for protected routes

Zero Downtime Deployment Verification​

During Deployment​

  • Open app in browser
  • Continuously refresh during deployment
  • Expected: No 502 Bad Gateway errors
  • Expected: Continuous availability
  • Expected: Smooth transition

Health Check Status​

  • New containers start alongside old ones
  • Health checks run successfully
  • Traffic switches after health verification
  • Old containers stop gracefully

Rollback Procedure​

If Deployment Fails​

Option 1: Automatic Rollback​

  • Dokploy automatically rolls back if health checks fail
  • Monitor logs to see rollback in progress

Option 2: Manual Rollback​

  1. Go to Dokploy dashboard
  2. Navigate to application
  3. Click "Rollbacks" tab
  4. Select previous working version
  5. Click "Rollback to this version"
  6. Monitor deployment

Option 3: Git Revert​

# Find commit to revert
git log --oneline -5

# Revert specific commit
git revert <commit-hash>

# Push to trigger new deployment
git push

Common Issues & Solutions​

Issue: 502 Bad Gateway After Deployment​

Cause: Zero downtime not configured

Solution:

  1. See dokploy-zero-downtime-setup.md
  2. Configure Swarm health checks
  3. Enable start-first order

Issue: Container Keeps Restarting​

Possible Causes:

  • Health check failing
  • Application crash on startup
  • Missing environment variables
  • Database connection issues

Investigation Steps:

  1. Check container logs in Dokploy
  2. Look for error messages
  3. Verify environment variables
  4. Check database connectivity
  5. Review recent code changes

Issue: Build Fails​

Possible Causes:

  • TypeScript errors
  • Missing dependencies
  • Build configuration issues
  • Out of memory during build

Investigation Steps:

  1. Check build logs in Dokploy
  2. Run build locally: pnpm run build
  3. Check for TypeScript errors
  4. Verify dependencies installed
  5. Check for memory issues on server

Issue: Health Check Failing​

Possible Causes:

  • /health endpoint not responding
  • Port mismatch
  • Container not fully started
  • Application error

Investigation Steps:

# Test health endpoint from inside container
docker exec -it emtb-api wget --spider http://localhost:3001/health
docker exec -it emtb-frontend curl -f http://localhost/health

Solution:

  1. Check application logs
  2. Verify health endpoint implementation
  3. Increase StartPeriod if needed
  4. Check for application errors

Issue: Database Migration Fails​

Possible Causes:

  • Destructive migration
  • Constraint violations
  • Missing rollback strategy

Investigation Steps:

  1. Check migration logs
  2. Review migration SQL
  3. Check database state

Solution:

  1. Create database backup
  2. Test migration locally first
  3. Use safer migration strategies
  4. Add proper error handling

Performance Monitoring​

Metrics to Monitor​

  • Container CPU usage (<70%)
  • Container memory usage (<80%)
  • Response times (<500ms)
  • Error rates (<1%)
  • Health check success rate (100%)

Dokploy Monitoring​

  1. Go to application in Dokploy
  2. Check "Metrics" or "Stats" tab
  3. Monitor resource usage
  4. Watch for anomalies

Deployment Schedule​

  • Best: Off-peak hours (weekends, evenings)
  • Avoid: Business hours (9 AM - 5 PM)
  • Plan: Major releases during maintenance windows

Deployment Frequency​

  • Hotfixes: As needed
  • Features: Weekly or bi-weekly
  • Major releases: Monthly

Emergency Contacts​

Technical Support​

Team Contacts​

  • DevOps: [Your contact]
  • Backend Lead: [Your contact]
  • Frontend Lead: [Your contact]

Deployment Log Template​

## Deployment: YYYY-MM-DD HH:MM

**Deployed By:** [Name]
**Commit:** [commit hash]
**Changes:** [Brief description]

### Pre-Deployment
- [ ] Tests passed
- [ ] Build successful
- [ ] Environment verified

### Deployment
- [ ] Triggered at: [time]
- [ ] Completed at: [time]
- [ ] Duration: [minutes]

### Verification
- [ ] Application accessible
- [ ] Features tested
- [ ] No errors

### Issues
- [Any issues encountered]

### Rollback (if needed)
- [Rollback steps taken]

### Notes
- [Additional notes]

Quick Command Reference​

Build & Test Locally​

# Install dependencies
pnpm install

# Run tests
pnpm run test

# Type check
pnpm run type:check

# Build
pnpm run build

# Build specific app
pnpm run build --filter=api
pnpm run build --filter=frontend

Git Commands​

# Check status
git status

# Commit changes
git add .
git commit -m "feat: description"

# Push to remote
git push

# View recent commits
git log --oneline -10

Docker Commands (on server)​

# View running containers
docker ps

# View logs
docker logs emtb-api
docker logs emtb-frontend

# Execute command in container
docker exec -it emtb-api sh

# Check health
docker inspect emtb-api | grep Health

End of Checklist