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 provides a ready-to-use Ruby cloud solution that delivers numerous advantages, including:
- Deploy your application in just a few seconds with a simple
git push.- Use your own domain name and take advantage of automatic configuration of HTTPS certificates for enhanced security.
- Benefit from automatic backups, one-click updates, and clear, transparent, and predictable pricing.
- Enjoy optimal performance and enhanced security thanks to a private, dedicated VM.
Save time and make your life easier: 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.