get to prod tasks
This commit is contained in:
75
tasks/web-production/14-deployment-pipeline.md
Normal file
75
tasks/web-production/14-deployment-pipeline.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# 14. Automated Deployment Pipeline
|
||||
|
||||
meta:
|
||||
id: web-production-14
|
||||
feature: web-production
|
||||
priority: P1
|
||||
depends_on: [web-production-13, web-production-15, web-production-16]
|
||||
tags: [cicd, deployment, production]
|
||||
|
||||
objective:
|
||||
- Build automated deployment pipelines for staging and production environments with rollback capability
|
||||
|
||||
deliverables:
|
||||
- Staging deployment on merge to main
|
||||
- Production deployment with manual approval
|
||||
- Database migration automation
|
||||
- Rollback strategy
|
||||
|
||||
steps:
|
||||
1. Create .github/workflows/deploy-staging.yml:
|
||||
- Trigger on push to main
|
||||
- Build web application
|
||||
- Run database migrations (drizzle-kit push)
|
||||
- Deploy to staging environment (Vercel, Railway, or VPS)
|
||||
- Run smoke tests against staging
|
||||
2. Create .github/workflows/deploy-production.yml:
|
||||
- Trigger on release published or manual dispatch
|
||||
- Require manual approval from 1 team member
|
||||
- Build and tag Docker image
|
||||
- Run database migrations in dry-run first
|
||||
- Deploy to production with blue-green or rolling strategy
|
||||
- Run post-deploy smoke tests
|
||||
3. Implement database migration safety:
|
||||
- Migrations run before app deployment
|
||||
- Backward-compatible migrations only (add columns, don't drop)
|
||||
- Migration rollback script for each migration
|
||||
- Database backup before production migration
|
||||
4. Add deployment notifications:
|
||||
- Slack notification on deploy start, success, failure
|
||||
- Include commit SHA, author, and changelog
|
||||
5. Implement rollback:
|
||||
- One-click rollback to previous release
|
||||
- Database migration rollback (if safe)
|
||||
- CDN cache purge on rollback
|
||||
6. Add smoke tests:
|
||||
- Test homepage loads
|
||||
- Test login API responds
|
||||
- Test health endpoint
|
||||
- Test critical user journey with Playwright
|
||||
|
||||
tests:
|
||||
- Integration: Deploy to staging, verify app functional
|
||||
- Rollback: Trigger rollback, verify previous version restored
|
||||
- Migration: Test migration failure doesn't break deployment
|
||||
|
||||
acceptance_criteria:
|
||||
- Every merge to main auto-deploys to staging
|
||||
- Production deploy requires manual approval
|
||||
- Database migrations run automatically before app start
|
||||
- Rollback completes in <5 minutes
|
||||
- Smoke tests pass before marking deploy successful
|
||||
- Deployment notifications sent to Slack
|
||||
- Zero-downtime deployment for web app
|
||||
|
||||
validation:
|
||||
- Merge PR → staging deploys automatically within 5 minutes
|
||||
- Trigger production deploy → approval gate shown
|
||||
- Approve → production deploys, smoke tests pass
|
||||
- Introduce bug → rollback to previous version in <5 minutes
|
||||
|
||||
notes:
|
||||
- Vercel offers automatic preview deployments per PR
|
||||
- For VPS deployment, use Docker Compose with rolling restart
|
||||
- Consider using GitHub Environments for approval gates
|
||||
- Database migrations should be additive-only in production
|
||||
Reference in New Issue
Block a user