vagrant-managed-servers 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. data/.gitignore +17 -0
  2. data/Berksfile +4 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +14 -0
  5. data/LICENSE +8 -0
  6. data/README.md +142 -0
  7. data/Rakefile +21 -0
  8. data/Vagrantfile +44 -0
  9. data/cookbooks/apache2/CHANGELOG.md +95 -0
  10. data/cookbooks/apache2/CONTRIBUTING.md +257 -0
  11. data/cookbooks/apache2/Gemfile +10 -0
  12. data/cookbooks/apache2/LICENSE +201 -0
  13. data/cookbooks/apache2/README.md +567 -0
  14. data/cookbooks/apache2/attributes/default.rb +149 -0
  15. data/cookbooks/apache2/attributes/mod_auth_cas.rb +2 -0
  16. data/cookbooks/apache2/attributes/mod_auth_openid.rb +32 -0
  17. data/cookbooks/apache2/definitions/apache_conf.rb +26 -0
  18. data/cookbooks/apache2/definitions/apache_module.rb +53 -0
  19. data/cookbooks/apache2/definitions/apache_site.rb +43 -0
  20. data/cookbooks/apache2/definitions/web_app.rb +49 -0
  21. data/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +41 -0
  22. data/cookbooks/apache2/files/default/tests/minitest/default_test.rb +77 -0
  23. data/cookbooks/apache2/files/default/tests/minitest/god_monitor_test.rb +34 -0
  24. data/cookbooks/apache2/files/default/tests/minitest/mod_apreq2_test.rb +19 -0
  25. data/cookbooks/apache2/files/default/tests/minitest/mod_auth_cas_test.rb +11 -0
  26. data/cookbooks/apache2/files/default/tests/minitest/mod_auth_openid_test.rb +37 -0
  27. data/cookbooks/apache2/files/default/tests/minitest/mod_cgi_test.rb +13 -0
  28. data/cookbooks/apache2/files/default/tests/minitest/mod_dav_svn_test.rb +14 -0
  29. data/cookbooks/apache2/files/default/tests/minitest/mod_fastcgi.rb +11 -0
  30. data/cookbooks/apache2/files/default/tests/minitest/mod_perl_test.rb +18 -0
  31. data/cookbooks/apache2/files/default/tests/minitest/mod_php5_test.rb +13 -0
  32. data/cookbooks/apache2/files/default/tests/minitest/mod_python_test.rb +10 -0
  33. data/cookbooks/apache2/files/default/tests/minitest/mod_ssl_test.rb +23 -0
  34. data/cookbooks/apache2/files/default/tests/minitest/support/helpers.rb +50 -0
  35. data/cookbooks/apache2/metadata.json +513 -0
  36. data/cookbooks/apache2/metadata.rb +207 -0
  37. data/cookbooks/apache2/recipes/default.rb +208 -0
  38. data/cookbooks/apache2/recipes/god_monitor.rb +33 -0
  39. data/cookbooks/apache2/recipes/logrotate.rb +29 -0
  40. data/cookbooks/apache2/recipes/mod_alias.rb +22 -0
  41. data/cookbooks/apache2/recipes/mod_apreq2.rb +54 -0
  42. data/cookbooks/apache2/recipes/mod_auth_basic.rb +20 -0
  43. data/cookbooks/apache2/recipes/mod_auth_cas.rb +59 -0
  44. data/cookbooks/apache2/recipes/mod_auth_digest.rb +20 -0
  45. data/cookbooks/apache2/recipes/mod_auth_openid.rb +111 -0
  46. data/cookbooks/apache2/recipes/mod_authn_file.rb +20 -0
  47. data/cookbooks/apache2/recipes/mod_authnz_ldap.rb +20 -0
  48. data/cookbooks/apache2/recipes/mod_authz_default.rb +20 -0
  49. data/cookbooks/apache2/recipes/mod_authz_groupfile.rb +20 -0
  50. data/cookbooks/apache2/recipes/mod_authz_host.rb +20 -0
  51. data/cookbooks/apache2/recipes/mod_authz_user.rb +20 -0
  52. data/cookbooks/apache2/recipes/mod_autoindex.rb +22 -0
  53. data/cookbooks/apache2/recipes/mod_cgi.rb +20 -0
  54. data/cookbooks/apache2/recipes/mod_dav.rb +20 -0
  55. data/cookbooks/apache2/recipes/mod_dav_fs.rb +21 -0
  56. data/cookbooks/apache2/recipes/mod_dav_svn.rb +41 -0
  57. data/cookbooks/apache2/recipes/mod_deflate.rb +22 -0
  58. data/cookbooks/apache2/recipes/mod_dir.rb +22 -0
  59. data/cookbooks/apache2/recipes/mod_env.rb +20 -0
  60. data/cookbooks/apache2/recipes/mod_expires.rb +20 -0
  61. data/cookbooks/apache2/recipes/mod_fastcgi.rb +26 -0
  62. data/cookbooks/apache2/recipes/mod_fcgid.rb +55 -0
  63. data/cookbooks/apache2/recipes/mod_headers.rb +20 -0
  64. data/cookbooks/apache2/recipes/mod_include.rb +20 -0
  65. data/cookbooks/apache2/recipes/mod_ldap.rb +20 -0
  66. data/cookbooks/apache2/recipes/mod_log_config.rb +24 -0
  67. data/cookbooks/apache2/recipes/mod_logio.rb +24 -0
  68. data/cookbooks/apache2/recipes/mod_mime.rb +22 -0
  69. data/cookbooks/apache2/recipes/mod_negotiation.rb +22 -0
  70. data/cookbooks/apache2/recipes/mod_perl.rb +44 -0
  71. data/cookbooks/apache2/recipes/mod_php5.rb +77 -0
  72. data/cookbooks/apache2/recipes/mod_proxy.rb +22 -0
  73. data/cookbooks/apache2/recipes/mod_proxy_ajp.rb +21 -0
  74. data/cookbooks/apache2/recipes/mod_proxy_balancer.rb +20 -0
  75. data/cookbooks/apache2/recipes/mod_proxy_connect.rb +20 -0
  76. data/cookbooks/apache2/recipes/mod_proxy_http.rb +20 -0
  77. data/cookbooks/apache2/recipes/mod_python.rb +38 -0
  78. data/cookbooks/apache2/recipes/mod_rewrite.rb +20 -0
  79. data/cookbooks/apache2/recipes/mod_setenvif.rb +22 -0
  80. data/cookbooks/apache2/recipes/mod_ssl.rb +46 -0
  81. data/cookbooks/apache2/recipes/mod_status.rb +22 -0
  82. data/cookbooks/apache2/recipes/mod_wsgi.rb +38 -0
  83. data/cookbooks/apache2/recipes/mod_xsendfile.rb +38 -0
  84. data/cookbooks/apache2/templates/default/a2dismod.erb +22 -0
  85. data/cookbooks/apache2/templates/default/a2dissite.erb +29 -0
  86. data/cookbooks/apache2/templates/default/a2enmod.erb +37 -0
  87. data/cookbooks/apache2/templates/default/a2ensite.erb +38 -0
  88. data/cookbooks/apache2/templates/default/apache2.conf.erb +237 -0
  89. data/cookbooks/apache2/templates/default/apache2.god.erb +19 -0
  90. data/cookbooks/apache2/templates/default/charset.erb +6 -0
  91. data/cookbooks/apache2/templates/default/default-site.erb +57 -0
  92. data/cookbooks/apache2/templates/default/mods/README +2 -0
  93. data/cookbooks/apache2/templates/default/mods/alias.conf.erb +24 -0
  94. data/cookbooks/apache2/templates/default/mods/auth_cas.conf.erb +1 -0
  95. data/cookbooks/apache2/templates/default/mods/auth_cas.load.erb +1 -0
  96. data/cookbooks/apache2/templates/default/mods/authopenid.load.erb +1 -0
  97. data/cookbooks/apache2/templates/default/mods/autoindex.conf.erb +101 -0
  98. data/cookbooks/apache2/templates/default/mods/deflate.conf.erb +16 -0
  99. data/cookbooks/apache2/templates/default/mods/dir.conf.erb +5 -0
  100. data/cookbooks/apache2/templates/default/mods/fastcgi.conf.erb +5 -0
  101. data/cookbooks/apache2/templates/default/mods/fcgid.conf.erb +10 -0
  102. data/cookbooks/apache2/templates/default/mods/mime.conf.erb +198 -0
  103. data/cookbooks/apache2/templates/default/mods/negotiation.conf.erb +18 -0
  104. data/cookbooks/apache2/templates/default/mods/php5.conf.erb +16 -0
  105. data/cookbooks/apache2/templates/default/mods/proxy.conf.erb +19 -0
  106. data/cookbooks/apache2/templates/default/mods/setenvif.conf.erb +28 -0
  107. data/cookbooks/apache2/templates/default/mods/ssl.conf.erb +76 -0
  108. data/cookbooks/apache2/templates/default/mods/status.conf.erb +26 -0
  109. data/cookbooks/apache2/templates/default/port_apache.erb +2 -0
  110. data/cookbooks/apache2/templates/default/ports.conf.erb +6 -0
  111. data/cookbooks/apache2/templates/default/security.erb +50 -0
  112. data/cookbooks/apache2/templates/default/web_app.conf.erb +43 -0
  113. data/cookbooks/apt/Berksfile +8 -0
  114. data/cookbooks/apt/CHANGELOG.md +97 -0
  115. data/cookbooks/apt/CONTRIBUTING +29 -0
  116. data/cookbooks/apt/LICENSE +201 -0
  117. data/cookbooks/apt/README.md +243 -0
  118. data/cookbooks/apt/TESTING.md +25 -0
  119. data/cookbooks/apt/attributes/default.rb +4 -0
  120. data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
  121. data/cookbooks/apt/metadata.json +1 -0
  122. data/cookbooks/apt/metadata.rb +30 -0
  123. data/cookbooks/apt/providers/preference.rb +61 -0
  124. data/cookbooks/apt/providers/repository.rb +132 -0
  125. data/cookbooks/apt/recipes/cacher-client.rb +59 -0
  126. data/cookbooks/apt/recipes/cacher-ng.rb +40 -0
  127. data/cookbooks/apt/recipes/default.rb +68 -0
  128. data/cookbooks/apt/resources/preference.rb +30 -0
  129. data/cookbooks/apt/resources/repository.rb +40 -0
  130. data/cookbooks/apt/templates/debian-6.0/acng.conf.erb +174 -0
  131. data/cookbooks/apt/templates/default/01proxy.erb +2 -0
  132. data/cookbooks/apt/templates/default/acng.conf.erb +276 -0
  133. data/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +270 -0
  134. data/dummy.box +0 -0
  135. data/lib/vagrant-managed-servers.rb +18 -0
  136. data/lib/vagrant-managed-servers/action.rb +114 -0
  137. data/lib/vagrant-managed-servers/action/is_created.rb +18 -0
  138. data/lib/vagrant-managed-servers/action/is_reachable.rb +18 -0
  139. data/lib/vagrant-managed-servers/action/link_server.rb +31 -0
  140. data/lib/vagrant-managed-servers/action/message_not_reachable.rb +16 -0
  141. data/lib/vagrant-managed-servers/action/read_state.rb +84 -0
  142. data/lib/vagrant-managed-servers/action/sync_folders.rb +85 -0
  143. data/lib/vagrant-managed-servers/action/unlink_server.rb +30 -0
  144. data/lib/vagrant-managed-servers/action/warn_networks.rb +19 -0
  145. data/lib/vagrant-managed-servers/config.rb +28 -0
  146. data/lib/vagrant-managed-servers/errors.rb +19 -0
  147. data/lib/vagrant-managed-servers/plugin.rb +72 -0
  148. data/lib/vagrant-managed-servers/provider.rb +51 -0
  149. data/lib/vagrant-managed-servers/util/timer.rb +17 -0
  150. data/lib/vagrant-managed-servers/version.rb +5 -0
  151. data/locales/en.yml +45 -0
  152. data/spec/vagrant-managed-servers/config_spec.rb +28 -0
  153. data/vagrant-managed-servers.gemspec +56 -0
  154. metadata +264 -0
