Sha256: b66ea808b129db1992c6b78afcf881cf19b046a8ba3d7c986eabefd1e66c9ff3

Contents?: true

Size: 1.28 KB

Versions: 48

Compression:

Stored size: 1.28 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
        rsudo "service haproxy stop; service haproxy start"
      end
      rubber.serial_task self, :serial_reload, :roles => :haproxy do
        rsudo "if ! ps ax | grep -v grep | grep -c haproxy &> /dev/null; then service haproxy start; else service 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 do
      rsudo "service haproxy stop || true"
    end
    
    desc "Starts the haproxy server"
    task :start, :roles => :haproxy do
      rsudo "service haproxy status || service 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

48 entries across 48 versions & 1 rubygems

Version Path
rubber-3.2.2 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-3.2.1 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-3.2.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-3.1.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-3.0.1 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-3.0.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.16.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.15.2 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.15.1 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.15.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.14.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.13.1 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.13.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.12.2 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.12.1 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.12.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.11.0 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.10.2 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.10.1 templates/haproxy/config/rubber/deploy-haproxy.rb
rubber-2.10.0 templates/haproxy/config/rubber/deploy-haproxy.rb