Rollback & Recovery
How to rollback to a previous release
Quick Rollback
Roll back to the previous release:
frankendeploy rollback production
This instantly switches traffic to the previous version.
Rollback to Specific Release
List available releases:
frankendeploy app status production
Output:
Application: my-app
Server: production
Status: running
Release: 20240115-143052
Recent releases:
* 20240115-143052
20240115-120000
20240114-180000
20240114-150000
20240113-100000
Rollback to a specific release:
frankendeploy rollback production 20240114-180000
Automatic Rollback
FrankenDeploy automatically rolls back if:
- Health check fails - The new container doesn’t respond correctly
- Container won’t start - Docker fails to start the container
- Pre-deploy hooks fail - Migration or other commands fail
You’ll see:
⚠️ Health check failed, rolling back...
✅ Rolled back to release 20240115-120000
Managing Releases
Keep More Releases
deploy:
keep_releases: 10
Cleanup Old Releases
Old releases are automatically cleaned after each deployment. Only the configured number of releases are kept (see deploy.keep_releases in frankendeploy.yaml).
To manually clean releases, connect to your server via SSH:
ssh user@your-server
rm -rf /opt/frankendeploy/apps/my-app/releases/OLD_RELEASE
Troubleshooting Failed Deployments
Check Logs
frankendeploy logs production --tail 200
Check Container Status
frankendeploy app status production
Connect to Container
frankendeploy shell production
Check Health Endpoint
frankendeploy exec production curl -v http://localhost/health
Recovery Strategies
If Container Won’t Start
- Check logs:
frankendeploy logs production - Rollback:
frankendeploy rollback production - Fix the issue locally
- Deploy again
If Database Migration Fails
- FrankenDeploy auto-rolls back
- Check migration locally:
php bin/console doctrine:migrations:status - Fix migration
- Deploy again
If App Starts But Errors
- Check logs for errors
- Rollback if needed:
frankendeploy rollback production - Debug locally with same configuration
- Deploy fix
Best Practices
- Always have a health endpoint - Quick detection of issues
- Keep multiple releases - At least 5 for safe rollbacks
- Test locally first - Use
frankendeploy dev up - Use staging - Deploy to staging before production
- Monitor after deploy - Watch logs for a few minutes