Sha256: 54f8a887438ca3793ba9191e5f7308ccacaf3d50fbc456ad82d9d2c4a3f30c1a

Contents?: true

Size: 1.69 KB

Versions: 26

Compression:

Stored size: 1.69 KB

Contents

namespace :rubber do

  namespace :nginx do
    
    rubber.allow_optional_tasks(self)
    
    before "rubber:install_packages", "rubber:nginx:install"
    
    task :install, :roles => :nginx do
      # Setup apt sources for current nginx
      sources = <<-SOURCES
        deb http://nginx.org/packages/ubuntu/ lucid nginx
        deb-src http://nginx.org/packages/ubuntu/ lucid nginx
      SOURCES
      sources.gsub!(/^ */, '')
      put(sources, "/etc/apt/sources.list.d/nginx.list")
      rsudo "wget -qO- http://nginx.org/keys/nginx_signing.key | apt-key add -"  
    end
    
    # 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 => :nginx do
        rsudo "service nginx restart"
      end
      rubber.serial_task self, :serial_reload, :roles => :nginx do
        rsudo "if ! ps ax | grep -v grep | grep -c nginx &> /dev/null; then service nginx start; else service nginx reload; fi"
      end
    end
    
    before "deploy:stop", "rubber:nginx:stop"
    after "deploy:start", "rubber:nginx:start"
    after "deploy:restart", "rubber:nginx:reload"
    
    desc "Stops the nginx web server"
    task :stop, :roles => :nginx do
      rsudo "service nginx stop; exit 0"
    end
    
    desc "Starts the nginx web server"
    task :start, :roles => :nginx do
      rsudo "service nginx start"
    end
    
    desc "Restarts the nginx web server"
    task :restart, :roles => :nginx do
      serial_restart
    end
  
    desc "Reloads the nginx web server"
    task :reload, :roles => :nginx do
      serial_reload
    end
  
  end

end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
rubber-2.2.2 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.2.1 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.2.0 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.1.2 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.1.1 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.1.0 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.8 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.7 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.6 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.5 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.4 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.3 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.2 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.1 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.0 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.0.pre12 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.0.pre11 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.0.pre10 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.0.pre9 templates/nginx/config/rubber/deploy-nginx.rb
rubber-2.0.0.pre8 templates/nginx/config/rubber/deploy-nginx.rb