Broken deploy rollback
This runbook is for administrators and developers when errors start right after a deployment or an update. The cause is almost always in that change. Plan background: Rollback planning.
Contents
- Confirm
- Quick checks before rolling back
- Roll back code and settings
- When the database changed
- After the rollback
- Related pages
Confirm
./console exp:logs --tail=var/log/error.log --lines=50
./console exp:audit search --channel=system --from='<time of the deploy>' --allow-root-userErrors that began at the deploy time point to it. The audit system channel lists the deploy, settings writes and
cache clears of that window.
Quick checks before rolling back
Many "broken deploys" are an incomplete deploy, fixed in a minute:
| Symptom | Fix |
|---|---|
Class ... not found | php bin/php/ezpgenerateautoloads.php -e, then clear caches |
| Old behavior still visible | PHP-FPM or Velocity still run the old code: ./console exp:velocity deploy --allow-root-user (reloads the right PHP-FPM and restarts Velocity in order) |
| Pages look old after a template change | ./console exp:cache clear --id=template --allow-root-user and ./console exp:velocity cache clear --apply --allow-root-user |
| A new setting has no effect | php bin/php/ezcache.php --clear-tag=ini --allow-root-user, then reload |
Roll back code and settings
Maintenance mode if visitors are affected:
php bin/php/maintenance.php on --message="This service is temporarily unavailable." --allow-admin --allow-root-user.Deploy the previous commit (or previous release directory) with its
composer.lockand settings.Regenerate and clear in the right order, the caches holding finished pages last:
php bin/php/ezpgenerateautoloads.php -e ./console exp:velocity deploy --dry-run --allow-root-user ./console exp:velocity deploy --allow-root-userWithout Velocity: clear caches, reload the PHP-FPM that serves the site, then clear the content cache.
Check from an allowed address, then switch maintenance off.
When the database changed
If the deploy ran a database update or a migration script, the previous code may not work with the new schema. Restore the backup taken just before the change (database and files), as the upgrading guide says for a failed SQL file; never repair by hand and re-run (Upgrading). Content edited since the backup is lost: tell editors what to redo.
After the rollback
- Clear the content and response caches after PHP and Velocity run the restored code.
- Record: what broke, when, rollback done, user impact. The change board needs it before the change is retried.
- Reproduce the failure on staging before the next attempt (Staging and approval).
Related pages
- Deploy a PHP change
- Site down
- Deploying changes (hosting)
- Deploying guide, section 7
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.