

How to roll back a Dokku deployment
source link: https://dev.to/alejandroakbal/how-to-roll-back-a-dokku-deployment-5825
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Introduction
Sometimes you end up deploying an application to Dokku and then realize that you want to revert the changes you made.
In this tutorial we'll go over how to roll back a Dokku deployment.
Before we start
Preface
Keep in mind that rolling back a deployment is a dangerous operation, proceed with caution.
Requirements
- Dokku server
Don't have a Dokku server?
Check out my Dokku tutorial.
Get the commit hash
First well need to get the hash of the commit that we want to roll back to.
To accomplish that, list out the last 10 commits that have been made to the repository.
git log --pretty=format:"%h - %s" -10
You will get an output similar to this:
3cacb03 - Revert "build: broaden possible purged files"
25e3b2b - chore: move node dependency to dev dependencies
6a42416 - Revert "ci: run npm "build" script in predeploy stage"
0b53fdd - ci: execute php buildpack first
2d27d60 - ci: run npm "build" script in predeploy stage
1bc1276 - build: broaden possible purged files
1bed300 - style: lint
5ab255c - Revert "build: only run tailwind JIT mode on local"
23b0c4b - build: fix data-tables styles getting purged
52ca32e - ci: move scripts back to app.json
Now copy the hash of the commit that you want to roll back to.
For example 2d27d60
.
How to rollback
Now that we have the commit hash, we can roll back to it.
Just force push to Dokku with the commit hash, instead of the local branch.
# git push --force <remote> <local branch>:<remote branch>
git push --force dokku de7fc85:master
That is it!
Now Dokku will build the application from that commit.
Effectively rolling back to that commit.
That was easy, wasn't it?
Self-promotion
If you have found this useful, then you should follow me, I will be posting more interesting content! 🥰
Or support me financially. 💸
Conclusion
Congratulations, today you have learned how to roll back a Dokku deployment.
Let me know if the tutorial was useful to you in the comments!
Recommend
-
36
-
19
Luminus provides a great way to get up and running with a Clojure web application. However, building your app is only half the work. Once you've got your app working, the next step is to host it somewhere so that the user...
-
7
Optimize Dokku Deployment Speed for Ruby on Rails with Dockerfile Updated Jun 28, 2019Â 12 comments 6 minute read
-
5
Hosting Static Site on Dokku with Free Cloudflare CDN and SSL Updated May 21, 2018Â 4 comments 5 minute read ...
-
8
How to Migrate a Ruby on Rails App from Heroku to Dokku Updated May 18, 2020Â 14 comments 8 minute read ...
-
5
An easy way to deploy web appsDokku - An easy way to deploy web apps 21 Feb 2016 TL;DR Use easy-to-setup Dokku and push your code via git to have it deployed in a docker...
-
14
Haproxy, Nginx and Dokku Posted on: January 04, 2021 342 Words Takes 2 minutes to read I just finished setting up a wordpress site for...
-
9
Deploying an app with Dokku has_many :codes Tips and walkthroughs on web technologies and digital life I've been using Kubernetes for a few years now for deployments also for my pers...
-
8
Buy VPS Search VPS or VDS in google https://www.google.com/search?q=vps+vds+server I choice this https://zt...
-
5
<?xml encoding="utf-8" ??>Introduction Dokku is a popular container manager that runs multiple Heroku buildpacks or Docker containers in a single instance. This...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK