from-scratch 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
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,521 @@
1
+ nginx Cookbook
2
+ ==============
3
+ [![Cookbook](http://img.shields.io/cookbook/v/nginx.svg)](https://github.com/miketheman/nginx)
4
+ [![Build Status](https://travis-ci.org/miketheman/nginx.svg?branch=master)](https://travis-ci.org/miketheman/nginx)
5
+ [![Gitter chat](https://img.shields.io/badge/Gitter-miketheman%2Fnginx-brightgreen.svg)](https://gitter.im/miketheman/nginx)
6
+
7
+ Installs nginx from package OR source code and sets up configuration handling similar to Debian's Apache2 scripts.
8
+
9
+ # READ THIS FIRST
10
+
11
+ After having struggled with the cookbook format and the interfaces being brittle, the maintainers have decided to begin rewriting the core implmenetation of the nginx cookbook from the ground up, to allow for better flexibility, testability and maintianability.
12
+
13
+ To this end, we request that you not open new issues for the existing codebase.
14
+
15
+ Pull requests for bugs will be merged, any obvious optimizations and clarifications will be merged, and a 2.7.5 release will be shipped, and we will focus on writing the 3.0.0 version.
16
+
17
+ Thank you for your help on this front!
18
+
19
+ -- The Maintainers
20
+
21
+ ---
22
+
23
+
24
+ Requirements
25
+ ------------
26
+ ### Cookbooks
27
+ The following cookbooks are direct dependencies because they're used for common "default" functionality.
28
+
29
+ - build-essential (for nginx::source)
30
+ - ohai (for nginx::ohai_plugin)
31
+
32
+ The following cookbook is not a strict dependency because its use can be controlled by an attribute, so it may not be a common "default."
33
+
34
+ - runit (for nginx::source)
35
+ - On RHEL family distros, the "yum" cookbook is required for `recipe[yum::epel]`.
36
+ - On Ubuntu, when using Nginx.org's stable package, `recipe[apt::default]` is required.
37
+
38
+
39
+ ### Platforms
40
+ The following platforms are supported and tested under test kitchen:
41
+
42
+ - Ubuntu 10.04, Ubuntu 12.04
43
+ - CentOS 5.8, 6.3
44
+
45
+ Other Debian and RHEL family distributions are assumed to work.
46
+
47
+
48
+ Attributes
49
+ ----------
50
+ Node attributes for this cookbook are logically separated into different files. Some attributes are set only via a specific recipe.
51
+
52
+ ### default
53
+ Generally used attributes. Some have platform specific values. See `attributes/default.rb`. "The Config" refers to "nginx.conf" the main config file.
54
+
55
+ - `node['nginx']['dir']` - Location for Nginx configuration.
56
+ - `node['nginx']['conf_template']` - The `source` template to use when creating the `nginx.conf`.
57
+ - `node['nginx']['conf_cookbook']` - The cookbook where `node['nginx']['conf_template']` resides.
58
+ - `node['nginx']['log_dir']` - Location for Nginx logs.
59
+ - `node['nginx']['log_dir_perm']` - Permissions for Nginx logs folder.
60
+ - `node['nginx']['user']` - User that Nginx will run as.
61
+ - `node['nginx']['group]` - Group for Nginx.
62
+ - `node['nginx']['port']` - Port for nginx to listen on.
63
+ - `node['nginx']['binary']` - Path to the Nginx binary.
64
+ - `node['nginx']['init_style']` - How to run Nginx as a service when
65
+ using `nginx::source`. Values can be "runit", "upstart", "init" or
66
+ "bluepill". When using runit or bluepill, those recipes will be
67
+ included as well and are dependencies of this cookbook. Recipes
68
+ are not included for upstart, it is assumed that upstart is built
69
+ into the platform you are using (ubuntu or el6). This attribute is
70
+ not used in the `nginx` recipe because the package manager's init
71
+ script style for the platform is assumed. Upstart is never set as
72
+ a default as this represents a change in behavior, if you are running
73
+ ubuntu or el6 and want to use upstart, please set this attribute in
74
+ a role or similar.
75
+ - `node['nginx']['upstart']['foreground']` - Set this to true if you
76
+ want upstart to run nginx in the foreground, set to false if you
77
+ want upstart to detach and track the process via pid.
78
+ - `node['nginx']['upstart']['runlevels']` - String of runlevels in the
79
+ format '2345' which determines which runlevels nginx will start at
80
+ when entering and stop at when leaving.
81
+ - `node['nginx']['upstart']['respawn_limit']` - Respawn limit in upstart
82
+ stanza format, count followed by space followed by interval in seconds.
83
+ - `node['nginx']['pid']` - Location of the PID file.
84
+ - `node['nginx']['keepalive']` - Whether to use `keepalive_timeout`,
85
+ any value besides "on" will leave that option out of the config.
86
+ - `node['nginx']['keepalive_requests']` - used for config value of
87
+ `keepalive_requests`.
88
+ - `node['nginx']['keepalive_timeout']` - used for config value of
89
+ `keepalive_timeout`.
90
+ - `node['nginx']['worker_processes']` - used for config value of
91
+ `worker_processes`.
92
+ - `node['nginx']['worker_connections']` - used for config value of
93
+ `events { worker_connections }`
94
+ - `node['nginx']['worker_rlimit_nofile']` - used for config value of
95
+ `worker_rlimit_nofile`. Can replace any "ulimit -n" command. The
96
+ value depend on your usage (cache or not) but must always be
97
+ superior than worker_connections.
98
+ - `node['nginx']['multi_accept']` - used for config value of `events {
99
+ multi_accept }`. Try to accept() as many connections as possible.
100
+ Disable by default.
101
+ - `node['nginx']['event']` - used for config value of `events { use
102
+ }`. Set the event-model. By default nginx looks for the most
103
+ suitable method for your OS.
104
+ - `node['nginx']['accept_mutex_delay']` - used for config value of
105
+ `accept_mutex_delay`
106
+ - `node['nginx']['server_tokens']` - used for config value of
107
+ `server_tokens`.
108
+ - `node['nginx']['server_names_hash_bucket_size']` - used for config
109
+ value of `server_names_hash_bucket_size`.
110
+ - `node['nginx']['disable_access_log']` - set to true to disable the
111
+ general access log, may be useful on high traffic sites.
112
+ - `node['nginx']['access_log_options']` - Set to a string of additional options
113
+ to be appended to the access log directive
114
+ - `node['nginx']['error_log_options']` - Set to a string of additional options
115
+ to be appended to the error log directive
116
+ - `node['nginx']['default_site_enabled']` - enable the default site
117
+ - `node['nginx']['sendfile']` - Whether to use `sendfile`. Defaults to "on".
118
+ - `node['nginx']['tcp_nopush']` - Whether to use `tcp_nopush`. Defaults to "on".
119
+ - `node['nginx']['tcp_nodelay']` - Whether to use `tcp_nodelay`. Defaults to "on".
120
+ - `node['nginx']['install_method']` - Whether nginx is installed from
121
+ packages or from source.
122
+ - `node['nginx']['types_hash_max_size']` - Used for the
123
+ `types_hash_max_size` configuration directive.
124
+ - `node['nginx']['types_hash_bucket_size']` - Used for the
125
+ `types_hash_bucket_size` configuration directive.
126
+ - `node['nginx']['proxy_read_timeout']` - defines a timeout (between two
127
+ successive read operations) for reading a response from the proxied server.
128
+ - `node['nginx']['client_body_buffer_size']` - used for config value of
129
+ `client_body_buffer_size`.
130
+ - `node['nginx']['client_max_body_size']` - specifies the maximum accepted body
131
+ size of a client request, as indicated by the request header Content-Length.
132
+ - `node['nginx']['repo_source']` - when installed from a package this attribute affects
133
+ which yum repositories, if any, will be added before installing the nginx package. The
134
+ default value of 'epel' will use the `yum::epel` recipe, 'nginx' will use the
135
+ `nginx::repo` recipe, 'passenger' will use the 'nginx::repo_passenger' recipe, and setting no value will not add any additional repositories.
136
+ * `node['nginx']['sts_max_age']` - Enable Strict Transport Security for all apps (See: http://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security). This attribute adds the following header:
137
+
138
+ Strict-Transport-Security max-age=SECONDS
139
+
140
+ to all incoming requests and takes an integer (in seconds) as its argument.
141
+ * `node['nginx']['default']['modules']` - Array specifying which
142
+ modules to enable via the conf-enabled config include function.
143
+ Currently the only valid value is "socketproxy".
144
+
145
+ Other configurations
146
+
147
+ - `node['nginx']['extra_configs']` - a Hash of key/values to nginx configuration.
148
+
149
+ Rate Limiting
150
+
151
+ - `node['nginx']['enable_rate_limiting']` - set to true to enable rate
152
+ limiting (`limit_req_zone` in nginx.conf)
153
+ - `node['nginx']['rate_limiting_zone_name']` - sets the zone in
154
+ `limit_req_zone`.
155
+ - `node['nginx']['rate_limiting_backoff']` - sets the backoff time for
156
+ `limit_req_zone`.
157
+ - `node['nginx']['rate_limit']` - set the rate limit amount for
158
+ `limit_req_zone`.
159
+
160
+ ### gzip module
161
+
162
+ - `node['nginx']['gzip']` - Whether to use gzip, can be "on" or "off"
163
+ - `node['nginx']['gzip_http_version']` - used for config value of `gzip_http_version`.
164
+ - `node['nginx']['gzip_comp_level']` - used for config value of `gzip_comp_level`.
165
+ - `node['nginx']['gzip_proxied']` - used for config value of `gzip_proxied`.
166
+ - `node['nginx']['gzip_vary']` - used for config value of `gzip_vary`.
167
+ - `node['nginx']['gzip_buffers']` - used for config value of `gzip_buffers`.
168
+ - `node['nginx']['gzip_types']` - used for config value of `gzip_types` - must be an Array.
169
+ - `node['nginx']['gzip_min_length']` - used for config value of `gzip_min_length`.
170
+ - `node['nginx']['gzip_disable']` - used for config value of `gzip_disable`.
171
+ - `node['nginx']['gzip_static']` - used for config value of `gzip_static` (`http_gzip_static_module` must be enabled)
172
+ ### Attributes set in recipes
173
+
174
+ #### nginx::source
175
+ - `node['nginx']['daemon_disable']` - Whether the daemon should be
176
+ disabled which can be true or false; disable the daemon (run in the
177
+ foreground) when using a service supervisor such as runit or
178
+ bluepill for "init_style". This is automatically set in the
179
+ `nginx::source` recipe when the init style is not bluepill or runit.
180
+
181
+ #### nginx::authorized_ips
182
+ - `node['nginx']['remote_ip_var']` - The remote ip variable name to
183
+ use.
184
+ - `node['nginx']['authorized_ips']` - IPs authorized by the module
185
+
186
+ #### nginx::http_realip_module
187
+ From: http://nginx.org/en/docs/http/ngx_http_realip_module.html
188
+
189
+ - `node['nginx']['realip']['header']` - Header to use for the RealIp
190
+ Module; only accepts "X-Forwarded-For" or "X-Real-IP"
191
+ - `node['nginx']['realip']['addresses']` - Addresses to use for the
192
+ `http_realip` configuration.
193
+ - `node['nginx']['realip']['real_ip_recursive']` - If recursive search is enabled, the original client address that matches one of the trusted addresses is replaced by the last non-trusted address sent in the request header field. Can be on "on" or "off" (default).
194
+
195
+ ### source
196
+ These attributes are used in the `nginx::source` recipe. Some of them
197
+ are dynamically modified during the run. See `attributes/source.rb`
198
+ for default values.
199
+
200
+ - `node['nginx']['source']['url']` - (versioned) URL for the Nginx
201
+ source code. By default this will use the version specified as
202
+ `node['nginx']['version']`.
203
+ - `node['nginx']['source']['prefix']` - (versioned) prefix for
204
+ installing nginx from source
205
+ - `node['nginx']['source']['conf_path']` - location of the main config
206
+ file, in `node['nginx']['dir']` by default.
207
+ - `node['nginx']['source']['modules']` - Array of modules that should
208
+ be compiled into Nginx by including their recipes in
209
+ `nginx::source`.
210
+ - `node['nginx']['source']['default_configure_flags']` - The default
211
+ flags passed to the configure script when building Nginx.
212
+ - `node['nginx']['configure_flags']` - Preserved for compatibility and
213
+ dynamically generated from the
214
+ `node['nginx']['source']['default_configure_flags']` in the
215
+ `nginx::source` recipe.
216
+ * `node['nginx']['source']['use_existing_user']` - set to `true` if you
217
+ do not want `nginx::source` recipe to create system user with name
218
+ `node['nginx']['user']`.
219
+
220
+ ### geoip
221
+ These attributes are used in the `nginx::http_geoip_module` recipe.
222
+ Please note that the `country_dat_checksum` and `city_dat_checksum`
223
+ are based on downloads from a datacenter in Fremont, CA, USA. You
224
+ really should override these with checksums for the geo tarballs from
225
+ your node location.
226
+
227
+ **Note** The upstream, maxmind.com, may block access for repeated
228
+ downloads of the data files. It is recommended that you download and
229
+ host the data files, and change the URLs in the attributes.
230
+
231
+ - `node['nginx']['geoip']['path']` - Location where to install the
232
+ geoip libraries.
233
+ - `node['nginx']['geoip']['enable_city']` - Whether to enable City
234
+ data
235
+ - `node['nginx']['geoip']['country_dat_url']` - Country data tarball
236
+ URL
237
+ - `node['nginx']['geoip']['country_dat_checksum']` - Country data
238
+ tarball checksum
239
+ - `node['nginx']['geoip']['city_dat_url']` - City data tarball URL
240
+ - `node['nginx']['geoip']['city_dat_checksum']` - City data tarball
241
+ checksum
242
+ - `node['nginx']['geoip']['lib_version']` - Version of the GeoIP
243
+ library to install
244
+ - `node['nginx']['geoip']['lib_url']` - (Versioned) Tarball URL of the
245
+ GeoIP library
246
+ - `node['nginx']['geoip']['lib_checksum']` - Checksum of the GeoIP
247
+ library tarball
248
+
249
+ ### upload_progress
250
+ These attributes are used in the `nginx::upload_progress_module`
251
+ recipe.
252
+
253
+ - `node['nginx']['upload_progress']['url']` - URL for the tarball.
254
+ - `node['nginx']['upload_progress']['checksum']` - Checksum of the
255
+ tarball.
256
+ - `node['nginx']['upload_progress']['javascript_output']` - Output in javascript.
257
+ Default is `true` for backwards compatibility.
258
+ - `node['nginx']['upload_progress']['zone_name']` - Zone name which will
259
+ be used to store the per-connection tracking information.
260
+ Default is `proxied`.
261
+ - `node['nginx']['upload_progress']['zone_size']` - Zone size in bytes.
262
+ Default is `1m` (1 megabyte).
263
+
264
+ ### passenger
265
+ These attributes are used in the `nginx::passenger` recipe.
266
+
267
+ - `node['nginx']['passenger']['version']` - passenger gem version
268
+ - `node['nginx']['passenger']['root']` - passenger gem root path
269
+ - `node['nginx']['passenger']['install_rake']` - set to false if rake already present on system
270
+ - `node['nginx']['passenger']['max_pool_size']` - maximum passenger
271
+ pool size (default=10)
272
+ - `node['nginx']['passenger']['ruby']` - Ruby path for Passenger to
273
+ use (default=`$(which ruby)`)
274
+ - `node['nginx']['passenger']['spawn_method']` - passenger spawn
275
+ method to use (default=`smart-lv2`)
276
+ - `node['nginx']['passenger']['buffer_response']` - turns on or off
277
+ response buffering (default=`on`)
278
+ - `node['nginx']['passenger']['max_pool_size']` - passenger maximum
279
+ pool size (default=`6`)
280
+ - `node['nginx']['passenger']['min_instances']` - minimum instances
281
+ (default=`1`)
282
+ - `node['nginx']['passenger']['max_instances_per_app']` - maximum
283
+ instances per app (default=`0`)
284
+ - `node['nginx']['passenger']['pool_idle_time']` - passenger pool idle
285
+ time (default=`300`)
286
+ - `node['nginx']['passenger']['max_requests']` - maximum requests
287
+ (default=`0`)
288
+ - `node['nginx']['passenger']['nodejs']` - Nodejs path for Passenger to
289
+ use (default=nil)
290
+
291
+ Basic configuration to use the official Phusion Passenger repositories:
292
+ - `node['nginx']['repo_source']` - 'passenger'
293
+ - `node['nginx']['package_name']` - 'nginx-extras'
294
+ - `node['nginx']['passenger']['install_method']` - 'package'
295
+
296
+ ### echo
297
+ These attributes are used in the `nginx::http_echo_module` recipe.
298
+
299
+ - `node['nginx']['echo']['version']` - The version of `http_echo` you
300
+ want (default: 0.40)
301
+ - `node['nginx']['echo']['url']` - URL for the tarball.
302
+ - `node['nginx']['echo']['checksum']` - Checksum of the tarball.
303
+
304
+ ### status
305
+ These attributes are used in the `nginx::http_stub_status_module` recipe.
306
+
307
+ - `node['nginx']['status']['port']` - The port on which nginx will
308
+ serve the status info (default: 8090)
309
+
310
+ ### syslog
311
+ These attributes are used in the `nginx::syslog_module` recipe.
312
+
313
+ - `node['nginx']['syslog']['git_repo']` - The git repository url to use
314
+ for the syslog patches.
315
+ - `node['nginx']['syslog']['git_revision']` - The revision on the git
316
+ repository to checkout.
317
+
318
+ ### openssl_source
319
+ These attributes are used in the `nginx::openssl_source` recipe.
320
+
321
+ - `node['nginx']['openssl_source']['version']` - The version of OpenSSL
322
+ you want to download and use (default: 1.0.1e)
323
+ - `node['nginx']['openssl_source']['url']` - The url for the OpenSSL source
324
+
325
+
326
+ ## socketproxy.rb
327
+
328
+ These attributes are used in the `nginx::socketproxy` recipe.
329
+
330
+ * `node['nginx']['socketproxy']['root']` - The directory (on your server) where socketproxy apps are deployed.
331
+ * `node['nginx']['socketproxy']['default_app']` - Static assets directory for requests to "/" that don't meet any proxy_pass filter requirements.
332
+ * `node['nginx']['socketproxy']['apps']['app_name']['prepend_slash']` - Prepend a slash to requests to app "app_name" before sending them to the socketproxy socket.
333
+ * `node['nginx']['socketproxy']['apps']['app_name']['context_name']` - URI (e.g. "app_name" in order to achieve "http://mydomain.com/app_name") at which to host the application "app_name"
334
+ * `node['nginx']['socketproxy']['apps']['app_name']['subdir']` - Directory (under `node['nginx']['socketproxy']['root']`) in which to find the application.
335
+
336
+ Recipes
337
+ -------
338
+ This cookbook provides three main recipes for installing Nginx.
339
+
340
+ - `default.rb` - *Use this recipe* if you have a native package for
341
+ Nginx.
342
+ - `repo.rb` - The developer of Nginx also maintain
343
+ [stable packages](http://nginx.org/en/download.html) for several
344
+ platforms.
345
+ - `source.rb` - *Use this recipe* if you do not have a native package for
346
+ Nginx, or if you want to install a newer version than is available,
347
+ or if you have custom module compilation needs.
348
+
349
+ Several recipes are related to the `source` recipe specifically. See
350
+ that recipe's section below for a description.
351
+
352
+ ### default
353
+ The default recipe will install Nginx as a native package for the
354
+ system through the package manager and sets up the configuration
355
+ according to the Debian site enable/disable style with `sites-enabled`
356
+ using the `nxensite` and `nxdissite` scripts. The nginx service will
357
+ be managed with the normal init scripts that are presumably included
358
+ in the native package.
359
+
360
+ Includes the `ohai_plugin` recipe so the plugin is available.
361
+
362
+ ### socketproxy
363
+
364
+ This will add socketproxy support to your nginx proxy setup. Do not
365
+ include this recipe directly. Instead, add it to the
366
+ `node['nginx']['default']['modules']` array (see below).
367
+
368
+ ### ohai_plugin
369
+
370
+ This recipe provides an Ohai plugin as a template. It is included by
371
+ both the `default` and `source` recipes.
372
+
373
+ ### authorized_ips
374
+ Sets up configuration for the `authorized_ip` nginx module.
375
+
376
+ ### source
377
+ This recipe is responsible for building Nginx from source. It ensures
378
+ that the required packages to build Nginx are installed (pcre,
379
+ openssl, compile tools). The source will be downloaded from the
380
+ `node['nginx']['source']['url']`. The `node['nginx']['user']` will be
381
+ created as a system user. If you want to use existing user set
382
+ `node['nginx']['source']['use_existing_user']` to `true`. The appropriate
383
+ configuration and log directories and config files will be created
384
+ as well according to the attributes `node['nginx']['dir']` and
385
+ `node['nginx']['log_dir']`.
386
+
387
+ The recipe attempts to detect whether additional modules should be
388
+ added to the configure command through recipe inclusion (see below),
389
+ and whether the version or configuration flags have changed and should
390
+ trigger a recompile.
391
+
392
+ The nginx service will be set up according to
393
+ `node['nginx']['init_style']`. Available options are:
394
+
395
+ - runit: uses runit cookbook and sets up `runit_service`.
396
+ - bluepill: uses bluepill cookbook and sets up `bluepill_service`.
397
+ - anything else (e.g., "init") will use the nginx init script
398
+ template.
399
+
400
+ **RHEL/CentOS** This recipe should work on RHEL/CentOS with "init" as
401
+ the init style.
402
+
403
+ The following recipes are used to build module support into Nginx. To
404
+ use a module in the `nginx::source` recipe, add its recipe name to the
405
+ attribute `node['nginx']['source']['modules']`.
406
+
407
+ - `ipv6.rb` - enables IPv6 support
408
+ - `http_echo_module.rb` - downloads the `http_echo_module` module and
409
+ enables it as a module when compiling nginx.
410
+ - `http_geoip_module.rb` - installs the GeoIP libraries and data files
411
+ and enables the module for compilation.
412
+ - `http_gzip_static_module.rb` - enables the module for compilation. Be sure to set `node['nginx']['gzip_static'] = 'yes'`.
413
+ - `http_perl_module.rb` - enables embedded Perl for compilation.
414
+ - `http_realip_module.rb` - enables the module for compilation and
415
+ creates the configuration.
416
+ - `http_ssl_module.rb` - enables SSL for compilation.
417
+ - `http_stub_status_module.rb` - provides `nginx_status` configuration
418
+ and enables the module for compilation.
419
+ - `naxsi_module` - enables the naxsi module for the web application
420
+ firewall for nginx.
421
+ - `passenger` - builds the passenger gem and configuration for
422
+ "`mod_passenger`".
423
+ - `syslog` - enables syslog support for nginx. This only works with
424
+ source builds. See https://github.com/yaoweibin/nginx_syslog_patch
425
+ - `upload_progress_module.rb` - builds the `upload_progress` module
426
+ and enables it as a module when compiling nginx.
427
+ - `openssl_source.rb` - downloads and uses custom OpenSSL source
428
+ when compiling nginx
429
+
430
+ Definitions
431
+ -----------
432
+
433
+ The cookbook provides a new definition. At some point in the future this definition may be refactored into a lightweight resource and provider as suggested by [foodcritic rule FC015](http://acrmp.github.com/foodcritic/#FC015).
434
+
435
+ ### nginx\_site
436
+
437
+ Enable or disable a Server Block in
438
+ `#{node['nginx']['dir']}/sites-available` by calling nxensite or
439
+ nxdissite (introduced by this cookbook) to manage the symbolic link in
440
+ `#{node['nginx']['dir']}/sites-enabled`.
441
+
442
+ The template for the site must be managed as a separate resource.
443
+
444
+ ### Parameters:
445
+
446
+ * `name` - Name of the site.
447
+ * `enable` - Default true, which uses `nxensite` to enable the site. If false, the site will be disabled with `nxdissite`.
448
+
449
+
450
+ Adding New Modules
451
+ ------------------
452
+ To add a new module to be compiled into nginx in the source recipe,
453
+ the node's run state is manipulated in a recipe, and the module as a
454
+ recipe should be added to `node['nginx']['source']['modules']`. For
455
+ example:
456
+
457
+ ```ruby
458
+ node.run_state['nginx_configure_flags'] =
459
+ node.run_state['nginx_configure_flags'] | ['--with-http_stub_status_module']
460
+ ```
461
+
462
+ The recipe will be included by `recipe[nginx::source]` automatically,
463
+ adding the configure flags. Add any other configuration templates or
464
+ other resources as required. See the recipes described above for
465
+ examples.
466
+
467
+
468
+ Ohai Plugin
469
+ -----------
470
+ The `ohai_plugin` recipe includes an Ohai plugin. It will be
471
+ automatically installed and activated, providing the following
472
+ attributes via ohai, no matter how nginx is installed (source or
473
+ package):
474
+
475
+ - `node['nginx']['version']` - version of nginx
476
+ - `node['nginx']['configure_arguments']` - options passed to
477
+ `./configure` when nginx was built
478
+ - `node['nginx']['prefix']` - installation prefix
479
+ - `node['nginx']['conf_path']` - configuration file path
480
+
481
+ In the source recipe, it is used to determine whether control
482
+ attributes for building nginx have changed.
483
+
484
+
485
+ Usage
486
+ -----
487
+ Include the recipe on your node or role that fits how you wish to
488
+ install Nginx on your system per the recipes section above. Modify the
489
+ attributes as required in your role to change how various
490
+ configuration is applied per the attributes section above. In general,
491
+ override attributes in the role should be used when changing
492
+ attributes.
493
+
494
+ There's some redundancy in that the config handling hasn't been
495
+ separated from the installation method (yet), so use only one of the
496
+ recipes, default or source.
497
+
498
+
499
+ License & Authors
500
+ -----------------
501
+ - Author:: Joshua Timberman (<joshua@chef.io>)
502
+ - Author:: Adam Jacob (<adam@chef.io>)
503
+ - Author:: AJ Christensen (<aj@chef.io>)
504
+ - Author:: Jamie Winsor (<jamie@vialstudios.com>)
505
+ - Author:: Mike Fiedler (<miketheman@gmail.com>)
506
+
507
+ ```text
508
+ Copyright 2008-2014, Chef Software, Inc
509
+
510
+ Licensed under the Apache License, Version 2.0 (the "License");
511
+ you may not use this file except in compliance with the License.
512
+ You may obtain a copy of the License at
513
+
514
+ http://www.apache.org/licenses/LICENSE-2.0
515
+
516
+ Unless required by applicable law or agreed to in writing, software
517
+ distributed under the License is distributed on an "AS IS" BASIS,
518
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
519
+ See the License for the specific language governing permissions and
520
+ limitations under the License.
521
+ ```