Sha256: 0c5f5bf29db7d5747c5b8e1658aa8d6ce85d3d863bc579dcffa1f7998c2c07d6

Contents?: true

Size: 1.27 KB

Versions: 3

Compression:

Stored size: 1.27 KB

Contents

namespace :rubber do

  namespace :haproxy do
  
    rubber.allow_optional_tasks(self)
  
    # serial_task can only be called after roles defined - not normally a problem, but
    # rubber auto-roles don't get defined till after all tasks are defined
    on :load do
      rubber.serial_task self, :serial_restart, :roles => :haproxy do
        sudo "/etc/init.d/haproxy restart"
      end
      rubber.serial_task self, :serial_reload, :roles => :haproxy do
        sudo "sh -c 'if ! ps ax | grep -v grep | grep -c haproxy &> /dev/null; then /etc/init.d/haproxy start; else /etc/init.d/haproxy reload; fi'"
      end
    end
    
    before "deploy:stop", "rubber:haproxy:stop"
    after "deploy:start", "rubber:haproxy:start"
    after "deploy:restart", "rubber:haproxy:reload"
    
    desc "Stops the haproxy server"
    task :stop, :roles => :haproxy, :on_error => :continue do
      sudo "/etc/init.d/haproxy stop"
    end
    
    desc "Starts the haproxy server"
    task :start, :roles => :haproxy do
      sudo "/etc/init.d/haproxy start"
    end
    
    desc "Restarts the haproxy server"
    task :restart, :roles => :haproxy do
      serial_restart
    end
  
    desc "Reloads the haproxy web server"
    task :reload, :roles => :haproxy do
      serial_reload
    end
  
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubber-1.3.2 generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-1.3.1 generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-1.3.0 generators/vulcanize/templates/haproxy/config/rubber/deploy-haproxy.rb