Rolling Back a Deployment Print

  • developersgitdeployment, developers, migration, caching, database, restore, woocommerce, errors, staging
  • 0

Undoing a change that broke something.

WITH GIT

Checking out the previous commit restores the previous code immediately. This is the main practical benefit of deploying with Git.

Know the previous commit reference before you deploy, so you are not searching for it under pressure.

WITH SYMLINK DEPLOYMENTS

Switch the symlink back to the previous release directory. Instantaneous, and the reason this deployment style is worth the setup.

WHAT ROLLBACK DOES NOT UNDO

Database migrations. If the deployment altered the schema, rolling back the code leaves it mismatched.

This is why migrations should be written to be reversible, or at least compatible with the previous code version.

Data written since the deployment also remains, which is usually what you want.

BEFORE ROLLING BACK

Take a note of the error, so you can diagnose it afterwards rather than losing the evidence.

AFTERWARDS

Clear caches, since a cached page or compiled template from the new version may persist.

Verify the site works rather than assuming.

PRACTISING

Roll back deliberately once on staging so the procedure is familiar.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot