How to have Capistrano NOT rollback if a task fails -
we're using capistrano/webistrano (with lee hambley's railsless-deploy gem) push our php application production servers. have custom tasks run during various parts of deploy process.
as example, have tasks attempt stop , restart jetty solr instance. however, bit fails during deploy, capistrano rolls entire deploy , reverts previous revision. pain. :-)
i'd tell capistrano ignore return result of these tasks, if fail, capistrano continues on it's way , finishes deploy anyway. it's easy me ssh server after fact , kill , restart solr instance, rather having complete deploy again.
here relevant parts of deploy script:
before "deploy:symlink", :solr_kill after "deploy:symlink", :solr_start, :solr_index task :solr_kill run "cd #{current_path}/base ; #{sudo} phing solr-kill" end task :solr_start run "cd #{current_path}/base ; #{sudo} phing solr-start" run "sleep 10" end task :solr_index run "#{sudo} #{current_path}/base/bin/app.php cron run solr_index_cron" end
from capistrano task docs there config can add if there error, continue.
task :solr_start, :on_error => :continue # code here end
just add each task want ignore errors , continue. though, best possible thing see if can figure out causing failure , have restart command more robust restart it. this, since when try hand off script else, might not know how tell if restarted correctly.
Comments
Post a Comment