Python: Rolling back to a previous version
This documentation is part of the Advanced usages guide. View the full guide here: Going further with your Python deployments.
👋 Welcome to the Stackhero documentation!
Stackhero offers a ready-to-use Python 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 Python cloud hosting solution!
If a recent deployment has introduced issues, you can revert to an earlier commit by deploying that commit. First, identify the commit hash by running:
git log
This command displays each commit's date, hash, and description.
For example, the output might look like this:
git log
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 current production deployment is the commit "Break the code" (hash starting with cccc), and you wish to revert to the previous commit "Update the code" (hash starting with bbbb), execute:
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 and production, the staging environment provides a near replica of the production setup. It helps you test your code thoroughly before a live deployment.
Utilizing staging increases your confidence in the functionality and performance of your code, resulting in a more robust production deployment.
This type of environment will be discussed later in the documentation.