How can I rollback a deployment to a previous revision?
Rolling back your deployment
There can be situations where you need to revert your remote server to a previous state/revision. If you use Beanstalk's deployment tools this is really simple.
In the Deployments section, choose a Manual deployment. From there, select a previous revision from the dropdown, and deploy. Beanstalk will bring the files on your remote server to the state of that revision. Files will be added, edited and deleted as needed to get everything to this previous revision.
Rolling back in version control
It's important to note that rolling back the deployment will not revert the files in your repository. The next time you deploy, all the changes that you rolled back will be again uploaded to your remote server. So it is important that you revert or fix the offending changes in your repository as well.
Here's an example:
- You commit revision 10 and deploy it to the server.
- You commit revision 11, deploy it to the server and it breaks your site.
- You rollback the deployment to revision 10.
- You commit revision 12 that fixes the bug that broke the site, or you revert to revision 10 in version control.
- You deploy the most recent revision 12 to the server.
In this example all files on your server will be updated to revision 12, overwriting any broken code that revision 11 introduced. This will bring your repository and your server to the same state.