readonly
readonly

Reputation: 355794

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?

Upvotes: 79

Views: 65280

Answers (4)

Rhythm Shahriar
Rhythm Shahriar

Reputation: 311

simple roll back:

$ cap deploy:rollback

rollback to specific version:

$ cap deploy:rollback -s previous_release= [path to previous release under releases folder ]

Upvotes: 15

Snowcrash
Snowcrash

Reputation: 86247

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.

Upvotes: 52

Martin
Martin

Reputation: 16300

Actually it is

cap deploy:rollback:code

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

Upvotes: 9

readonly
readonly

Reputation: 355794

Just found the answer here http://github.com/leehambley/railsless-deploy:

cap deploy:rollback

Upvotes: 156

Related Questions