From 8ffe23e2267f7e35cee0e8468e9a07d765552eab Mon Sep 17 00:00:00 2001 From: Paulo Tada Date: Thu, 14 Jan 2016 11:15:40 -0200 Subject: [PATCH] Adding nginx config file for prezento service --- cookbooks/mezuro/recipes/prezento.rb | 29 ++++++++++------------------- cookbooks/mezuro/templates/prezento/nginx.conf.erb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 19 deletions(-) create mode 100644 cookbooks/mezuro/templates/prezento/nginx.conf.erb diff --git a/cookbooks/mezuro/recipes/prezento.rb b/cookbooks/mezuro/recipes/prezento.rb index 0436ea8..74d997a 100644 --- a/cookbooks/mezuro/recipes/prezento.rb +++ b/cookbooks/mezuro/recipes/prezento.rb @@ -11,6 +11,10 @@ service 'prezento.target' do action [:enable, :start] end +service 'nginx' do + action [:enable, :start] +end + template '/etc/mezuro/prezento/database.yml' do source 'prezento/database.yml.erb' owner 'prezento' @@ -42,24 +46,11 @@ template PREZENTO_DIR + '/config/kalibro.yml' do notifies :restart, 'service[prezento.target]' end -############################################################################# -# The next lines install the mezuro plugin for colab intergration # -# This shold be removed when the plugin were install thought pkg colab-deps # -############################################################################# - -service 'colab' do - action [:enable, :start] -end - -git '/home/vagrant/colab-mezuro-plugin' do - repository 'https://github.com/colab/colab-mezuro-plugin.git' - revision 'master' -end - -execute 'pip:install:plugin' do - command '/usr/lib/colab/bin/pip install .' - cwd '/home/vagrant/colab-mezuro-plugin' - user 'root' - notifies :restart, 'service[colab]' +template '/etc/nginx/conf.d/prezento.conf' do + source 'prezento/nginx.conf.erb' + owner 'root' + group 'root' + mode 0644 + notifies :restart, 'service[nginx]' end diff --git a/cookbooks/mezuro/templates/prezento/nginx.conf.erb b/cookbooks/mezuro/templates/prezento/nginx.conf.erb new file mode 100644 index 0000000..c55785c --- /dev/null +++ b/cookbooks/mezuro/templates/prezento/nginx.conf.erb @@ -0,0 +1,35 @@ +# vim: ft=nginx + +upstream mezuro { + server 127.0.0.1:8081 fail_timeout=10s; +} + +server { + listen *:84; + + server_name <%= node['peers']['mezuro'] %>; + + access_log /var/log/nginx/mezuro.access.log; + error_log /var/log/nginx/mezuro.error.log; + underscores_in_headers on; + client_max_body_size 150m; + + + #root /usr/share/mezuro/prezento/public/; + + location /mezuro/ { + alias /usr/share/mezuro/prezento/public/; + try_files $uri @mezuro-app; + } + + location @mezuro-app { + proxy_pass http://mezuro; + proxy_read_timeout 90; + proxy_connect_timeout 90; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} + -- libgit2 0.21.2