Rollbacks
Learn how to rollback your application in Dokploy.
Rollbacks are a powerful feature that allows you to easily revert changes to your application. This is particularly useful when you encounter issues or want to revert to a previous version of your application.
Requirements
- Have a
/health
endpoint in your application.
Steps to Rollback
Let's suppose we have a NodeJS application that has a health check route /api/health
that returns a 200 status code and running in the port 3000.
- In your application is necessary to have a
Path
orHealth Route
to be able to achieve zero downtime deployments eg. in the case of a NodeJS app you can have a route/api/health
that returns a 200 status code. - Go to
Advanced
Tab and go to Cluster Settings and enter toSwarm Settings
- There are a couple options that you can use, in this case we will focus on
Health Check
andUpdate Config
. - Paste this code in the health check field: Make sure the API Route exists in your application
- Now in the
Update Config
Now when the application is getting unhealthy response from the health check, the container will rollback to the previous version.
Paste the following code: