Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
geo $<%= node['nginx']['remote_ip_var'] %> $authorized_ip {
default no;
<% node['nginx']['authorized_ips'].each do |ip| %>
<%= "#{ip} yes;" %>
<% end %>
}

View File

@@ -0,0 +1,4 @@
geoip_country <%= @country_dat %>;
<% if @city_dat -%>
geoip_city <%= @city_dat %>;
<% end -%>

View File

@@ -0,0 +1 @@
gzip_static <%= node['nginx']['gzip_static'] %>;

View File

@@ -0,0 +1,7 @@
<% node['nginx']['realip']['addresses'].each do |address| %>
set_real_ip_from <%= address %>;
<% end %>
real_ip_header <%= node['nginx']['realip']['header'] %>;
<% if node['nginx']['version'] >= '1.2.1' -%>
real_ip_recursive <%= node['nginx']['realip']['real_ip_recursive'] %>;
<% end -%>

View File

@@ -0,0 +1,14 @@
include authorized_ip;
server {
listen <%= node['nginx']['status']['port'] %>;
server_name _;
location /nginx_status {
if ($authorized_ip = no) {
return 404;
}
stub_status on;
access_log off;
}
}

View File

@@ -0,0 +1,13 @@
passenger_root <%= node['nginx']['passenger']['root'] %>;
passenger_ruby <%= node['nginx']['passenger']['ruby'] %>;
passenger_max_pool_size <%= node['nginx']['passenger']['max_pool_size'] %>;
passenger_spawn_method <%= node['nginx']['passenger']['spawn_method'] %>;
passenger_buffer_response <%= node['nginx']['passenger']['buffer_response'] %>;
passenger_min_instances <%= node['nginx']['passenger']['min_instances'] %>;
passenger_max_instances_per_app <%= node['nginx']['passenger']['max_instances_per_app'] %>;
passenger_pool_idle_time <%= node['nginx']['passenger']['pool_idle_time'] %>;
passenger_max_requests <%= node['nginx']['passenger']['max_requests'] %>;
<%- if node['nginx']['passenger']['nodejs'] %>
passenger_nodejs <%= node['nginx']['passenger']['nodejs'] %>;
<% end %>

View File

@@ -0,0 +1,89 @@
server {
set $app_home <%= node['nginx']['socketproxy']['root'] %>;
<% if node['nginx']['sts_max_age'] -%>
add_header Strict-Transport-Security "max-age=<%= node['nginx']['sts_max_age'] %>";
<% end -%>
listen <%= node['nginx']['port'] %> default;
access_log <%= node['nginx']['log_dir'] %>/<%= node['nginx']['socketproxy']['logname'] %>.access.log<% if node['nginx']['access_log_options'] %> <%= node['nginx']['access_log_options'] %><% end %>;
error_log <%= node['nginx']['log_dir'] %>/<%= node['nginx']['socketproxy']['logname'] %>.error.log <%= node['nginx']['socketproxy']['log_level'] %>;
<% if node['nginx']['server_name'] -%>
server_name ~^<%= node['nginx']['server_name'] %>\..*$;
<% end -%>
client_max_body_size 4G;
keepalive_timeout 5;
root $app_home/<%= node['nginx']['socketproxy']['default_app'] %>/<%= node['nginx']['socketproxy']['apps'][node['nginx']['socketproxy']['default_app']]['subdir'] %>/public;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS|PATCH)$ ) {
return 405;
}
<% node['nginx']['socketproxy']['apps'].each do |app, app_conf|
if app_conf['context_name']
base_loc = "/#{app_conf['context_name'].gsub(/^\/+/,'').gsub(/\/+$/,'')}"
else
base_loc = ""
end
-%>
location ~ "^<%= base_loc %>/assets/(.*/)*.*-[0-9a-f]{32}.*" {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location ^~ /<%= app_conf['context_name'] %> {
alias $app_home/<%= app %>/<%= app_conf['subdir'] %>/public/;
try_files $uri/index.html $uri.html $uri @app_<%= app %>;
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 502 503 504 /500.html;
error_page 403 /403.html;
}
location @app_<%= app %> {
proxy_read_timeout 600;
<%
if app_conf['socket']['type']
case app_conf['socket']['type']
when 'unix'
-%>
proxy_pass http://unix:$app_home/<%= app %>/<%= app_conf['socket']['path'] %><% if app_conf['prepend_slash'] %>:/<% end %>;
<%
when 'tcp'
-%>
proxy_pass http://localhost:<%= app_conf['socket']['port'] -%>;
<%
end
else
-%>
proxy_pass http://unix:$app_home/<%= app %>/<%= app_conf['socket_path'] %><% if app_conf['prepend_slash'] %>:/<% end %>;
<%
end
-%>
}
<% end # node['nginx']['socketproxy']['apps'].each -%>
error_page 500 502 504 /50x.html;
location = /50x.html {
root html;
}
}

View File

@@ -0,0 +1,4 @@
upload_progress <%= node['nginx']['upload_progress']['zone_name'] -%> <%= node['nginx']['upload_progress']['zone_size'] -%>;
<% if node['nginx']['upload_progress']['javascript_output'] -%>
upload_progress_java_output;
<% end -%>