4

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,  "git@github.com: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
Guillermo
  • 927
  • 3
  • 10
  • 23

2 Answers2

3

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
  • 3,934
  • 2
  • 21
  • 17
  • Thanks mate.. is there anyway I could see the task code of those tasks? – Guillermo Jul 22 '09 at 13:10
  • 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 Jul 24 '09 at 12:54
  • If you want to see all the available Capistrano commands, type 'cap -T' – Eric Lubow Apr 19 '11 at 20:09
0

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.

Community
  • 1
  • 1
Ionuț G. Stan
  • 176,118
  • 18
  • 189
  • 202