Sha256: 383462815441632a9a732020beb1ae29b1ba083bdcce6f89f8486c72afdf3c07

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

require "ms_deploy/render"

Capistrano::Configuration.instance.load do

  namespace :service do
    namespace :nginx do
      desc <<-DESC
        Starts the nginx web-server.
      DESC
      task :start do
        #run "sudo god start nginx"
        run "sudo /etc/init.d/nginx start"
      end

      desc <<-DESC
        #Stops the nginx web-server.
      DESC
      task :stop do
        #run "sudo god stop nginx"
        run "sudo /etc/init.d/nginx stop"
      end

      desc <<-DESC
        Restarts the nginx web-server.
      DESC
      task :restart do
        #run "sudo god restart nginx"
        run "sudo /etc/init.d/nginx restart"
      end

      task :install  do
        template_path = File.expand_path('../../templates/vhost.erb', __FILE__)
        vars = {'application'=> application, 'project_root' => deploy_to + '/current', 'domain' => vhost_domain, 'stage' => stage, 'auth_basic_title' => fetch(:auth_basic_title, nil), 'auth_basic_password_file' => fetch(:auth_basic_password_file, nil)}
        config_path = "#{shared_path}/config/#{application}_vhost.conf"

        put(render_erb_template(template_path, vars), config_path)
        sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
        sudo "ln -s #{config_path} /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
      end

      task :uninstall  do
        sudo "rm -f /etc/nginx/sites-enabled/#{application}_#{stage}.conf"
      end
    end
  end

  after :"deploy:setup", :"service:nginx:install";

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ms_deploy-0.1.2 lib/ms_deploy/recipes/nginx.rb
ms_deploy-0.1.1 lib/ms_deploy/recipes/nginx.rb
ms_deploy-0.0.11 lib/ms_deploy/recipes/nginx.rb
ms_deploy-0.0.10 lib/ms_deploy/recipes/nginx.rb