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. 60
      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

60
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'] ] # XXX trocar nome para server_name, p.ex. sigi01h.interlegis.leg.br
} $sigi_vhost = 'localhost'
file { '/etc/nginx/sites-enabled/sigi.vhost': nginx::resource::vhost { $sigi_vhost:
ensure => link, client_max_body_size => '4G',
target => '/etc/nginx/sites-available/sigi.vhost', access_log => '/var/log/sigi/sigi-access.log',
require => Package['nginx'], error_log => '/var/log/sigi/sigi-error.log',
use_default_location => false,
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;
}
}
'
} }
exec { 'nginx_restart': nginx::resource::location { '/static/':
command => 'service nginx restart', vhost => $sigi_vhost,
refreshonly => true, location_alias => '/srv/sigi/static/',
subscribe => [
File['/etc/nginx/sites-enabled/sigi.vhost'],
Vcsrepo[$sigi_dir]],
} }
file { '/etc/nginx/sites-enabled/default': nginx::resource::location { '/media/':
ensure => absent, vhost => $sigi_vhost,
location_alias => '/srv/sigi/media/',
} }

Loading…
Cancel
Save