Created
February 9, 2009 16:28
-
-
Save imbriaco/60855 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Do rolling restarts of the Mongrel servers in pairs, at 90s intervals." | |
task :rolling do | |
servers = [] | |
roles[:app].each do |server| | |
next unless server.options.fetch(:listener, true) | |
servers << [] if servers.first.nil? || servers.last.length > 1 | |
servers.last << server.host | |
end | |
servers.each_with_index do |hosts, index| | |
restart_hosts = hosts.join(',') | |
puts "Restarting hosts on #{restart_hosts}" | |
ENV['HOSTS'] = restart_hosts | |
deploy.restart | |
if index + 1 < servers.length | |
puts 'Pausing 30 seconds for servers to cool down.' | |
sleep 30 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment