Sha256: 719e6271ce6f812fc38d8c7f055123d8a6e164d545fc33f1920e4ef76d1839a1

Contents?: true

Size: 960 Bytes

Versions: 21

Compression:

Stored size: 960 Bytes

Contents

Capistrano::Configuration.instance(:must_exist).load do
  define_recipe :rolling_restart do
    
    # Define the rolling_restart task for mongrel
    namespace :mongrel do
      desc <<-DESC
      Do a rolling restart of mongrels, one app server at a time.
      DESC
      task :rolling_restart do
        find_servers(:roles => :app).each do |server|
          ENV['HOSTS'] = "#{server.host}:#{server.port}"
          nginx.stop
          puts "Waiting 10 seconds for mongrels to finish processing on #{ENV['HOSTS']}."
          sleep 10
          mongrel.restart
          puts "Waiting 30 seconds for mongrels to come back up on #{ENV['HOSTS']}."
          sleep 30
          nginx.start
        end
      end
    end
    
    # Use a rolling restart by default.  Theoretically, if we're doing migrations we should be using deploy:long anyway
    namespace :deploy do
      task :restart do
        mongrel.rolling_restart
      end
    end
    
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
factorylabs-fdlcap-0.3.17 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.18 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.19 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.20 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.21 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.23 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.24 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.25 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.26 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.27 lib/fdlcap/recipes/rolling_restart.rb
factorylabs-fdlcap-0.3.28 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.4.3 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.4.2 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.4.0 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.3.35 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.3.34 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.3.33 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.3.31 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.3.30 lib/fdlcap/recipes/rolling_restart.rb
fdlcap-0.3.29 lib/fdlcap/recipes/rolling_restart.rb