Deployment¶
Docker-based deployment with automated scripts. Supports standard, parallel, and incremental strategies.
Deployment Methods¶
Standard¶
Stops current container, starts new one. Causes brief downtime.
./fast-deploy.sh --migrate
Parallel (Reduced Downtime)¶
Starts new container alongside existing one, switches traffic when ready.
./fast-deploy.sh --parallel --migrate
Incremental (Faster)¶
Only updates what changed.
./fast-deploy.sh --incremental --migrate
# Skip resource copy (use cache):
./fast-deploy.sh --incremental --skip-resources --migrate
Database Handling¶
All deployments preserve the production database by default.
Run Migrations (preserve data)¶
./fast-deploy.sh --migrate
Backup¶
Automatic backup runs before every deployment.
# Manual backup:
./fast-deploy.sh --backup
# Restore from latest:
./fast-deploy.sh --restore
# Restore from specific file:
./fast-deploy.sh --restore /path/to/backup.sql
Reset Database¶
Danger
This deletes ALL production data. Requires explicit confirmation.
./fast-deploy.sh --reset-db
Health Checks & Rollback¶
After deployment, a health check verifies the app is running. Auto-rollback on failure.
./fast-deploy.sh --migrate # default: health check enabled
./fast-deploy.sh --migrate --skip-health-check # skip (not recommended)
./fast-deploy.sh --migrate --health-endpoint /api/healthcheck
CI/CD (GitHub Actions)¶
Workflow in .github/workflows/deploy.yml:
- Build & test on push to
main - Auto-deploy to staging after successful build
- Deploy to production on release or manual trigger
- Auto-backup before deployment
- Health check with auto-rollback
Manual Trigger¶
- GitHub → Actions → "Deploy NFC Connect"
- Click "Run workflow"
- Choose environment, method, options
Deployment Files¶
| File | Purpose |
|---|---|
deploy.py |
Main deployment script |
instance_up_with_resources.py |
Start/configure instances |
instance_down_with_resources.py |
Stop instances + resource backup |
fast-deploy.sh |
User-friendly shell wrapper |
Troubleshooting¶
SSH issues: Check DigitalOcean access token, droplet name in properties.yml, SSH access for root user.
Migration failures: Check migration script, verify schema matches expected state, check error logs, restore from backup if needed. Never use --reset-db to fix migration failures without backing up first.
Health check failures: Check health endpoint, verify app logs, ensure container is running, check HTTP/HTTPS accessibility.