from-scratch 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -1
  3. data/Berksfile.lock +20 -1
  4. data/cookbooks/bluepill/CHANGELOG.md +93 -0
  5. data/cookbooks/bluepill/README.md +91 -0
  6. data/cookbooks/bluepill/attributes/default.rb +44 -0
  7. data/cookbooks/bluepill/metadata.json +1 -0
  8. data/cookbooks/bluepill/providers/service.rb +172 -0
  9. data/cookbooks/bluepill/recipes/default.rb +48 -0
  10. data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
  11. data/cookbooks/bluepill/resources/service.rb +27 -0
  12. data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
  13. data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
  14. data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
  15. data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
  16. data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
  17. data/cookbooks/nginx/CHANGELOG.md +435 -0
  18. data/cookbooks/nginx/README.md +521 -0
  19. data/cookbooks/nginx/attributes/auth_request.rb +23 -0
  20. data/cookbooks/nginx/attributes/default.rb +131 -0
  21. data/cookbooks/nginx/attributes/devel.rb +24 -0
  22. data/cookbooks/nginx/attributes/echo.rb +24 -0
  23. data/cookbooks/nginx/attributes/geoip.rb +31 -0
  24. data/cookbooks/nginx/attributes/headers_more.rb +24 -0
  25. data/cookbooks/nginx/attributes/lua.rb +28 -0
  26. data/cookbooks/nginx/attributes/naxsi.rb +24 -0
  27. data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
  28. data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
  29. data/cookbooks/nginx/attributes/passenger.rb +58 -0
  30. data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
  31. data/cookbooks/nginx/attributes/repo.rb +35 -0
  32. data/cookbooks/nginx/attributes/set_misc.rb +8 -0
  33. data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
  34. data/cookbooks/nginx/attributes/source.rb +42 -0
  35. data/cookbooks/nginx/attributes/status.rb +22 -0
  36. data/cookbooks/nginx/attributes/syslog.rb +24 -0
  37. data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
  38. data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
  39. data/cookbooks/nginx/files/default/mime.types +78 -0
  40. data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  41. data/cookbooks/nginx/libraries/matchers.rb +20 -0
  42. data/cookbooks/nginx/metadata.json +351 -0
  43. data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
  44. data/cookbooks/nginx/recipes/commons.rb +24 -0
  45. data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
  46. data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
  47. data/cookbooks/nginx/recipes/commons_script.rb +29 -0
  48. data/cookbooks/nginx/recipes/default.rb +31 -0
  49. data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
  50. data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
  51. data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  52. data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
  53. data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
  54. data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
  55. data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
  56. data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
  57. data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
  58. data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  59. data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  60. data/cookbooks/nginx/recipes/ipv6.rb +23 -0
  61. data/cookbooks/nginx/recipes/lua.rb +47 -0
  62. data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
  63. data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
  64. data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
  65. data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
  66. data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
  67. data/cookbooks/nginx/recipes/package.rb +52 -0
  68. data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
  69. data/cookbooks/nginx/recipes/passenger.rb +56 -0
  70. data/cookbooks/nginx/recipes/repo.rb +41 -0
  71. data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
  72. data/cookbooks/nginx/recipes/set_misc.rb +30 -0
  73. data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
  74. data/cookbooks/nginx/recipes/source.rb +205 -0
  75. data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
  76. data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
  77. data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  78. data/cookbooks/nginx/templates/default/default-site.erb +11 -0
  79. data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  80. data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  81. data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
  82. data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
  83. data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  84. data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
  85. data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
  86. data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
  87. data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
  88. data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
  89. data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  90. data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  91. data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  92. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  93. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  94. data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  95. data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  96. data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
  97. data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  98. data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
  99. data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  100. data/cookbooks/ohai/CHANGELOG.md +69 -0
  101. data/cookbooks/ohai/README.md +89 -0
  102. data/cookbooks/ohai/attributes/default.rb +31 -0
  103. data/cookbooks/ohai/files/default/plugins/README +1 -0
  104. data/cookbooks/ohai/libraries/matchers.rb +14 -0
  105. data/cookbooks/ohai/metadata.json +1 -0
  106. data/cookbooks/ohai/providers/hint.rb +38 -0
  107. data/cookbooks/ohai/recipes/default.rb +52 -0
  108. data/cookbooks/ohai/resources/hint.rb +5 -0
  109. data/cookbooks/packagecloud/CHANGELOG.md +12 -0
  110. data/cookbooks/packagecloud/README.md +80 -0
  111. data/cookbooks/packagecloud/attributes/default.rb +8 -0
  112. data/cookbooks/packagecloud/libraries/helper.rb +43 -0
  113. data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
  114. data/cookbooks/packagecloud/metadata.json +1 -0
  115. data/cookbooks/packagecloud/providers/repo.rb +212 -0
  116. data/cookbooks/packagecloud/resources/repo.rb +10 -0
  117. data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
  118. data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
  119. data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
  120. data/cookbooks/rsyslog/CHANGELOG.md +193 -0
  121. data/cookbooks/rsyslog/README.md +276 -0
  122. data/cookbooks/rsyslog/attributes/default.rb +131 -0
  123. data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
  124. data/cookbooks/rsyslog/metadata.json +1 -0
  125. data/cookbooks/rsyslog/providers/file_input.rb +44 -0
  126. data/cookbooks/rsyslog/recipes/client.rb +87 -0
  127. data/cookbooks/rsyslog/recipes/default.rb +89 -0
  128. data/cookbooks/rsyslog/recipes/server.rb +44 -0
  129. data/cookbooks/rsyslog/resources/file_input.rb +28 -0
  130. data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
  131. data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
  132. data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
  133. data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
  134. data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
  135. data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
  136. data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
  137. data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
  138. data/cookbooks/runit/.kitchen.cloud.yml +103 -0
  139. data/cookbooks/runit/.kitchen.yml +38 -0
  140. data/cookbooks/runit/.rspec +3 -0
  141. data/cookbooks/runit/.rubocop.yml +45 -0
  142. data/cookbooks/runit/Berksfile.disabled +11 -0
  143. data/cookbooks/runit/CHANGELOG.md +226 -0
  144. data/cookbooks/runit/CONTRIBUTING.md +266 -0
  145. data/cookbooks/runit/Cheffile +11 -0
  146. data/cookbooks/runit/Gemfile +17 -0
  147. data/cookbooks/runit/LICENSE +201 -0
  148. data/cookbooks/runit/README.md +435 -0
  149. data/cookbooks/runit/Rakefile +23 -0
  150. data/cookbooks/runit/TESTING.md +26 -0
  151. data/cookbooks/runit/attributes/default.rb +62 -0
  152. data/cookbooks/runit/files/default/runit.seed +1 -0
  153. data/cookbooks/runit/files/default/runsvdir +0 -0
  154. data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  155. data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  156. data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  157. data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  158. data/cookbooks/runit/libraries/default.rb +0 -0
  159. data/cookbooks/runit/libraries/helpers.rb +190 -0
  160. data/cookbooks/runit/libraries/matchers.rb +69 -0
  161. data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
  162. data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
  163. data/cookbooks/runit/metadata.json +50 -0
  164. data/cookbooks/runit/recipes/default.rb +91 -0
  165. data/cookbooks/runit/templates/debian/init.d.erb +66 -0
  166. data/cookbooks/runit/templates/default/log-config.erb +24 -0
  167. data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  168. data/cookbooks/scratchify/Berksfile +2 -1
  169. data/cookbooks/scratchify/Berksfile.lock +20 -1
  170. data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
  171. data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
  172. data/cookbooks/scratchify/metadata.json +5 -2
  173. data/cookbooks/scratchify/recipes/default.rb +15 -1
  174. data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
  175. data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
  176. data/cookbooks/scratchify/templates/nginx.erb +31 -0
  177. data/cookbooks/scratchify/templates/node.json.erb +21 -6
  178. data/cookbooks/yum-epel/CHANGELOG.md +84 -0
  179. data/cookbooks/yum-epel/README.md +172 -0
  180. data/cookbooks/yum-epel/attributes/default.rb +1 -0
  181. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
  182. data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
  183. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
  184. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
  185. data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
  186. data/cookbooks/yum-epel/attributes/epel.rb +28 -0
  187. data/cookbooks/yum-epel/metadata.json +1 -0
  188. data/cookbooks/yum-epel/recipes/default.rb +61 -0
  189. data/cookbooks/yum/CHANGELOG.md +294 -0
  190. data/cookbooks/yum/README.md +285 -0
  191. data/cookbooks/yum/attributes/main.rb +100 -0
  192. data/cookbooks/yum/libraries/matchers.rb +27 -0
  193. data/cookbooks/yum/metadata.json +1 -0
  194. data/cookbooks/yum/providers/globalconfig.rb +41 -0
  195. data/cookbooks/yum/providers/repository.rb +106 -0
  196. data/cookbooks/yum/recipes/default.rb +26 -0
  197. data/cookbooks/yum/resources/globalconfig.rb +109 -0
  198. data/cookbooks/yum/resources/repository.rb +69 -0
  199. data/cookbooks/yum/templates/default/main.erb +276 -0
  200. data/cookbooks/yum/templates/default/repo.erb +125 -0
  201. data/lib/from-scratch.rb +1 -0
  202. data/lib/from-scratch/version.rb +1 -1
  203. data/metadata.rb +5 -1
  204. data/recipes/default.rb +15 -1
  205. data/recipes/nginx_site.rb +4 -0
  206. data/recipes/pre_rvm.rb +5 -0
  207. data/templates/nginx.erb +31 -0
  208. data/templates/node.json.erb +21 -6
  209. metadata +194 -1