@@ -0,0 +1,10 @@
1
+ source :rubygems
2
+
3
+ gem 'cucumber', '~> 1.1.8'
4
+ gem 'httparty', '~> 0.8.3'
5
+ gem 'minitest', '~> 3.0.0'
6
+ gem 'nokogiri', '~> 1.5.0'
7
+
8
+ group :kitchen do
9
+ gem 'test-kitchen'
10
+ end
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,567 @@
1
+ Description
2
+ ===========
3
+
4
+ This cookbook provides a complete Debian/Ubuntu style Apache HTTPD
5
+ configuration. Non-Debian based distributions such as Red Hat/CentOS,
6
+ ArchLinux and others supported by this cookbook will have a
7
+ configuration that mimics Debian/Ubuntu style as it is easier to
8
+ manage with Chef.
9
+
10
+ Debian-style Apache configuration uses scripts to manage modules and
11
+ sites (vhosts). The scripts are:
12
+
13
+ * a2ensite
14
+ * a2dissite
15
+ * a2enmod
16
+ * a2dismod
17
+
18
+ This cookbook ships with templates of these scripts for non
19
+ Debian/Ubuntu platforms. The scripts are used in the __Definitions__
20
+ below.
21
+
22
+ Requirements
23
+ ============
24
+
25
+ ## Ohai and Chef:
26
+
27
+ * Ohai: 0.6.12+
28
+ * Chef: 0.10.10+
29
+
30
+ As of v1.2.0, this cookbook makes use of `node['platform_family']` to
31
+ simplify platform selection logic. This attribute was introduced in
32
+ Ohai v0.6.12. The recipe methods were introduced in Chef v0.10.10. If
33
+ you must run an older version of Chef or Ohai, use [version 1.1.16 of
34
+ this cookbook](http://community.opscode.com/cookbooks/apache2/versions/1_1_16/downloads).
35
+
36
+ ## Cookbooks:
37
+
38
+ This cookbook doesn't have direct dependencies on other cookbooks, as
39
+ none are needed for the default recipe or the general use cases.
40
+
41
+ Depending on your OS configuration and security policy, you may need
42
+ additional recipes or cookbooks for this cookbook's recipes to
43
+ converge on the node. In particular, the following Operating System
44
+ settings may affect the behavior of this cookbook:
45
+
46
+ * apt cache outdated
47
+ * SELinux enabled
48
+ * IPtables
49
+ * Compile tools
50
+ * 3rd party repositories
51
+
52
+ On Ubuntu/Debian, use Opscode's `apt` cookbook to ensure the package
53
+ cache is updated so Chef can install packages, or consider putting
54
+ apt-get in your bootstrap process or
55
+ [knife bootstrap template](http://wiki.opscode.com/display/chef/Knife+Bootstrap).
56
+
57
+ On RHEL, SELinux is enabled by default. The `selinux` cookbook
58
+ contains a `permissive` recipe that can be used to set SELinux to
59
+ "Permissive" state. Otherwise, additional recipes need to be created
60
+ by the user to address SELinux permissions.
61
+
62
+ The easiest but **certainly not ideal way** to deal with IPtables is
63
+ to flush all rules. Opscode does provide an `iptables` cookbook but is
64
+ migrating from the approach used there to a more robust solution
65
+ utilizing a general "firewall" LWRP that would have an "iptables"
66
+ provider. Alternately, you can use ufw, with Opscode's `ufw` and
67
+ `firewall` cookbooks to set up rules. See those cookbooks' READMEs for
68
+ documentation.
69
+
70
+ Build/compile tools may not be installed on the system by default.
71
+ Some recipes (e.g., `apache2::mod_auth_openid`) build the module from
72
+ source. Use Opscode's `build-essential` cookbook to get essential
73
+ build packages installed.
74
+
75
+ On ArchLinux, if you are using the `apache2::mod_auth_openid` recipe,
76
+ you also need the `pacman` cookbook for the `pacman_aur` LWRP. Put
77
+ `recipe[pacman]` on the node's expanded run list (on the node or in a
78
+ role). This is not an explicit dependency because it is only required
79
+ for this single recipe and platform; the pacman default recipe
80
+ performs `pacman -Sy` to keep pacman's package cache updated.
81
+
82
+ The `apache2::god_monitor` recipe uses a definition from the `god`
83
+ cookbook. Include `recipe[god]` in the node's expanded run list to
84
+ ensure that the cookbook is available to the node, and to set up `god`.
85
+
86
+ ## Platforms:
87
+
88
+ The following platforms and versions are tested and supported using
89
+ Opscode's [test-kitchen](http://github.com/opscode/test-kitchen).
90
+
91
+ * Ubuntu 10.04, 12.04
92
+ * CentOS 5.8, 6.3
93
+
94
+ The following platform families are supported in the code, and are
95
+ assumed to work based on the successful testing on Ubuntu and CentOS.
96
+
97
+ * Debian
98
+ * Red Hat (rhel)
99
+ * Fedora
100
+ * Amazon Linux
101
+
102
+ The following platforms are also supported in the code, have been
103
+ tested manually but are not tested under test-kitchen.
104
+
105
+ * SUSE/OpenSUSE
106
+ * ArchLinux
107
+ * FreeBSD
108
+
109
+ ### Notes for RHEL Family:
110
+
111
+ On Red Hat Enterprise Linux and derivatives, the EPEL repository may
112
+ be necessary to install packages used in certain recipes. The
113
+ `apache2::default` recipe, however, does not require any additional
114
+ repositories. Opscode's `yum` cookbook contains a recipe to add the
115
+ EPEL repository. See __Examples__ for more information.
116
+
117
+ ### Notes for FreeBSD:
118
+
119
+ The `apache2::mod_php5` recipe depends on the `freebsd` cookbook,
120
+ which it uses to set the correct options for compiling the `php5` port
121
+ from sources. You need to ensure the `freebsd` is in the expanded run
122
+ list, or this recipe will fail. We don't set an explicit dependency
123
+ because we feel the `freebsd` cookbook is something users would want
124
+ on their nodes, and due to the generality of this cookbook we don't
125
+ want additional specific dependencies.
126
+
127
+ Tests
128
+ =====
129
+
130
+ This cookbook in the
131
+ [source repository](https://github.com/opscode-cookbooks/apache2)
132
+ contains minitest and cucumber tests. This is an initial proof of
133
+ concept that will be fleshed out with more supporting infrastructure
134
+ at a future time.
135
+
136
+ Please see the CONTRIBUTING file for information on how to add tests
137
+ for your contributions.
138
+
139
+ Attributes
140
+ ==========
141
+
142
+ This cookbook uses many attributes, broken up into a few different
143
+ kinds.
144
+
145
+ Platform specific
146
+ -----------------
147
+
148
+ In order to support the broadest number of platforms, several
149
+ attributes are determined based on the node's platform. See the
150
+ attributes/default.rb file for default values in the case statement at
151
+ the top of the file.
152
+
153
+ * `node['apache']['dir']` - Location for the Apache configuration
154
+ * `node['apache']['log_dir']` - Location for Apache logs
155
+ * `node['apache']['user']` - User Apache runs as
156
+ * `node['apache']['group']` - Group Apache runs as
157
+ * `node['apache']['binary']` - Apache httpd server daemon
158
+ * `node['apache']['icondir']` - Location for icons
159
+ * `node['apache']['cache_dir']` - Location for cached files used by Apache itself or recipes
160
+ * `node['apache']['pid_file']` - Location of the PID file for Apache httpd
161
+ * `node['apache']['lib_dir']` - Location for shared libraries
162
+ * `node['apache']['default_site_enabled']` - Default site enabled. Defaults to true on redhat-family platforms
163
+ * `node['apache']['ext_status']` - if true, enables ExtendedStatus for `mod_status`
164
+
165
+ General settings
166
+ ----------------
167
+
168
+ These are general settings used in recipes and templates. Default
169
+ values are noted.
170
+
171
+ * `node['apache']['listen_ports']` - Ports that httpd should listen on. Default is an array of ports 80 and 443.
172
+ * `node['apache']['contact']` - Value for ServerAdmin directive. Default "ops@example.com".
173
+ * `node['apache']['timeout']` - Value for the Timeout directive. Default is 300.
174
+ * `node['apache']['keepalive']` - Value for the KeepAlive directive. Default is On.
175
+ * `node['apache']['keepaliverequests']` - Value for MaxKeepAliveRequests. Default is 100.
176
+ * `node['apache']['keepalivetimeout']` - Value for the KeepAliveTimeout directive. Default is 5.
177
+ * `node['apache']['default_modules']` - Array of module names. Can take "mod_FOO" or "FOO" as names, where FOO is the apache module, e.g. "`mod_status`" or "`status`".
178
+
179
+ The modules listed in `default_modules` will be included as recipes in `recipe[apache::default]`.
180
+
181
+ Prefork attributes
182
+ ------------------
183
+
184
+ Prefork attributes are used for tuning the Apache HTTPD prefork MPM
185
+ configuration.
186
+
187
+ * `node['apache']['prefork']['startservers']` - initial number of server processes to start. Default is 16.
188
+ * `node['apache']['prefork']['minspareservers']` - minimum number of spare server processes. Default 16.
189
+ * `node['apache']['prefork']['maxspareservers']` - maximum number of spare server processes. Default 32.
190
+ * `node['apache']['prefork']['serverlimit']` - upper limit on configurable server processes. Default 400.
191
+ * `node['apache']['prefork']['maxclients']` - Maximum number of simultaneous connections.
192
+ * `node['apache']['prefork']['maxrequestsperchild']` - Maximum number of request a child process will handle. Default 10000.
193
+
194
+ Worker attributes
195
+ -----------------
196
+
197
+ Worker attributes are used for tuning the Apache HTTPD worker MPM
198
+ configuration.
199
+
200
+ * `node['apache']['worker']['startservers']` - Initial number of server processes to start. Default 4
201
+ * `node['apache']['worker']['maxclients']` - Maximum number of simultaneous connections. Default 1024.
202
+ * `node['apache']['worker']['minsparethreads']` - Minimum number of spare worker threads. Default 64
203
+ * `node['apache']['worker']['maxsparethreads']` - Maximum number of spare worker threads. Default 192.
204
+ * `node['apache']['worker']['maxrequestsperchild']` - Maximum number of requests a child process will handle.
205
+
206
+ mod\_auth\_openid attributes
207
+ ----------------------------
208
+
209
+ The following attributes are in the `attributes/mod_auth_openid.rb`
210
+ file. Like all Chef attributes files, they are loaded as well, but
211
+ they're logistically unrelated to the others, being specific to the
212
+ `mod_auth_openid` recipe.
213
+
214
+ * `node['apache']['mod_auth_openid']['checksum']` - sha256sum of the tarball containing the source.
215
+ * `node['apache']['mod_auth_openid']['version']` - version of the `mod_auth_openid` to download.
216
+ * `node['apache']['mod_auth_openid']['cache_dir']` - the cache directory is where the sqlite3 database is stored. It is separate so it can be managed as a directory resource.
217
+ * `node['apache']['mod_auth_openid']['dblocation']` - filename of the sqlite3 database used for directive `AuthOpenIDDBLocation`, stored in the `cache_dir` by default.
218
+ * `node['apache']['mod_auth_openid']['configure_flags']` - optional array of configure flags passed to the `./configure` step in the compilation of the module.
219
+
220
+ Recipes
221
+ =======
222
+
223
+ Most of the recipes in the cookbook are for enabling Apache modules.
224
+ Where additional configuration or behavior is used, it is documented
225
+ below in more detail.
226
+
227
+ The following recipes merely enable the specified module: `mod_alias`,
228
+ `mod_basic`, `mod_digest`, `mod_authn_file`, `mod_authnz_ldap`,
229
+ `mod_authz_default`, `mod_authz_groupfile`, `mod_authz_host`,
230
+ `mod_authz_user`, `mod_autoindex`, `mod_cgi`, `mod_dav_fs`,
231
+ `mod_dav_svn`, `mod_deflate`, `mod_dir`, `mod_env`, `mod_expires`,
232
+ `mod_headers`, `mod_ldap`, `mod_log_config`, `mod_mime`,
233
+ `mod_negotiation`, `mod_proxy`, `mod_proxy_ajp`, `mod_proxy_balancer`,
234
+ `mod_proxy_connect`, `mod_proxy_http`, `mod_python`, `mod_rewrite`,
235
+ `mod_setenvif`, `mod_status`, `mod_wsgi`, `mod_xsendfile`.
236
+
237
+ On RHEL Family distributions, certain modules ship with a config file
238
+ with the package. The recipes here may delete those configuration
239
+ files to ensure they don't conflict with the settings from the
240
+ cookbook, which will use per-module configuration in
241
+ `/etc/httpd/mods-enabled`.
242
+
243
+ default
244
+ -------
245
+
246
+ The default recipe does a number of things to set up Apache HTTPd. It
247
+ also includes a number of modules based on the attribute
248
+ `node['apache']['default_modules']` as recipes.
249
+
250
+ logrotate
251
+ ---------
252
+
253
+ Logrotate adds a logrotate entry for your apache2 logs. This recipe
254
+ requires the `logrotate` cookbook; ensure that `recipe[logrotate]` is
255
+ in the node's expanded run list.
256
+
257
+ mod\_auth\_cas
258
+ --------------
259
+
260
+ This recipe installs the proper package and enables the `auth_cas`
261
+ module. It can install from source or package. Package is the default,
262
+ set the attribute `node['apache']['mod_auth_cas']['from_source']` to
263
+ true to enable source installation. Modify the version to install by
264
+ changing the attribute
265
+ `node['apache']['mod_auth_cas']['source_revision']`. It is a version
266
+ tag by default, but could be master, or another tag, or branch.
267
+
268
+ The module configuration is written out with the `CASCookiePath` set,
269
+ otherwise an error loading the module may cause Apache to not start.
270
+
271
+ **Note**: This recipe does not work on EL 6 platforms unless
272
+ epel-testing repository is enabled (outside the scope of this
273
+ cookbook), or the package version 1.0.8.1-3.el6 or higher is otherwise
274
+ available to the system due to this bug:
275
+
276
+ https://bugzilla.redhat.com/show_bug.cgi?format=multiple&id=708550
277
+
278
+ mod\_auth\_openid
279
+ -----------------
280
+
281
+ **Changed via COOK-915**
282
+
283
+ This recipe compiles the module from source. In addition to
284
+ `build-essential`, some other packages are included for installation
285
+ like the GNU C++ compiler and development headers.
286
+
287
+ To use the module in your own cookbooks to authenticate systems using
288
+ OpenIDs, specify an array of OpenIDs that are allowed to authenticate
289
+ with the attribute `node['apache']['allowed_openids']`. Use the
290
+ following in a vhost to protect with OpenID authentication:
291
+
292
+ AuthType OpenID require user <%= node['apache']['allowed_openids'].join(' ') %>
293
+ AuthOpenIDDBLocation <%= node['apache']['mod_auth_openid']['dblocation'] %>
294
+
295
+ Change the DBLocation with the attribute as required; this file is in
296
+ a different location than previous versions, see below. It should be a
297
+ sane default for most platforms, though, see
298
+ `attributes/mod_auth_openid.rb`.
299
+
300
+ ### Changes from COOK-915:
301
+
302
+ * `AuthType OpenID` instead of `AuthOpenIDEnabled On`.
303
+ * `require user` instead of `AuthOpenIDUserProgram`.
304
+ * A bug(?) in `mod_auth_openid` causes it to segfault when attempting
305
+ to update the database file if the containing directory is not
306
+ writable by the HTTPD process owner (e.g., www-data), even if the
307
+ file is writable. In order to not interfere with other settings from
308
+ the default recipe in this cookbook, the db file is moved.
309
+
310
+ mod\_fastcgi
311
+ ------------
312
+
313
+ Install the fastcgi package and enable the module.
314
+
315
+ Only work on Debian/Ubuntu
316
+
317
+ mod\_fcgid
318
+ ----------
319
+
320
+ Installs the fcgi package and enables the module. Requires EPEL on
321
+ RHEL family.
322
+
323
+ On RHEL family, this recipe will delete the fcgid.conf and on version
324
+ 6+, create the /var/run/httpd/mod_fcgid` directory, which prevents the
325
+ emergency error:
326
+
327
+ [emerg] (2)No such file or directory: mod_fcgid: Can't create shared memory for size XX bytes
328
+
329
+ mod\_php5
330
+ --------
331
+
332
+ Simply installs the appropriate package on Debian, Ubuntu and
333
+ ArchLinux.
334
+
335
+ On Red Hat family distributions including Fedora, the php.conf that
336
+ comes with the package is removed. On RHEL platforms less than v6, the
337
+ `php53` package is used.
338
+
339
+ mod\_ssl
340
+ --------
341
+
342
+ Besides installing and enabling `mod_ssl`, this recipe will append
343
+ port 443 to the `node['apache']['listen_ports']` attribute array and
344
+ update the ports.conf.
345
+
346
+ god\_monitor
347
+ ------------
348
+
349
+ Sets up a `god` monitor for Apache. External requirements are the
350
+ `god` and `runit` cookbooks from Opscode. When using this recipe,
351
+ include `recipe[god]` in the node's expanded run list to ensure the
352
+ client downloads it; `god` depends on runit so that will also be
353
+ downloaded.
354
+
355
+ **Note** This recipe is not tested under test-kitchen yet and is
356
+ pending fix in COOK-744.
357
+
358
+ Definitions
359
+ ===========
360
+
361
+ The cookbook provides a few definitions. At some point in the future
362
+ these definitions may be refactored into lightweight resources and
363
+ providers as suggested by
364
+ [foodcritic rule FC015](http://acrmp.github.com/foodcritic/#FC015).
365
+
366
+ apache\_conf
367
+ ------------
368
+
369
+ Sets up configuration file for an Apache module from a template. The
370
+ template should be in the same cookbook where the definition is used.
371
+ This is used by the `apache_module` definition and is not often used
372
+ directly.
373
+
374
+ This will use a template resource to write the module's configuration
375
+ file in the `mods-available` under the Apache configuration directory
376
+ (`node['apache']['dir']`). This is a platform-dependent location. See
377
+ __apache\_module__.
378
+
379
+ ### Parameters:
380
+
381
+ * `name` - Name of the template. When used from the `apache_module`,
382
+ it will use the same name as the module.
383
+
384
+ ### Examples:
385
+
386
+ Create `#{node['apache']['dir']}/mods-available/alias.conf`.
387
+
388
+ apache_conf "alias"
389
+
390
+ apache\_module
391
+ --------------
392
+
393
+ Enable or disable an Apache module in
394
+ `#{node['apache']['dir']}/mods-available` by calling `a2enmod` or
395
+ `a2dismod` to manage the symbolic link in
396
+ `#{node['apache']['dir']}/mods-enabled`. If the module has a
397
+ configuration file, a template should be created in the cookbook where
398
+ the definition is used. See __Examples__.
399
+
400
+ ### Parameters:
401
+
402
+ * `name` - Name of the module enabled or disabled with the `a2enmod` or `a2dismod` scripts.
403
+ * `enable` - Default true, which uses `a2enmod` to enable the module. If false, the module will be disabled with `a2dismod`.
404
+ * `conf` - Default false. Set to true if the module has a config file, which will use `apache_conf` for the file.
405
+ * `filename` - specify the full name of the file, e.g.
406
+
407
+ ### Examples:
408
+
409
+ Enable the ssl module, which also has a configuration template in `templates/default/ssl.conf.erb`.
410
+
411
+ apache_module "ssl" do
412
+ conf true
413
+ end
414
+
415
+ Enable the php5 module, which has a different filename than the module default:
416
+
417
+ apache_module "php5" do
418
+ filename "libphp5.so"
419
+ end
420
+
421
+ Disable a module:
422
+
423
+ apache_module "disabled_module" do
424
+ enable false
425
+ end
426
+
427
+ See the recipes directory for many more examples of `apache_module`.
428
+
429
+ apache\_site
430
+ ------------
431
+
432
+ Enable or disable a VirtualHost in
433
+ `#{node['apache']['dir']}/sites-available` by calling a2ensite or
434
+ a2dissite to manage the symbolic link in
435
+ `#{node['apache']['dir']}/sites-enabled`.
436
+
437
+ The template for the site must be managed as a separate resource. To
438
+ combine the template with enabling a site, see `web_app`.
439
+
440
+ ### Parameters:
441
+
442
+ * `name` - Name of the site.
443
+ * `enable` - Default true, which uses `a2ensite` to enable the site. If false, the site will be disabled with `a2dissite`.
444
+
445
+ web\_app
446
+ --------
447
+
448
+ Manage a template resource for a VirtualHost site, and enable it with
449
+ `apache_site`. This is commonly done for managing web applications
450
+ such as Ruby on Rails, PHP or Django, and the default behavior
451
+ reflects that. However it is flexible.
452
+
453
+ This definition includes some recipes to make sure the system is
454
+ configured to have Apache and some sane default modules:
455
+
456
+ * `apache2`
457
+ * `apache2::mod_rewrite`
458
+ * `apache2::mod_deflate`
459
+ * `apache2::mod_headers`
460
+
461
+ It will then configure the template (see __Parameters__ and
462
+ __Examples__ below), and enable or disable the site per the `enable`
463
+ parameter.
464
+
465
+ ### Parameters:
466
+
467
+ Current parameters used by the definition:
468
+
469
+ * `name` - The name of the site. The template will be written to
470
+ `#{node['apache']['dir']}/sites-available/#{params['name']}.conf`
471
+ * `cookbook` - Optional. Cookbook where the source template is. If
472
+ this is not defined, Chef will use the named template in the
473
+ cookbook where the definition is used.
474
+ * `template` - Default `web_app.conf.erb`, source template file.
475
+ * `enable` - Default true. Passed to the `apache_site` definition.
476
+
477
+ Additional parameters can be defined when the definition is called in
478
+ a recipe, see __Examples__.
479
+
480
+ ### Examples:
481
+
482
+ All parameters are passed into the template. You can use whatever you
483
+ like. The apache2 cookbook comes with a `web_app.conf.erb` template as
484
+ an example. The following parameters are used in the template:
485
+
486
+ * `server_name` - ServerName directive.
487
+ * `server_aliases` - ServerAlias directive. Must be an array of aliases.
488
+ * `docroot` - DocumentRoot directive.
489
+ * `application_name` - Used in RewriteLog directive. Will be set to the `name` parameter.
490
+
491
+ To use the default web_app, for example:
492
+
493
+ web_app "my_site" do
494
+ server_name node['hostname']
495
+ server_aliases [node['fqdn'], "my-site.example.com"]
496
+ docroot "/srv/www/my_site"
497
+ end
498
+
499
+ The parameters specified will be used as:
500
+
501
+ * `@params[:server_name]`
502
+ * `@params[:server_aliases]`
503
+ * `@params[:docroot]`
504
+
505
+ In the template. When you write your own, the `@` is significant.
506
+
507
+ For more information about Definitions and parameters, see the
508
+ [Chef Wiki](http://wiki.opscode.com/display/chef/Definitions)
509
+
510
+ Usage
511
+ =====
512
+
513
+ Using this cookbook is relatively straightforward. Add the desired
514
+ recipes to the run list of a node, or create a role. Depending on your
515
+ environment, you may have multiple roles that use different recipes
516
+ from this cookbook. Adjust any attributes as desired. For example, to
517
+ create a basic role for web servers that provide both HTTP and HTTPS:
518
+
519
+ % cat roles/webserver.rb
520
+ name "webserver"
521
+ description "Systems that serve HTTP and HTTPS"
522
+ run_list(
523
+ "recipe[apache2]",
524
+ "recipe[apache2::mod_ssl]"
525
+ )
526
+ default_attributes(
527
+ "apache2" => {
528
+ "listen_ports" => ["80", "443"]
529
+ }
530
+ )
531
+
532
+ For examples of using the definitions in your own recipes, see their
533
+ respective sections above.
534
+
535
+ License and Authors
536
+ ===================
537
+
538
+ * Author:: Adam Jacob <adam@opscode.com>
539
+ * Author:: Joshua Timberman <joshua@opscode.com>
540
+ * Author:: Bryan McLellan <bryanm@widemile.com>
541
+ * Author:: Dave Esposito <esposito@espolinux.corpnet.local>
542
+ * Author:: David Abdemoulaie <github@hobodave.com>
543
+ * Author:: Edmund Haselwanter <edmund@haselwanter.com>
544
+ * Author:: Eric Rochester <err8n@virginia.edu>
545
+ * Author:: Jim Browne <jbrowne@42lines.net>
546
+ * Author:: Matthew Kent <mkent@magoazul.com>
547
+ * Author:: Nathen Harvey <nharvey@customink.com>
548
+ * Author:: Ringo De Smet <ringo.de.smet@amplidata.com>
549
+ * Author:: Sean OMeara <someara@opscode.com>
550
+ * Author:: Seth Chisamore <schisamo@opscode.com>
551
+ * Author:: Gilles Devaux <gilles@peerpong.com>
552
+
553
+ * Copyright:: 2009-2012, Opscode, Inc
554
+ * Copyright:: 2011, Atriso
555
+ * Copyright:: 2011, CustomInk, LLC.
556
+
557
+ Licensed under the Apache License, Version 2.0 (the "License");
558
+ you may not use this file except in compliance with the License.
559
+ You may obtain a copy of the License at
560
+
561
+ http://www.apache.org/licenses/LICENSE-2.0
562
+
563
+ Unless required by applicable law or agreed to in writing, software
564
+ distributed under the License is distributed on an "AS IS" BASIS,
565
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
566
+ See the License for the specific language governing permissions and
567
+ limitations under the License.