Ruby: Rolling back to a previous version
This documentation is part of the Advanced usages guide. You can view the complete guide here: Going further with your Ruby deployments.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Ruby cloud solution that provides a host of benefits, including:
- Deploy your application in seconds with a simple
git push.- Use your own domain name and benefit from the automatic configuration of HTTPS certificates for enhanced security.
- Enjoy peace of mind with automatic backups, one-click updates, and straightforward, transparent, and predictable pricing.
- Get optimal performance and robust security thanks to a private and dedicated VM.
Save time and simplify your life: it only takes 5 minutes to try Stackhero's Ruby cloud hosting solution!
If your production deployment is not working as expected, you can roll back by deploying an older commit. First, use the command below to view your commit history:
git log
This command displays the date, commit hash, and description for every commit in your repository. For example, you might see output like:
commit cccc8b3ebdccb9abc1926ef49ee589dae5c5fe06 (HEAD -> main, stackhero/main)
Author: Developer
Date: Fri Apr 28 09:36:18 +0000
Break the code
commit bbbb622301772072c3d82f3cc0d91e29e6e84901
Author: Developer
Date: Wed Apr 26 12:49:28 +0000
Update the code
commit aaaa1d8b06535b413e0df8298ccf52339dfef3ff
Author: Developer
Date: Wed Apr 26 12:44:50 +0000
Improve the code
If the commit with the message "Break the code" (hash cccc...) is running in production, and you decide to roll back to the previous commit "Update the code" (hash bbbb...), run:
git push -f stackhero bbbb622301772072c3d82f3cc0d91e29e6e84901:main
To prevent deploying broken code and increase the stability of your production, it is highly recommended to have a "staging" environment.
Situated between "development" environments and the "production" environment, the "staging" environment provides a near-exact replica of the production environment. This allows you to test your code and ensure its quality before deploying it to production.
By using a staging environment, you can be more confident in your code's functionality and performance, ensuring a more reliable and robust production deployment.
This type of environment will be discussed later in the documentation.