Skip to content

Instantly share code, notes, and snippets.

@codeprimate
Created July 3, 2013 16:29
Show Gist options
  • Save codeprimate/5920154 to your computer and use it in GitHub Desktop.
Save codeprimate/5920154 to your computer and use it in GitHub Desktop.
Rolling deploy task for Capistrano.
#...
set :rolling_deploy_wait, 60
# Rolling restart of application servers
task :restart, :roles => [:app], :except => {:no_release => true}, :once => true do
servers = find_servers_for_task(current_task)
servers.each_with_index do |s, index|
run "sleep #{index * rolling_deploy_wait}; \
touch #{File.join(current_path,'tmp','restart.txt')}; \
nohup curl localhost > /dev/null 2>&1 &",
:hosts => s.host
end
end
#...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment