Commit abace3482491371d5e16d42e85b7710e348a53cf

Authored by Paulo Tada
Committed by Rafael Manzo
1 parent ca18e92b
Exists in mezuro_cookbook

Adding nginx configuration for mezuro machine

Signed-off-by: Diego Araújo <diegoamc90@gmail.com>
cookbooks/mezuro/recipes/default.rb
@@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
1 -# Install kalibro configuration  
2 -# TODO: change the repo  
3 -execute 'download:repo' do  
4 - command 'wget https://copr.fedoraproject.org/coprs/ribeiro/athos-spb/repo/epel-7/ribeiro-athos-spb-epel-7.repo'  
5 - cwd '/etc/yum.repos.d'  
6 - user 'root'  
7 -end  
8 -  
9 -execute 'download:mezuro' do  
10 - command 'wget https://bintray.com/mezurometrics/rpm/rpm -O bintray-mezurometrics-rpm.repo'  
11 - cwd '/etc/yum.repos.d'  
12 - user 'root'  
13 -end  
14 -  
15 -package 'kalibro-configurations-deps'  
16 -package 'kalibro-configurations'  
17 -package 'kalibro-processor'  
18 -  
19 -service 'kalibro_configurations' do  
20 - action [:enable, :start]  
21 -end  
22 -  
23 -template '/etc/kalibro-configurations/database.yml' do  
24 - source 'kalibro_configurations/database.yml.erb'  
25 - owner 'kalibro_configurations'  
26 - group 'kalibro_configurations'  
27 - mode '0600'  
28 - notifies :restart, 'service[kalibro_configurations]'  
29 -end  
30 -  
31 -template '/etc/kalibro-processor/database.yml' do  
32 - source 'kalibro_processor/database.yml.erb'  
33 - owner 'kalibro_processor'  
34 - group 'kalibro_processor'  
35 - mode '0600'  
36 - action :nothing  
37 - #notifies :restart, 'service[kalibro_processor]'  
38 -end  
39 -  
cookbooks/mezuro/recipes/kalibro_configurations.rb
@@ -5,6 +5,17 @@ execute &#39;download:mezuro&#39; do @@ -5,6 +5,17 @@ execute &#39;download:mezuro&#39; do
5 user 'root' 5 user 'root'
6 end 6 end
7 7
  8 +package 'kalibro-configurations'
  9 +package 'nginx'
  10 +
  11 +service 'kalibro-configurations.target' do
  12 + action [:enable, :start]
  13 +end
  14 +
  15 +service 'nginx' do
  16 + action [:enable, :start]
  17 +end
  18 +
8 template '/etc/mezuro/kalibro-configurations/database.yml' do 19 template '/etc/mezuro/kalibro-configurations/database.yml' do
9 source 'kalibro_configurations/database.yml.erb' 20 source 'kalibro_configurations/database.yml.erb'
10 owner 'kalibro_configurations' 21 owner 'kalibro_configurations'
@@ -13,12 +24,6 @@ template &#39;/etc/mezuro/kalibro-configurations/database.yml&#39; do @@ -13,12 +24,6 @@ template &#39;/etc/mezuro/kalibro-configurations/database.yml&#39; do
13 notifies :restart, 'service[kalibro-configurations.target]' 24 notifies :restart, 'service[kalibro-configurations.target]'
14 end 25 end
15 26
16 -package 'kalibro-configurations'  
17 -  
18 -service 'kalibro-configurations.target' do  
19 - action [:enable, :start]  
20 -end  
21 -  
22 CONFIGURATIONS_DIR='/usr/share/mezuro/kalibro-configurations' 27 CONFIGURATIONS_DIR='/usr/share/mezuro/kalibro-configurations'
23 28
24 execute 'kalibro-configurations:schema' do 29 execute 'kalibro-configurations:schema' do
@@ -33,3 +38,11 @@ execute &#39;kalibro-configurations:migrate&#39; do @@ -33,3 +38,11 @@ execute &#39;kalibro-configurations:migrate&#39; do
33 user 'kalibro_configurations' 38 user 'kalibro_configurations'
34 notifies :restart, 'service[kalibro-configurations.target]' 39 notifies :restart, 'service[kalibro-configurations.target]'
35 end 40 end
  41 +
  42 +template '/etc/nginx/conf.d/kalibro-configurations.conf' do
  43 + source 'kalibro_configurations/nginx.conf.erb'
  44 + owner 'root'
  45 + group 'root'
  46 + mode '0644'
  47 + notifies :restart, 'service[nginx]'
  48 +end
