I tried using "cap rollback" but I get the following error:
$ cap rollback
the task `rollback' does not exist
Is there some additional setup that I need to do to get rollbacks to work?
When a deployment is run, Capistrano executes one task at a time on all servers and waits for that task to be done before moving on to the next one. If a task fails on a server, Capistrano exits without waiting for further tasks.
Capistrano provides basic rollback support, but as each application and system handles rollbacks differently, it is up to the individual to test and validate that rollback behaves correctly for their use case. For example, capistrano-rails will run special tasks on rollback to fix the assets, but does nothing special with database migrations.
However, even if you use techniques such as Rolling updates, there's still risk that your application doesn't work the way you expect it at the end of the deployment. Kubernetes and kubectl offer a simple mechanism to roll back changes to resources such as Deployments, StatefulSets and DaemonSets.
If a task fails on a server, Capistrano exits without waiting for further tasks. In a multiple server situation, when a task fails on one server by exiting with a non-0 exit code, Capistrano closes the SSH connections to any still in-progress servers and their tasks exit.
Just found the answer here http://github.com/leehambley/railsless-deploy:
cap deploy:rollback
If you're using different environments (e.g. staging, production) using the multistage gem (e.g. you have require 'capistrano/ext/multistage'
in your deploy.rb file) then Capistrano defaults to staging. So, to roll back a production environment you would do:
cap production deploy:rollback
and, assuming you've got the defaults set, this would roll back staging:
cap deploy:rollback
Worth knowing if you're using different environments and wondering why it's not working for production.
simple roll back:
$ cap deploy:rollback
rollback to specific version:
$ cap deploy:rollback -s previous_release= [path to previous release under releases folder ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With