@@ -0,0 +1,69 @@
1
+ #
2
+ # Cookbook Name:: nginx
3
+ # Recipe:: syslog_module
4
+ #
5
+ # Author:: Bob Ziuchkovski (<bob@bz-technology.com>)
6
+ #
7
+ # Copyright 2014, UserTesting
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ nginx_src = "#{Chef::Config['file_cache_path']}/nginx-#{node['nginx']['source']['version']}"
23
+ nginx_syslog_src = "#{Chef::Config['file_cache_path']}/nginx_syslog_module"
24
+
25
+ major, minor, patch = node['nginx']['source']['version'].split('.').map { |s| Integer(s) }
26
+ fail 'Unsupported nginx version' if major != 1
27
+ case minor
28
+ when 2
29
+ case patch
30
+ when 0..6
31
+ syslog_patch = 'syslog_1.2.0.patch'
32
+ else
33
+ syslog_patch = 'syslog_1.2.7.patch'
34
+ end
35
+ when 3
36
+ case patch
37
+ when 0..9
38
+ syslog_patch = 'syslog_1.2.0.patch'
39
+ when 10..13
40
+ syslog_patch = 'syslog_1.3.11.patch'
41
+ else
42
+ syslog_patch = 'syslog_1.3.14.patch'
43
+ end
44
+ when 4
45
+ syslog_patch = 'syslog_1.4.0.patch'
46
+ when 5..6
47
+ syslog_patch = 'syslog_1.5.6.patch'
48
+ when 7
49
+ syslog_patch = 'syslog_1.7.0.patch'
50
+ else
51
+ fail 'Unsupported nginx version'
52
+ end
53
+
54
+ git nginx_syslog_src do
55
+ repository node['nginx']['syslog']['git_repo']
56
+ revision node['nginx']['syslog']['git_revision']
57
+ action :sync
58
+ user 'root'
59
+ group 'root'
60
+ end
61
+
62
+ execute 'apply_nginx_syslog_patch' do
63
+ cwd nginx_src
64
+ command "patch -p1 < #{nginx_syslog_src}/#{syslog_patch}"
65
+ not_if "patch -p1 --dry-run --reverse --silent < #{nginx_syslog_src}/#{syslog_patch}", :cwd => nginx_src
66
+ end
67
+
68
+ node.run_state['nginx_configure_flags'] =
69
+ node.run_state['nginx_configure_flags'] | ["--add-module=#{nginx_syslog_src}"]
@@ -0,0 +1,53 @@
1
+ #
2
+ # Cookbook Name:: nginx
3
+ # Recipe:: upload_progress_module
4
+ #
5
+ # Author:: Jamie Winsor (<jamie@vialstudios.com>)
6
+ #
7
+ # Copyright 2012-2013, Riot Games
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ #
21
+
22
+ upm_src_filename = ::File.basename(node['nginx']['upload_progress']['url'])
23
+ upm_src_filepath = "#{Chef::Config['file_cache_path']}/#{upm_src_filename}"
24
+ upm_extract_path = "#{Chef::Config['file_cache_path']}/nginx_upload_progress/#{node['nginx']['upload_progress']['checksum']}"
25
+
26
+ remote_file upm_src_filepath do
27
+ source node['nginx']['upload_progress']['url']
28
+ checksum node['nginx']['upload_progress']['checksum']
29
+ owner 'root'
30
+ group node['root_group']
31
+ mode '0644'
32
+ end
33
+
34
+ template "#{node['nginx']['dir']}/conf.d/upload_progress.conf" do
35
+ source 'modules/upload_progress.erb'
36
+ owner 'root'
37
+ group node['root_group']
38
+ mode '0644'
39
+ notifies :reload, 'service[nginx]', :delayed
40
+ end
41
+
42
+ bash 'extract_upload_progress_module' do
43
+ cwd ::File.dirname(upm_src_filepath)
44
+ code <<-EOH
45
+ mkdir -p #{upm_extract_path}
46
+ tar xzf #{upm_src_filename} -C #{upm_extract_path}
47
+ mv #{upm_extract_path}/*/* #{upm_extract_path}/
48
+ EOH
49
+ not_if { ::File.exist?(upm_extract_path) }
50
+ end
51
+
52
+ node.run_state['nginx_configure_flags'] =
53
+ node.run_state['nginx_configure_flags'] | ["--add-module=#{upm_extract_path}"]
@@ -0,0 +1,97 @@
1
+ #!/bin/sh
2
+
3
+ ### BEGIN INIT INFO
4
+ # Provides: nginx
5
+ # Required-Start: $local_fs $remote_fs $network $syslog
6
+ # Required-Stop: $local_fs $remote_fs $network $syslog
7
+ # Default-Start: 2 3 4 5
8
+ # Default-Stop: 0 1 6
9
+ # Short-Description: starts the nginx web server
10
+ # Description: starts nginx using start-stop-daemon
11
+ ### END INIT INFO
12
+
13
+ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
14
+ DAEMON=<%= node['nginx']['binary'] %>
15
+ NAME=nginx
16
+ DESC=nginx
17
+ PID=<%= node['nginx']['pid'] %>
18
+
19
+ # Include nginx defaults if available
20
+ if [ -f /etc/default/nginx ]; then
21
+ . /etc/default/nginx
22
+ fi
23
+
24
+ test -x $DAEMON || exit 0
25
+
26
+ set -e
27
+
28
+ . /lib/lsb/init-functions
29
+
30
+ test_nginx_config() {
31
+ if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1; then
32
+ return 0
33
+ else
34
+ $DAEMON -t $DAEMON_OPTS
35
+ return $?
36
+ fi
37
+ }
38
+
39
+ case "$1" in
40
+ start)
41
+ echo -n "Starting $DESC: "
42
+ test_nginx_config
43
+ # Check if the ULIMIT is set in /etc/default/nginx
44
+ if [ -n "$ULIMIT" ]; then
45
+ # Set the ulimits
46
+ ulimit $ULIMIT
47
+ fi
48
+ start-stop-daemon --start --quiet --pidfile $PID \
49
+ --exec $DAEMON -- $DAEMON_OPTS || true
50
+ echo "$NAME."
51
+ ;;
52
+
53
+ stop)
54
+ echo -n "Stopping $DESC: "
55
+ start-stop-daemon --stop --quiet --pidfile $PID \
56
+ --exec $DAEMON || true
57
+ echo "$NAME."
58
+ ;;
59
+
60
+ restart|force-reload)
61
+ echo -n "Restarting $DESC: "
62
+ start-stop-daemon --stop --quiet --pidfile \
63
+ $PID --exec $DAEMON || true
64
+ sleep 1
65
+ test_nginx_config
66
+ start-stop-daemon --start --quiet --pidfile \
67
+ $PID --exec $DAEMON -- $DAEMON_OPTS || true
68
+ echo "$NAME."
69
+ ;;
70
+
71
+ reload)
72
+ echo -n "Reloading $DESC configuration: "
73
+ test_nginx_config
74
+ start-stop-daemon --stop --signal HUP --quiet --pidfile $PID \
75
+ --exec $DAEMON || true
76
+ echo "$NAME."
77
+ ;;
78
+
79
+ configtest|testconfig)
80
+ echo -n "Testing $DESC configuration: "
81
+ if test_nginx_config; then
82
+ echo "$NAME."
83
+ else
84
+ exit $?
85
+ fi
86
+ ;;
87
+
88
+ status)
89
+ status_of_proc -p $PID "$DAEMON" nginx && exit 0 || exit $?
90
+ ;;
91
+ *)
92
+ echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2
93
+ exit 1
94
+ ;;
95
+ esac
96
+
97
+ exit 0
@@ -0,0 +1,11 @@
1
+ server {
2
+ listen <%= node['nginx']['port'] -%>;
3
+ server_name <%= node['hostname'] %>;
4
+
5
+ access_log <%= node['nginx']['log_dir'] %>/localhost.access.log;
6
+
7
+ location / {
8
+ root <%= node['nginx']['default_root'] %>;
9
+ index index.html index.htm;
10
+ }
11
+ }
@@ -0,0 +1,6 @@
1
+ geo $<%= node['nginx']['remote_ip_var'] %> $authorized_ip {
2
+ default no;
3
+ <% node['nginx']['authorized_ips'].each do |ip| %>
4
+ <%= "#{ip} yes;" %>
5
+ <% end %>
6
+ }
@@ -0,0 +1,4 @@
1
+ geoip_country <%= @country_dat %>;
2
+ <% if @city_dat -%>
3
+ geoip_city <%= @city_dat %>;
4
+ <% end -%>
@@ -0,0 +1 @@
1
+ gzip_static <%= node['nginx']['gzip_static'] %>;
@@ -0,0 +1,7 @@
1
+ <% node['nginx']['realip']['addresses'].each do |address| %>
2
+ set_real_ip_from <%= address %>;
3
+ <% end %>
4
+ real_ip_header <%= node['nginx']['realip']['header'] %>;
5
+ <% if node['nginx']['version'] >= '1.2.1' -%>
6
+ real_ip_recursive <%= node['nginx']['realip']['real_ip_recursive'] %>;
7
+ <% end -%>
@@ -0,0 +1,14 @@
1
+ include authorized_ip;
2
+
3
+ server {
4
+ listen <%= node['nginx']['status']['port'] %>;
5
+ server_name _;
6
+
7
+ location /nginx_status {
8
+ if ($authorized_ip = no) {
9
+ return 404;
10
+ }
11
+ stub_status on;
12
+ access_log off;
13
+ }
14
+ }
@@ -0,0 +1,13 @@
1
+ passenger_root <%= node['nginx']['passenger']['root'] %>;
2
+ passenger_ruby <%= node['nginx']['passenger']['ruby'] %>;
3
+ passenger_max_pool_size <%= node['nginx']['passenger']['max_pool_size'] %>;
4
+ passenger_spawn_method <%= node['nginx']['passenger']['spawn_method'] %>;
5
+ passenger_buffer_response <%= node['nginx']['passenger']['buffer_response'] %>;
6
+ passenger_min_instances <%= node['nginx']['passenger']['min_instances'] %>;
7
+ passenger_max_instances_per_app <%= node['nginx']['passenger']['max_instances_per_app'] %>;
8
+ passenger_pool_idle_time <%= node['nginx']['passenger']['pool_idle_time'] %>;
9
+ passenger_max_requests <%= node['nginx']['passenger']['max_requests'] %>;
10
+
11
+ <%- if node['nginx']['passenger']['nodejs'] %>
12
+ passenger_nodejs <%= node['nginx']['passenger']['nodejs'] %>;
13
+ <% end %>
@@ -0,0 +1,89 @@
1
+ server {
2
+
3
+ set $app_home <%= node['nginx']['socketproxy']['root'] %>;
4
+
5
+ <% if node['nginx']['sts_max_age'] -%>
6
+ add_header Strict-Transport-Security "max-age=<%= node['nginx']['sts_max_age'] %>";
7
+ <% end -%>
8
+
9
+ listen <%= node['nginx']['port'] %> default;
10
+
11
+ access_log <%= node['nginx']['log_dir'] %>/<%= node['nginx']['socketproxy']['logname'] %>.access.log<% if node['nginx']['access_log_options'] %> <%= node['nginx']['access_log_options'] %><% end %>;
12
+ error_log <%= node['nginx']['log_dir'] %>/<%= node['nginx']['socketproxy']['logname'] %>.error.log <%= node['nginx']['socketproxy']['log_level'] %>;
13
+
14
+ <% if node['nginx']['server_name'] -%>
15
+ server_name ~^<%= node['nginx']['server_name'] %>\..*$;
16
+ <% end -%>
17
+
18
+ client_max_body_size 4G;
19
+ keepalive_timeout 5;
20
+
21
+ root $app_home/<%= node['nginx']['socketproxy']['default_app'] %>/<%= node['nginx']['socketproxy']['apps'][node['nginx']['socketproxy']['default_app']]['subdir'] %>/public;
22
+
23
+ proxy_set_header Host $http_host;
24
+ proxy_set_header X-Real-IP $remote_addr;
25
+ proxy_set_header X-Forwarded-For $remote_addr;
26
+ proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
27
+
28
+ if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS|PATCH)$ ) {
29
+ return 405;
30
+ }
31
+
32
+ <% node['nginx']['socketproxy']['apps'].each do |app, app_conf|
33
+ if app_conf['context_name']
34
+ base_loc = "/#{app_conf['context_name'].gsub(/^\/+/,'').gsub(/\/+$/,'')}"
35
+ else
36
+ base_loc = ""
37
+ end
38
+ -%>
39
+
40
+ location ~ "^<%= base_loc %>/assets/(.*/)*.*-[0-9a-f]{32}.*" {
41
+ gzip_static on;
42
+ expires max;
43
+ add_header Cache-Control public;
44
+ }
45
+
46
+ location ^~ /<%= app_conf['context_name'] %> {
47
+
48
+ alias $app_home/<%= app %>/<%= app_conf['subdir'] %>/public/;
49
+
50
+ try_files $uri/index.html $uri.html $uri @app_<%= app %>;
51
+ error_page 404 /404.html;
52
+ error_page 422 /422.html;
53
+ error_page 500 502 503 504 /500.html;
54
+ error_page 403 /403.html;
55
+
56
+ }
57
+
58
+ location @app_<%= app %> {
59
+
60
+ proxy_read_timeout 600;
61
+ <%
62
+ if app_conf['socket']['type']
63
+ case app_conf['socket']['type']
64
+ when 'unix'
65
+ -%>
66
+ proxy_pass http://unix:$app_home/<%= app %>/<%= app_conf['socket']['path'] %><% if app_conf['prepend_slash'] %>:/<% end %>;
67
+ <%
68
+ when 'tcp'
69
+ -%>
70
+ proxy_pass http://localhost:<%= app_conf['socket']['port'] -%>;
71
+ <%
72
+ end
73
+ else
74
+ -%>
75
+ proxy_pass http://unix:$app_home/<%= app %>/<%= app_conf['socket_path'] %><% if app_conf['prepend_slash'] %>:/<% end %>;
76
+ <%
77
+ end
78
+ -%>
79
+
80
+ }
81
+
82
+ <% end # node['nginx']['socketproxy']['apps'].each -%>
83
+
84
+ error_page 500 502 504 /50x.html;
85
+ location = /50x.html {
86
+ root html;
87
+ }
88
+
89
+ }
@@ -0,0 +1,4 @@
1
+ upload_progress <%= node['nginx']['upload_progress']['zone_name'] -%> <%= node['nginx']['upload_progress']['zone_size'] -%>;
2
+ <% if node['nginx']['upload_progress']['javascript_output'] -%>
3
+ upload_progress_java_output;
4
+ <% end -%>
@@ -0,0 +1,39 @@
1
+ # nginx
2
+
3
+ description "nginx http daemon"
4
+
5
+ start on (local-filesystems and net-device-up IFACE=lo and runlevel [<%= node['nginx']['upstart']['runlevels'] %>])
6
+ stop on runlevel [!<%= node['nginx']['upstart']['runlevels'] %>]
7
+
8
+ env DAEMON=<%= node['nginx']['binary'] %>
9
+ env PID=<%= node['nginx']['pid'] %>
10
+ env CONFIG=<%= node['nginx']['source']['conf_path'] %>
11
+
12
+ respawn
13
+ <% if node['nginx']['upstart']['respawn_limit'] %>
14
+ respawn limit <%= node['nginx']['upstart']['respawn_limit'] %>
15
+ <% end %>
16
+
17
+ pre-start script
18
+ ${DAEMON} -t
19
+ if [ $? -ne 0 ]; then
20
+ exit $?
21
+ fi
22
+ end script
23
+
24
+ <% unless node['nginx']['upstart']['foreground'] %>
25
+ expect fork
26
+ <% else %>
27
+ console output
28
+ <% end %>
29
+
30
+ exec ${DAEMON} -c "${CONFIG}"
31
+
32
+ <% if node.recipe?('nginx::passenger') and not node['nginx']['upstart']['foreground'] %>
33
+ # classic example of why pidfiles should have gone away
34
+ # with the advent of fork(). we missed that bus a long
35
+ # time ago so hack around it.
36
+ post-stop script
37
+ start-stop-daemon --stop --pidfile ${PID} --name nginx --exec ${DAEMON} --signal QUIT
38
+ end script
39
+ <% end %>
@@ -0,0 +1,103 @@
1
+ user <%= node['nginx']['user'] %><% if node['nginx']['user'] != node['nginx']['group'] %> <%= node['nginx']['group'] %><% end %>;
2
+ worker_processes <%= node['nginx']['worker_processes'] %>;
3
+ <% if node['nginx']['daemon_disable'] -%>
4
+ daemon off;
5
+ <% end -%>
6
+ <% if node['nginx']['worker_rlimit_nofile'] -%>
7
+ worker_rlimit_nofile <%= node['nginx']['worker_rlimit_nofile'] %>;
8
+ <% end -%>
9
+
10
+ error_log <%= node['nginx']['log_dir'] %>/error.log<% if node['nginx']['error_log_options'] %> <%= node['nginx']['error_log_options'] %><% end %>;
11
+ pid <%= node['nginx']['pid'] %>;
12
+
13
+ events {
14
+ worker_connections <%= node['nginx']['worker_connections'] %>;
15
+ <% if node['nginx']['multi_accept'] -%>
16
+ multi_accept on;
17
+ <% end -%>
18
+ <% if node['nginx']['event'] -%>
19
+ use <%= node['nginx']['event'] %>;
20
+ <% end -%>
21
+ <% if node['nginx']['accept_mutex_delay'] -%>
22
+ accept_mutex_delay <%= node['nginx']['accept_mutex_delay'] %>ms;
23
+ <% end -%>
24
+ }
25
+
26
+ http {
27
+ <% if node.recipe?('nginx::naxsi_module') %>
28
+ include <%= node['nginx']['dir'] %>/naxsi_core.rules;
29
+ <% end %>
30
+
31
+ include <%= node['nginx']['dir'] %>/mime.types;
32
+ default_type application/octet-stream;
33
+
34
+ <% node['nginx']['log_formats'].each do |name, format| %>
35
+ log_format <%= name %> <%= format %>;
36
+ <% end -%>
37
+
38
+ <% if node['nginx']['disable_access_log'] -%>
39
+ access_log off;
40
+ <% else -%>
41
+ access_log <%= node['nginx']['log_dir'] %>/access.log<% if node['nginx']['access_log_options'] %> <%= node['nginx']['access_log_options'] %><% end %>;
42
+ <% end %>
43
+ <% if node['nginx']['server_tokens'] -%>
44
+ server_tokens <%= node['nginx']['server_tokens'] %>;
45
+ <% end -%>
46
+
47
+ sendfile <%= node['nginx']['sendfile'] %>;
48
+ tcp_nopush <%= node['nginx']['tcp_nopush'] %>;
49
+ tcp_nodelay <%= node['nginx']['tcp_nodelay'] %>;
50
+
51
+ <% if node['nginx']['keepalive'] == 'on' %>
52
+ keepalive_requests <%= node['nginx']['keepalive_requests'] %>;
53
+ keepalive_timeout <%= node['nginx']['keepalive_timeout'] %>;
54
+ <% end %>
55
+
56
+ <% unless node['nginx']['underscores_in_headers'].nil? %>
57
+ underscores_in_headers <%= node['nginx']['underscores_in_headers'] %>;
58
+ <% end %>
59
+
60
+ gzip <%= node['nginx']['gzip'] %>;
61
+ <% if node['nginx']['gzip'] == 'on' %>
62
+ gzip_http_version <%= node['nginx']['gzip_http_version'] %>;
63
+ gzip_comp_level <%= node['nginx']['gzip_comp_level'] %>;
64
+ gzip_proxied <%= node['nginx']['gzip_proxied'] %>;
65
+ gzip_vary <%= node['nginx']['gzip_vary'] %>;
66
+ <% if node['nginx']['gzip_buffers'] -%>
67
+ gzip_buffers <%= node['nginx']['gzip_buffers'] %>;
68
+ <% end -%>
69
+ gzip_types <%= node['nginx']['gzip_types'].join(' ') %>;
70
+ gzip_min_length <%= node['nginx']['gzip_min_length'] %>;
71
+ gzip_disable "<%= node['nginx']['gzip_disable'] %>";
72
+ <% end %>
73
+
74
+
75
+ variables_hash_max_size <%= node['nginx']['variables_hash_max_size'] %>;
76
+ variables_hash_bucket_size <%= node['nginx']['variables_hash_bucket_size'] %>;
77
+ server_names_hash_bucket_size <%= node['nginx']['server_names_hash_bucket_size'] %>;
78
+ types_hash_max_size <%= node['nginx']['types_hash_max_size'] %>;
79
+ types_hash_bucket_size <%= node['nginx']['types_hash_bucket_size'] %>;
80
+ <% if node['nginx']['proxy_read_timeout'] -%>
81
+ proxy_read_timeout <%= node['nginx']['proxy_read_timeout'] %>;
82
+ <% end -%>
83
+ <% if node['nginx']['client_body_buffer_size'] -%>
84
+ client_body_buffer_size <%= node['nginx']['client_body_buffer_size'] %>;
85
+ <% end -%>
86
+ <% if node['nginx']['client_max_body_size'] -%>
87
+ client_max_body_size <%= node['nginx']['client_max_body_size'] %>;
88
+ <% end -%>
89
+ <% if node['nginx']['large_client_header_buffers'] -%>
90
+ large_client_header_buffers <%= node['nginx']['large_client_header_buffers'] %>;
91
+ <% end -%>
92
+
93
+ <% if node['nginx']['enable_rate_limiting'] -%>
94
+ limit_req_zone $binary_remote_addr zone=<%= node['nginx']['rate_limiting_zone_name'] %>:<%= node['nginx']['rate_limiting_backoff'] %> rate=<%= node['nginx']['rate_limit'] %>;
95
+ <% end -%>
96
+
97
+ <% node['nginx']['extra_configs'].each do |key, value| -%>
98
+ <%= key %> <%= value %>;
99
+ <% end -%>
100
+
101
+ include <%= node['nginx']['dir'] %>/conf.d/*.conf;
102
+ include <%= node['nginx']['dir'] %>/sites-enabled/*;
103
+ }