Browse Source

Puppet: nginx usando modulo jfryman-nginx original

(nao o fork do interlegis)
producao
Marcio Mazza 10 years ago
parent
commit
be859820e9
  1. 9
      Vagrantfile
  2. 5
      puppet/bootstrap.sh
  3. 54
      puppet/manifests/site.pp

9
Vagrantfile

@ -11,9 +11,12 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provision :shell, :path => "puppet/bootstrap.sh" config.vm.provision :shell, :path => "puppet/bootstrap.sh"
config.vm.provision :shell, # XXX Usando provisoriamente o modulo oficial ate que sincronizemos nosso repo
:path => "puppet/puppet_module_install_from_github.sh", # XXX descomentar este trecho entao
:args => "jfryman-nginx interlegis/puppet-nginx"
# config.vm.provision :shell,
# :path => "puppet/puppet_module_install_from_github.sh",
# :args => "jfryman-nginx interlegis/puppet-nginx"
config.vm.provision :puppet do |puppet| config.vm.provision :puppet do |puppet|
puppet.manifests_path = "puppet/manifests" puppet.manifests_path = "puppet/manifests"

5
puppet/bootstrap.sh

@ -6,3 +6,8 @@ puppet_install () {
puppet_install puppetlabs-vcsrepo puppet_install puppetlabs-vcsrepo
puppet_install stankevich-python puppet_install stankevich-python
# XXX Usando provisoriamente o modulo oficial ate que sincronizemos nosso repo
# XXX retirar esta linha entao
puppet_install jfryman-nginx

54
puppet/manifests/site.pp

@ -125,31 +125,45 @@ exec { 'supervisor_update':
########################################################################### ###########################################################################
# NGINX # NGINX
package { 'nginx': } class { 'nginx': }
file { '/etc/nginx/sites-available/sigi.vhost': nginx::resource::upstream { 'sigi_app_server':
ensure => link, members => [ 'unix:/var/run/sigi/sigi.sock' ],
target => "${sigi_dir}/etc/nginx/sites-available/sigi.vhost", upstream_fail_timeout => 0
require => [
Vcsrepo[$sigi_dir],
Package['nginx'] ]
} }
file { '/etc/nginx/sites-enabled/sigi.vhost': # XXX trocar nome para server_name, p.ex. sigi01h.interlegis.leg.br
ensure => link, $sigi_vhost = 'localhost'
target => '/etc/nginx/sites-available/sigi.vhost',
require => Package['nginx'],
}
exec { 'nginx_restart': nginx::resource::vhost { $sigi_vhost:
command => 'service nginx restart', client_max_body_size => '4G',
refreshonly => true, access_log => '/var/log/sigi/sigi-access.log',
subscribe => [ error_log => '/var/log/sigi/sigi-error.log',
File['/etc/nginx/sites-enabled/sigi.vhost'], use_default_location => false,
Vcsrepo[$sigi_dir]], require => Vcsrepo[$sigi_dir],
# TODO tentar usar try_files ao inves desse "if"
# vide http://stackoverflow.com/questions/19845566/in-nginxs-configuration-could-if-f-request-filename-cause-a-performan
# XXX este raw_append foi uma apelacao devido a limitacoes do modulo nginx
raw_append => '
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://sigi_app_server;
break;
}
}
'
} }
file { '/etc/nginx/sites-enabled/default': nginx::resource::location { '/static/':
ensure => absent, vhost => $sigi_vhost,
location_alias => '/srv/sigi/static/',
} }
nginx::resource::location { '/media/':
vhost => $sigi_vhost,
location_alias => '/srv/sigi/media/',
}

Loading…
Cancel
Save