Loading...
Loading...
Production deployment principles and decision-making. Safe deployment workflows, rollback strategies, and verification. Teaches thinking, not scripts.
npx skill4agent add quantumsolver/e-health-kit deployment-proceduresDeployment principles and decision-making for safe production releases. Learn to THINK, not memorize scripts.
What are you deploying?
│
├── Static site / JAMstack
│ └── Vercel, Netlify, Cloudflare Pages
│
├── Simple web app
│ ├── Managed → Railway, Render, Fly.io
│ └── Control → VPS + PM2/Docker
│
├── Microservices
│ └── Container orchestration
│
└── Serverless
└── Edge functions, Lambda| Platform | Deployment Method |
|---|---|
| Vercel/Netlify | Git push, auto-deploy |
| Railway/Render | Git push or CLI |
| VPS + PM2 | SSH + manual steps |
| Docker | Image push + orchestration |
| Kubernetes | kubectl apply |
| Category | What to Check |
|---|---|
| Code Quality | Tests passing, linting clean, reviewed |
| Build | Production build works, no warnings |
| Environment | Env vars set, secrets current |
| Safety | Backup done, rollback plan ready |
1. PREPARE
└── Verify code, build, env vars
2. BACKUP
└── Save current state before changing
3. DEPLOY
└── Execute with monitoring open
4. VERIFY
└── Health check, logs, key flows
5. CONFIRM or ROLLBACK
└── All good? Confirm. Issues? Rollback.| Phase | Principle |
|---|---|
| Prepare | Never deploy untested code |
| Backup | Can't rollback without backup |
| Deploy | Watch it happen, don't walk away |
| Verify | Trust but verify |
| Confirm | Have rollback trigger ready |
| Check | Why |
|---|---|
| Health endpoint | Service is running |
| Error logs | No new errors |
| Key user flows | Critical features work |
| Performance | Response times acceptable |
| Symptom | Action |
|---|---|
| Service down | Rollback immediately |
| Critical errors | Rollback |
| Performance >50% degraded | Consider rollback |
| Minor issues | Fix forward if quick |
| Platform | Rollback Method |
|---|---|
| Vercel/Netlify | Redeploy previous commit |
| Railway/Render | Rollback in dashboard |
| VPS + PM2 | Restore backup, restart |
| Docker | Previous image tag |
| K8s | kubectl rollout undo |
| Strategy | How It Works |
|---|---|
| Rolling | Replace instances one by one |
| Blue-Green | Switch traffic between environments |
| Canary | Gradual traffic shift |
| Scenario | Strategy |
|---|---|
| Standard release | Rolling |
| High-risk change | Blue-green (easy rollback) |
| Need validation | Canary (test with real traffic) |
| Check | Common Issues |
|---|---|
| Logs | Errors, exceptions |
| Resources | Disk full, memory |
| Network | DNS, firewall |
| Dependencies | Database, APIs |
| ❌ Don't | ✅ Do |
|---|---|
| Deploy on Friday | Deploy early in week |
| Rush deployment | Follow the process |
| Skip staging | Always test first |
| Deploy without backup | Backup before deploy |
| Walk away after deploy | Monitor for 15+ min |
| Multiple changes at once | One change at a time |
| Scenario | Recommendation |
|---|---|
| Development | |
| Single-server production | Bench + Supervisor + Nginx |
| Containerised | Official frappe_docker (Docker Compose) |
| Multi-tenant | DNS multitenant with Nginx routing |
| Cloud managed | Frappe Cloud (managed hosting) |
# 1. Setup production config (creates Supervisor + Nginx configs)
sudo bench setup production <linux_user>
# 2. Generate and enable Nginx config
bench setup nginx
sudo ln -s /etc/nginx/conf.d/frappe-bench.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo service nginx reload
# 3. Enable scheduler
bench enable-scheduler
# 4. Restart everything
sudo supervisorctl restart all# 1. Backup before deploy
bench --site mysite.localhost backup --with-files
# 2. Pull latest code
bench update --pull --reset
# 3. Or for specific app only
cd apps/my_ehealth && git pull origin main && cd ../..
# 4. Run migrations
bench --site mysite.localhost migrate
# 5. Build assets
bench build --app my_ehealth
# 6. Clear cache
bench --site mysite.localhost clear-cache
# 7. Restart
sudo supervisorctl restart all# Clone official Docker setup
git clone https://github.com/frappe/frappe_docker.git
cd frappe_docker
# Production with custom app
export CUSTOM_APP_REPO=https://github.com/org/my_ehealth.git
docker compose -f compose.yaml up -dbench --site mysite.localhost run-tests --app my_ehealthbench buildbench backup --with-fileshooks.py| Check | Command / Action |
|---|---|
| Site loads | |
| Scheduler running | |
| Workers alive | |
| No migration errors | Check |
| Error log clean | Frappe Desk → Error Log |
| Background jobs | Frappe Desk → Background Jobs |
# 1. Restore code
cd apps/my_ehealth && git checkout <previous_tag> && cd ../..
# 2. Restore database
bench --site mysite.localhost restore /path/to/backup.sql.gz
# 3. Migrate and rebuild
bench --site mysite.localhost migrate
bench build
sudo supervisorctl restart allbench config dns_multitenant on
bench new-site tenant2.example.com
bench --site tenant2.example.com install-app my_ehealth
bench setup nginx
sudo service nginx reloadsession_expirydeny_multiple_sessionsRemember: Every deployment is a risk. Minimize risk through preparation, not speed.