How do you roll back to the previously deployed version with capistrano?

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?


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 ]

Actually it is

cap deploy:rollback:code

deploy:rollback may rollback to a previous revision, not necessarily a previously deployed revision.