Sha256: ee01013c6cdb6ee0e404bcdb8cf4ce67660d79e3e00680c5a8207992b27be0ea

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

# Nginx recipes
namespace :nginx do
  
  # Callbacks
  after "nginx:setup", "nginx:restart"
    
  desc "Install nginx, conf, initscript, nginx user and service"
  task :install do
    # Dependencies: "pcre-devel", "openssl", "openssl-devel"

    put(load_template("nginx/nginx.initd.erb", binding), "/tmp/nginx.initd")
    put(load_template("nginx/nginx.conf.erb", binding), "/tmp/nginx.conf")
    
    script_install("nginx/install.sh.erb")          
  end
  
  desc "Install nginx monit hooks"
  task :install_monit do
    put load_template("nginx/nginx.monitrc.erb", binding), "/tmp/nginx.monitrc"
    script_install("nginx/install_monit.sh")
  end
  
  
  desc "Create and update the nginx vhost include"
  task :setup do 
    
    ports = (0...mongrel_size).collect { |i| mongrel_port + i }
    public_path = current_path + "/public"
    
    run "mkdir -p #{shared_path}/config"
    put load_template("nginx/nginx_vhost.conf.erb", binding), "/tmp/nginx_#{application}.conf"    
    
    sudo "install -o root /tmp/nginx_#{application}.conf /etc/nginx/vhosts/#{application}.conf"        
  end
    
  # Restart nginx
  task :restart do
    # TODO: Monit
    sudo "/sbin/service nginx restart"
  end
    
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
capigen-0.1.1 recipes/nginx.rb
capigen-0.1.2 lib/recipes/nginx.rb
capigen-0.1.3 lib/recipes/nginx.rb