cookbooks/mezuro/recipes/kalibro_processor.rb
@@ -4,6 +4,16 @@ execute &#39;download:mezuro&#39; do @@ -4,6 +4,16 @@ execute &#39;download:mezuro&#39; do
4 user 'root' 4 user 'root'
5 end 5 end
6 6
  7 +package 'kalibro-processor'
  8 +
  9 +service 'kalibro-processor.target' do
  10 + action [:enable, :start]
  11 +end
  12 +
  13 +service 'nginx' do
  14 + action [:enable, :start]
  15 +end
  16 +
7 template '/etc/mezuro/kalibro-processor/database.yml' do 17 template '/etc/mezuro/kalibro-processor/database.yml' do
8 source 'kalibro_processor/database.yml.erb' 18 source 'kalibro_processor/database.yml.erb'
9 owner 'kalibro_processor' 19 owner 'kalibro_processor'
@@ -12,12 +22,6 @@ template &#39;/etc/mezuro/kalibro-processor/database.yml&#39; do @@ -12,12 +22,6 @@ template &#39;/etc/mezuro/kalibro-processor/database.yml&#39; do
12 notifies :restart, 'service[kalibro-processor.target]' 22 notifies :restart, 'service[kalibro-processor.target]'
13 end 23 end
14 24
15 -package 'kalibro-processor'  
16 -  
17 -service 'kalibro-processor.target' do  
18 - action [:enable, :start]  
19 -end  
20 -  
21 PROCESSOR_DIR='/usr/share/mezuro/kalibro-processor' 25 PROCESSOR_DIR='/usr/share/mezuro/kalibro-processor'
22 26
23 execute 'kalibro-processor:schema' do 27 execute 'kalibro-processor:schema' do
@@ -32,3 +36,11 @@ execute &#39;kalibro-processor:migrate&#39; do @@ -32,3 +36,11 @@ execute &#39;kalibro-processor:migrate&#39; do
32 user 'kalibro_processor' 36 user 'kalibro_processor'
33 notifies :restart, 'service[kalibro-processor.target]' 37 notifies :restart, 'service[kalibro-processor.target]'
34 end 38 end
  39 +
  40 +template '/etc/nginx/conf.d/kalibro-processor.conf' do
  41 + source 'kalibro_processor/nginx.conf.erb'
  42 + owner 'root'
  43 + group 'root'
  44 + mode '0644'
  45 + notifies :restart, 'service[nginx]'
  46 +end
cookbooks/mezuro/templates/kalibro_configurations/nginx.conf.erb 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +# MANAGED WITH CHEF; DO NOT CHANGE BY HAND
  2 +
  3 +server {
  4 + listen *:83;
  5 + server_name <%= node['peers']['mezuro'] %>;
  6 + underscores_in_headers on;
  7 + access_log /var/log/nginx/kalibro-configurations.access.log;
  8 + error_log /var/log/nginx/kalibro-configurations.error.log;
  9 + client_max_body_size 0;
  10 +
  11 + location / {
  12 + try_files $uri @kalibro-configurations;
  13 + }
  14 +
  15 + location @kalibro-configurations {
  16 + proxy_pass http://10.10.10.8:8083;
  17 + proxy_set_header X-Real-IP $remote_addr;
  18 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  19 + }
  20 +}
cookbooks/mezuro/templates/kalibro_processor/nginx.conf.erb 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +# MANAGED WITH CHEF; DO NOT CHANGE BY HAND
  2 +
  3 +server {
  4 + listen *:82;
  5 + server_name <%= node['peers']['mezuro'] %>;
  6 + underscores_in_headers on;
  7 + access_log /var/log/nginx/kalibro-processor.access.log;
  8 + error_log /var/log/nginx/kalibro-processor.error.log;
  9 + client_max_body_size 0;
  10 +
  11 + location / {
  12 + try_files $uri @kalibro-processor;
  13 + }
  14 +
  15 + location @kalibro-processor {
  16 + proxy_pass http://localhost:8082;
  17 + proxy_set_header X-Real-IP $remote_addr;
  18 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  19 + }
  20 +}