views:

495

answers:

2

Hello,

I'm looking for an easy way to go back to the previous release if something goes wrong with the last realease in Capistrano

Is there any command like "cap goback" to undo the last deploy? (thus updating the current symlink to it's old location)

Is this built-in or I just have to make a task myself?

Here's my recipe:

set :user, "root"
set :use_sudo, false

set :domain, "www.domain.info"
set :deploy_to, "/home/beta2"
set :current_dir, "public_html"

set :scm, "git"
set :repository,  "[email protected]:user/ac.git"
set :deploy_via, :remote_cache
set :scm_verbose, true
set :git_enable_submodules, 1

role :web, domain
role :app, domain


task :link_shared_directories do     
  run "ln -s #{shared_path}/photos #{release_path}/photos"
end    

after "deploy:update_code", :link_shared_directories
A: 

Someone asked a similar question before and answered it himself, but it appears the link he posted is broken.

Anyway, there's a project on GitHub, called Railsless Deploy, which seems to include a task for rollback.

I confess I've just started out with Capistrano this weekend, so apologies if that's not what you're looking for.

Ionuț G. Stan
+1  A: 

If you are using the standard capistrano setup then take a look at these tasks:

cap deploy:rollback
cap deploy:rollback:code

If you have customized deployment tasks then you will have to roll your own.

Peer Allan
Thanks mate.. is there anyway I could see the task code of those tasks?
Guillermo
you would have to checkout the gem directly and browse the source. http://github.com/jamis/capistrano.git Then find the strategy file that matches the repository you are using. Good luck!
Peer Allan