Sha256: c1757bb8aec88f263aaa3ad02ac49960dd17942d51d9e0cc0b422c29caa383f4

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

Standup.script :node do
  self.default_params = {
      :version => '3.0.9'
  }

  def run
    scripts.ec2.open_port 80, 443

    if install_gem('passenger', params.version) || !file_exists?('/opt/nginx/sbin/nginx')
      install_package 'libcurl4-openssl-dev libpcrecpp0'
      sudo 'passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx'
    end

    sudo 'mkdir -p /opt/nginx/conf/servers'

    with_processed_file script_file('nginx.conf.erb') do |file|
      upload file,
             :to =>'/opt/nginx/conf/nginx.conf',
             :sudo => true
    end

    upload script_file('nginx'),
           :to =>'/etc/init.d/nginx',
           :sudo => true

    sudo 'chmod +x /etc/init.d/nginx'
    sudo '/usr/sbin/update-rc.d -f nginx defaults'

    scripts.monit.add_watch script_file('nginx_monit.conf')

    restart_nginx
  end
  
  def add_server_conf file, name = File.basename(file), restart = true
    upload file,
           :to   => "/opt/nginx/conf/servers/#{name}",
           :sudo => true

    restart_nginx if restart
  end
  
  def restart_nginx
    scripts.monit.restart_watch 'nginx'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
standup-0.6.9 scripts/passenger.rb
standup-0.6.8 scripts/passenger.rb
standup-0.6.7 scripts/passenger.rb
standup-0.6.6 scripts/passenger.rb
standup-0.6.5 scripts/passenger.rb
standup-0.6.4 scripts/passenger.rb