Sha256: df84170877ca6fa9324f45423dc8a119acb77f4b36bbd0f7b39e7c7cccb76c71

Contents?: true

Size: 1.81 KB

Versions: 20

Compression:

Stored size: 1.81 KB

Contents

namespace :rubber do

  namespace :passenger_nginx do
  
    rubber.allow_optional_tasks(self)
  
    before "rubber:install_packages", "rubber:passenger_nginx:setup_apt_sources"
    task :setup_apt_sources do
      rubber.sudo_script 'configure_passenger_nginx_repository', <<-ENDSCRIPT
        apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
        add-apt-repository -y https://oss-binaries.phusionpassenger.com/apt/passenger
      ENDSCRIPT
    end
  
    after "rubber:setup_app_permissions", "rubber:passenger_nginx:setup_passenger_permissions"

    task :setup_passenger_permissions, :roles => :passenger_nginx do
      rsudo "chown #{rubber_env.app_user}:#{rubber_env.app_user} #{current_path}/config/environment.rb"
    end
    
    on :load do
      rubber.serial_task self, :serial_restart, :roles => :passenger_nginx do
        rsudo "service nginx restart"
      end
      rubber.serial_task self, :serial_reload, :roles => :passenger_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:passenger_nginx:stop"
    after "deploy:start", "rubber:passenger_nginx:start"
    after "deploy:restart", "rubber:passenger_nginx:reload"
    
    desc "Stops the nginx web server"
    task :stop, :roles => :passenger_nginx do
      rsudo "service nginx stop; exit 0"
    end
    
    desc "Starts the nginx web server"
    task :start, :roles => :passenger_nginx do
      rsudo "service nginx status || service nginx start"
    end
    
    desc "Restarts the nginx web server"
    task :restart, :roles => :passenger_nginx do
      serial_restart
    end
  
    desc "Reloads the nginx web server"
    task :reload, :roles => :passenger_nginx do
      serial_reload
    end
    
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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