vagrant-managed-servers 0.1.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.
- data/.gitignore +17 -0
- data/Berksfile +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +14 -0
- data/LICENSE +8 -0
- data/README.md +142 -0
- data/Rakefile +21 -0
- data/Vagrantfile +44 -0
- data/cookbooks/apache2/CHANGELOG.md +95 -0
- data/cookbooks/apache2/CONTRIBUTING.md +257 -0
- data/cookbooks/apache2/Gemfile +10 -0
- data/cookbooks/apache2/LICENSE +201 -0
- data/cookbooks/apache2/README.md +567 -0
- data/cookbooks/apache2/attributes/default.rb +149 -0
- data/cookbooks/apache2/attributes/mod_auth_cas.rb +2 -0
- data/cookbooks/apache2/attributes/mod_auth_openid.rb +32 -0
- data/cookbooks/apache2/definitions/apache_conf.rb +26 -0
- data/cookbooks/apache2/definitions/apache_module.rb +53 -0
- data/cookbooks/apache2/definitions/apache_site.rb +43 -0
- data/cookbooks/apache2/definitions/web_app.rb +49 -0
- data/cookbooks/apache2/files/default/apache2_module_conf_generate.pl +41 -0
- data/cookbooks/apache2/files/default/tests/minitest/default_test.rb +77 -0
- data/cookbooks/apache2/files/default/tests/minitest/god_monitor_test.rb +34 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_apreq2_test.rb +19 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_auth_cas_test.rb +11 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_auth_openid_test.rb +37 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_cgi_test.rb +13 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_dav_svn_test.rb +14 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_fastcgi.rb +11 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_perl_test.rb +18 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_php5_test.rb +13 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_python_test.rb +10 -0
- data/cookbooks/apache2/files/default/tests/minitest/mod_ssl_test.rb +23 -0
- data/cookbooks/apache2/files/default/tests/minitest/support/helpers.rb +50 -0
- data/cookbooks/apache2/metadata.json +513 -0
- data/cookbooks/apache2/metadata.rb +207 -0
- data/cookbooks/apache2/recipes/default.rb +208 -0
- data/cookbooks/apache2/recipes/god_monitor.rb +33 -0
- data/cookbooks/apache2/recipes/logrotate.rb +29 -0
- data/cookbooks/apache2/recipes/mod_alias.rb +22 -0
- data/cookbooks/apache2/recipes/mod_apreq2.rb +54 -0
- data/cookbooks/apache2/recipes/mod_auth_basic.rb +20 -0
- data/cookbooks/apache2/recipes/mod_auth_cas.rb +59 -0
- data/cookbooks/apache2/recipes/mod_auth_digest.rb +20 -0
- data/cookbooks/apache2/recipes/mod_auth_openid.rb +111 -0
- data/cookbooks/apache2/recipes/mod_authn_file.rb +20 -0
- data/cookbooks/apache2/recipes/mod_authnz_ldap.rb +20 -0
- data/cookbooks/apache2/recipes/mod_authz_default.rb +20 -0
- data/cookbooks/apache2/recipes/mod_authz_groupfile.rb +20 -0
- data/cookbooks/apache2/recipes/mod_authz_host.rb +20 -0
- data/cookbooks/apache2/recipes/mod_authz_user.rb +20 -0
- data/cookbooks/apache2/recipes/mod_autoindex.rb +22 -0
- data/cookbooks/apache2/recipes/mod_cgi.rb +20 -0
- data/cookbooks/apache2/recipes/mod_dav.rb +20 -0
- data/cookbooks/apache2/recipes/mod_dav_fs.rb +21 -0
- data/cookbooks/apache2/recipes/mod_dav_svn.rb +41 -0
- data/cookbooks/apache2/recipes/mod_deflate.rb +22 -0
- data/cookbooks/apache2/recipes/mod_dir.rb +22 -0
- data/cookbooks/apache2/recipes/mod_env.rb +20 -0
- data/cookbooks/apache2/recipes/mod_expires.rb +20 -0
- data/cookbooks/apache2/recipes/mod_fastcgi.rb +26 -0
- data/cookbooks/apache2/recipes/mod_fcgid.rb +55 -0
- data/cookbooks/apache2/recipes/mod_headers.rb +20 -0
- data/cookbooks/apache2/recipes/mod_include.rb +20 -0
- data/cookbooks/apache2/recipes/mod_ldap.rb +20 -0
- data/cookbooks/apache2/recipes/mod_log_config.rb +24 -0
- data/cookbooks/apache2/recipes/mod_logio.rb +24 -0
- data/cookbooks/apache2/recipes/mod_mime.rb +22 -0
- data/cookbooks/apache2/recipes/mod_negotiation.rb +22 -0
- data/cookbooks/apache2/recipes/mod_perl.rb +44 -0
- data/cookbooks/apache2/recipes/mod_php5.rb +77 -0
- data/cookbooks/apache2/recipes/mod_proxy.rb +22 -0
- data/cookbooks/apache2/recipes/mod_proxy_ajp.rb +21 -0
- data/cookbooks/apache2/recipes/mod_proxy_balancer.rb +20 -0
- data/cookbooks/apache2/recipes/mod_proxy_connect.rb +20 -0
- data/cookbooks/apache2/recipes/mod_proxy_http.rb +20 -0
- data/cookbooks/apache2/recipes/mod_python.rb +38 -0
- data/cookbooks/apache2/recipes/mod_rewrite.rb +20 -0
- data/cookbooks/apache2/recipes/mod_setenvif.rb +22 -0
- data/cookbooks/apache2/recipes/mod_ssl.rb +46 -0
- data/cookbooks/apache2/recipes/mod_status.rb +22 -0
- data/cookbooks/apache2/recipes/mod_wsgi.rb +38 -0
- data/cookbooks/apache2/recipes/mod_xsendfile.rb +38 -0
- data/cookbooks/apache2/templates/default/a2dismod.erb +22 -0
- data/cookbooks/apache2/templates/default/a2dissite.erb +29 -0
- data/cookbooks/apache2/templates/default/a2enmod.erb +37 -0
- data/cookbooks/apache2/templates/default/a2ensite.erb +38 -0
- data/cookbooks/apache2/templates/default/apache2.conf.erb +237 -0
- data/cookbooks/apache2/templates/default/apache2.god.erb +19 -0
- data/cookbooks/apache2/templates/default/charset.erb +6 -0
- data/cookbooks/apache2/templates/default/default-site.erb +57 -0
- data/cookbooks/apache2/templates/default/mods/README +2 -0
- data/cookbooks/apache2/templates/default/mods/alias.conf.erb +24 -0
- data/cookbooks/apache2/templates/default/mods/auth_cas.conf.erb +1 -0
- data/cookbooks/apache2/templates/default/mods/auth_cas.load.erb +1 -0
- data/cookbooks/apache2/templates/default/mods/authopenid.load.erb +1 -0
- data/cookbooks/apache2/templates/default/mods/autoindex.conf.erb +101 -0
- data/cookbooks/apache2/templates/default/mods/deflate.conf.erb +16 -0
- data/cookbooks/apache2/templates/default/mods/dir.conf.erb +5 -0
- data/cookbooks/apache2/templates/default/mods/fastcgi.conf.erb +5 -0
- data/cookbooks/apache2/templates/default/mods/fcgid.conf.erb +10 -0
- data/cookbooks/apache2/templates/default/mods/mime.conf.erb +198 -0
- data/cookbooks/apache2/templates/default/mods/negotiation.conf.erb +18 -0
- data/cookbooks/apache2/templates/default/mods/php5.conf.erb +16 -0
- data/cookbooks/apache2/templates/default/mods/proxy.conf.erb +19 -0
- data/cookbooks/apache2/templates/default/mods/setenvif.conf.erb +28 -0
- data/cookbooks/apache2/templates/default/mods/ssl.conf.erb +76 -0
- data/cookbooks/apache2/templates/default/mods/status.conf.erb +26 -0
- data/cookbooks/apache2/templates/default/port_apache.erb +2 -0
- data/cookbooks/apache2/templates/default/ports.conf.erb +6 -0
- data/cookbooks/apache2/templates/default/security.erb +50 -0
- data/cookbooks/apache2/templates/default/web_app.conf.erb +43 -0
- data/cookbooks/apt/Berksfile +8 -0
- data/cookbooks/apt/CHANGELOG.md +97 -0
- data/cookbooks/apt/CONTRIBUTING +29 -0
- data/cookbooks/apt/LICENSE +201 -0
- data/cookbooks/apt/README.md +243 -0
- data/cookbooks/apt/TESTING.md +25 -0
- data/cookbooks/apt/attributes/default.rb +4 -0
- data/cookbooks/apt/files/default/apt-proxy-v2.conf +50 -0
- data/cookbooks/apt/metadata.json +1 -0
- data/cookbooks/apt/metadata.rb +30 -0
- data/cookbooks/apt/providers/preference.rb +61 -0
- data/cookbooks/apt/providers/repository.rb +132 -0
- data/cookbooks/apt/recipes/cacher-client.rb +59 -0
- data/cookbooks/apt/recipes/cacher-ng.rb +40 -0
- data/cookbooks/apt/recipes/default.rb +68 -0
- data/cookbooks/apt/resources/preference.rb +30 -0
- data/cookbooks/apt/resources/repository.rb +40 -0
- data/cookbooks/apt/templates/debian-6.0/acng.conf.erb +174 -0
- data/cookbooks/apt/templates/default/01proxy.erb +2 -0
- data/cookbooks/apt/templates/default/acng.conf.erb +276 -0
- data/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +270 -0
- data/dummy.box +0 -0
- data/lib/vagrant-managed-servers.rb +18 -0
- data/lib/vagrant-managed-servers/action.rb +114 -0
- data/lib/vagrant-managed-servers/action/is_created.rb +18 -0
- data/lib/vagrant-managed-servers/action/is_reachable.rb +18 -0
- data/lib/vagrant-managed-servers/action/link_server.rb +31 -0
- data/lib/vagrant-managed-servers/action/message_not_reachable.rb +16 -0
- data/lib/vagrant-managed-servers/action/read_state.rb +84 -0
- data/lib/vagrant-managed-servers/action/sync_folders.rb +85 -0
- data/lib/vagrant-managed-servers/action/unlink_server.rb +30 -0
- data/lib/vagrant-managed-servers/action/warn_networks.rb +19 -0
- data/lib/vagrant-managed-servers/config.rb +28 -0
- data/lib/vagrant-managed-servers/errors.rb +19 -0
- data/lib/vagrant-managed-servers/plugin.rb +72 -0
- data/lib/vagrant-managed-servers/provider.rb +51 -0
- data/lib/vagrant-managed-servers/util/timer.rb +17 -0
- data/lib/vagrant-managed-servers/version.rb +5 -0
- data/locales/en.yml +45 -0
- data/spec/vagrant-managed-servers/config_spec.rb +28 -0
- data/vagrant-managed-servers.gemspec +56 -0
- metadata +264 -0
@@ -0,0 +1,207 @@
|
|
1
|
+
maintainer "Opscode, Inc."
|
2
|
+
maintainer_email "cookbooks@opscode.com"
|
3
|
+
license "Apache 2.0"
|
4
|
+
description "Installs and configures all aspects of apache2 using Debian style symlinks with helper definitions"
|
5
|
+
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
6
|
+
version "1.2.0"
|
7
|
+
recipe "apache2", "Main Apache configuration"
|
8
|
+
recipe "apache2::logrotate", "Rotate apache2 logs. Requires logrotate cookbook"
|
9
|
+
recipe "apache2::mod_alias", "Apache module 'alias' with config file"
|
10
|
+
recipe "apache2::mod_apreq2", "Apache module 'apreq'"
|
11
|
+
recipe "apache2::mod_auth_basic", "Apache module 'auth_basic'"
|
12
|
+
recipe "apache2::mod_auth_digest", "Apache module 'auth_digest'"
|
13
|
+
recipe "apache2::mod_auth_openid", "Apache module 'authopenid'"
|
14
|
+
recipe "apache2::mod_authn_file", "Apache module 'authn_file'"
|
15
|
+
recipe "apache2::mod_authnz_ldap", "Apache module 'authnz_ldap'"
|
16
|
+
recipe "apache2::mod_authz_default", "Apache module 'authz_default'"
|
17
|
+
recipe "apache2::mod_authz_groupfile", "Apache module 'authz_groupfile'"
|
18
|
+
recipe "apache2::mod_authz_host", "Apache module 'authz_host'"
|
19
|
+
recipe "apache2::mod_authz_user", "Apache module 'authz_user'"
|
20
|
+
recipe "apache2::mod_autoindex", "Apache module 'autoindex' with config file"
|
21
|
+
recipe "apache2::mod_cgi", "Apache module 'cgi'"
|
22
|
+
recipe "apache2::mod_dav", "Apache module 'dav'"
|
23
|
+
recipe "apache2::mod_dav_svn", "Apache module 'dav_svn'"
|
24
|
+
recipe "apache2::mod_deflate", "Apache module 'deflate' with config file"
|
25
|
+
recipe "apache2::mod_dir", "Apache module 'dir' with config file"
|
26
|
+
recipe "apache2::mod_env", "Apache module 'env'"
|
27
|
+
recipe "apache2::mod_expires", "Apache module 'expires'"
|
28
|
+
recipe "apache2::mod_fcgid", "Apache module 'fcgid', package on ubuntu/debian, rhel/centos, compile source on suse; with config file"
|
29
|
+
recipe "apache2::mod_headers", "Apache module 'headers'"
|
30
|
+
recipe "apache2::mod_include", "Apache module 'include'"
|
31
|
+
recipe "apache2::mod_ldap", "Apache module 'ldap'"
|
32
|
+
recipe "apache2::mod_log_config", "Apache module 'log_config'"
|
33
|
+
recipe "apache2::mod_mime", "Apache module 'mime' with config file"
|
34
|
+
recipe "apache2::mod_negotiation", "Apache module 'negotiation' with config file"
|
35
|
+
recipe "apache2::mod_perl", "Apache module 'perl'"
|
36
|
+
recipe "apache2::mod_php5", "Apache module 'php5'"
|
37
|
+
recipe "apache2::mod_proxy", "Apache module 'proxy' with config file"
|
38
|
+
recipe "apache2::mod_proxy_ajp", "Apache module 'proxy_ajp'"
|
39
|
+
recipe "apache2::mod_proxy_balancer", "Apache module 'proxy_balancer'"
|
40
|
+
recipe "apache2::mod_proxy_connect", "Apache module 'proxy_connect'"
|
41
|
+
recipe "apache2::mod_proxy_http", "Apache module 'proxy_http'"
|
42
|
+
recipe "apache2::mod_python", "Apache module 'python'"
|
43
|
+
recipe "apache2::mod_rewrite", "Apache module 'rewrite'"
|
44
|
+
recipe "apache2::mod_setenvif", "Apache module 'setenvif' with config file"
|
45
|
+
recipe "apache2::mod_ssl", "Apache module 'ssl' with config file, adds port 443 to listen_ports"
|
46
|
+
recipe "apache2::mod_status", "Apache module 'status' with config file"
|
47
|
+
recipe "apache2::mod_xsendfile", "Apache module 'xsendfile'"
|
48
|
+
|
49
|
+
%w{redhat centos scientific fedora debian ubuntu arch freebsd amazon}.each do |os|
|
50
|
+
supports os
|
51
|
+
end
|
52
|
+
|
53
|
+
attribute "apache",
|
54
|
+
:display_name => "Apache Hash",
|
55
|
+
:description => "Hash of Apache attributes",
|
56
|
+
:type => "hash"
|
57
|
+
|
58
|
+
attribute "apache/dir",
|
59
|
+
:display_name => "Apache Directory",
|
60
|
+
:description => "Location for Apache configuration",
|
61
|
+
:default => "/etc/apache2"
|
62
|
+
|
63
|
+
attribute "apache/log_dir",
|
64
|
+
:display_name => "Apache Log Directory",
|
65
|
+
:description => "Location for Apache logs",
|
66
|
+
:default => "/etc/apache2"
|
67
|
+
|
68
|
+
attribute "apache/user",
|
69
|
+
:display_name => "Apache User",
|
70
|
+
:description => "User Apache runs as",
|
71
|
+
:default => "www-data"
|
72
|
+
|
73
|
+
attribute "apache/binary",
|
74
|
+
:display_name => "Apache Binary",
|
75
|
+
:description => "Apache server daemon program",
|
76
|
+
:default => "/usr/sbin/apache2"
|
77
|
+
|
78
|
+
attribute "apache/icondir",
|
79
|
+
:display_name => "Apache Icondir",
|
80
|
+
:description => "Directory location for icons",
|
81
|
+
:default => "/usr/share/apache2/icons"
|
82
|
+
|
83
|
+
attribute "apache/listen_ports",
|
84
|
+
:display_name => "Apache Listen Ports",
|
85
|
+
:description => "Ports that Apache should listen on",
|
86
|
+
:type => "array",
|
87
|
+
:default => [ "80", "443" ]
|
88
|
+
|
89
|
+
attribute "apache/contact",
|
90
|
+
:display_name => "Apache Contact",
|
91
|
+
:description => "Email address of webmaster",
|
92
|
+
:default => "ops@example.com"
|
93
|
+
|
94
|
+
attribute "apache/timeout",
|
95
|
+
:display_name => "Apache Timeout",
|
96
|
+
:description => "Connection timeout value",
|
97
|
+
:default => "300"
|
98
|
+
|
99
|
+
attribute "apache/keepalive",
|
100
|
+
:display_name => "Apache Keepalive",
|
101
|
+
:description => "HTTP persistent connections",
|
102
|
+
:default => "On"
|
103
|
+
|
104
|
+
attribute "apache/keepaliverequests",
|
105
|
+
:display_name => "Apache Keepalive Requests",
|
106
|
+
:description => "Number of requests allowed on a persistent connection",
|
107
|
+
:default => "100"
|
108
|
+
|
109
|
+
attribute "apache/keepalivetimeout",
|
110
|
+
:display_name => "Apache Keepalive Timeout",
|
111
|
+
:description => "Time to wait for requests on persistent connection",
|
112
|
+
:default => "5"
|
113
|
+
|
114
|
+
attribute "apache/servertokens",
|
115
|
+
:display_name => "Apache Server Tokens",
|
116
|
+
:description => "Server response header",
|
117
|
+
:default => "Prod"
|
118
|
+
|
119
|
+
attribute "apache/serversignature",
|
120
|
+
:display_name => "Apache Server Signature",
|
121
|
+
:description => "Configure footer on server-generated documents",
|
122
|
+
:default => "On"
|
123
|
+
|
124
|
+
attribute "apache/traceenable",
|
125
|
+
:display_name => "Apache Trace Enable",
|
126
|
+
:description => "Determine behavior of TRACE requests",
|
127
|
+
:default => "On"
|
128
|
+
|
129
|
+
attribute "apache/allowed_openids",
|
130
|
+
:display_name => "Apache Allowed OpenIDs",
|
131
|
+
:description => "Array of OpenIDs allowed to authenticate",
|
132
|
+
:default => ""
|
133
|
+
|
134
|
+
attribute "apache/prefork",
|
135
|
+
:display_name => "Apache Prefork",
|
136
|
+
:description => "Hash of Apache prefork tuning attributes.",
|
137
|
+
:type => "hash"
|
138
|
+
|
139
|
+
attribute "apache/prefork/startservers",
|
140
|
+
:display_name => "Apache Prefork MPM StartServers",
|
141
|
+
:description => "Number of MPM servers to start",
|
142
|
+
:default => "16"
|
143
|
+
|
144
|
+
attribute "apache/prefork/minspareservers",
|
145
|
+
:display_name => "Apache Prefork MPM MinSpareServers",
|
146
|
+
:description => "Minimum number of spare server processes",
|
147
|
+
:default => "16"
|
148
|
+
|
149
|
+
attribute "apache/prefork/maxspareservers",
|
150
|
+
:display_name => "Apache Prefork MPM MaxSpareServers",
|
151
|
+
:description => "Maximum number of spare server processes",
|
152
|
+
:default => "32"
|
153
|
+
|
154
|
+
attribute "apache/prefork/serverlimit",
|
155
|
+
:display_name => "Apache Prefork MPM ServerLimit",
|
156
|
+
:description => "Upper limit on configurable server processes",
|
157
|
+
:default => "400"
|
158
|
+
|
159
|
+
attribute "apache/prefork/maxclients",
|
160
|
+
:display_name => "Apache Prefork MPM MaxClients",
|
161
|
+
:description => "Maximum number of simultaneous connections",
|
162
|
+
:default => "400"
|
163
|
+
|
164
|
+
attribute "apache/prefork/maxrequestsperchild",
|
165
|
+
:display_name => "Apache Prefork MPM MaxRequestsPerChild",
|
166
|
+
:description => "Maximum number of request a child process will handle",
|
167
|
+
:default => "10000"
|
168
|
+
|
169
|
+
attribute "apache/worker",
|
170
|
+
:display_name => "Apache Worker",
|
171
|
+
:description => "Hash of Apache prefork tuning attributes.",
|
172
|
+
:type => "hash"
|
173
|
+
|
174
|
+
attribute "apache/worker/startservers",
|
175
|
+
:display_name => "Apache Worker MPM StartServers",
|
176
|
+
:description => "Initial number of server processes to start",
|
177
|
+
:default => "4"
|
178
|
+
|
179
|
+
attribute "apache/worker/maxclients",
|
180
|
+
:display_name => "Apache Worker MPM MaxClients",
|
181
|
+
:description => "Maximum number of simultaneous connections",
|
182
|
+
:default => "1024"
|
183
|
+
|
184
|
+
attribute "apache/worker/minsparethreads",
|
185
|
+
:display_name => "Apache Worker MPM MinSpareThreads",
|
186
|
+
:description => "Minimum number of spare worker threads",
|
187
|
+
:default => "64"
|
188
|
+
|
189
|
+
attribute "apache/worker/maxsparethreads",
|
190
|
+
:display_name => "Apache Worker MPM MaxSpareThreads",
|
191
|
+
:description => "Maximum number of spare worker threads",
|
192
|
+
:default => "192"
|
193
|
+
|
194
|
+
attribute "apache/worker/threadsperchild",
|
195
|
+
:display_name => "Apache Worker MPM ThreadsPerChild",
|
196
|
+
:description => "Constant number of worker threads in each server process",
|
197
|
+
:default => "64"
|
198
|
+
|
199
|
+
attribute "apache/worker/maxrequestsperchild",
|
200
|
+
:display_name => "Apache Worker MPM MaxRequestsPerChild",
|
201
|
+
:description => "Maximum number of request a child process will handle",
|
202
|
+
:default => "0"
|
203
|
+
|
204
|
+
attribute "apache/default_modules",
|
205
|
+
:display_name => "Apache Default Modules",
|
206
|
+
:description => "Default modules to enable via recipes",
|
207
|
+
:default => "status alias auth_basic authn_file authz_default authz_groupfile authz_host authz_user autoindex dir env mime negotiation setenvif"
|
@@ -0,0 +1,208 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apache2
|
3
|
+
# Recipe:: default
|
4
|
+
#
|
5
|
+
# Copyright 2008-2009, Opscode, Inc.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
package "apache2" do
|
21
|
+
package_name node['apache']['package']
|
22
|
+
end
|
23
|
+
|
24
|
+
service "apache2" do
|
25
|
+
case node['platform_family']
|
26
|
+
when "rhel", "fedora", "suse"
|
27
|
+
service_name "httpd"
|
28
|
+
# If restarted/reloaded too quickly httpd has a habit of failing.
|
29
|
+
# This may happen with multiple recipes notifying apache to restart - like
|
30
|
+
# during the initial bootstrap.
|
31
|
+
restart_command "/sbin/service httpd restart && sleep 1"
|
32
|
+
reload_command "/sbin/service httpd reload && sleep 1"
|
33
|
+
when "debian"
|
34
|
+
service_name "apache2"
|
35
|
+
restart_command "/usr/sbin/invoke-rc.d apache2 restart && sleep 1"
|
36
|
+
reload_command "/usr/sbin/invoke-rc.d apache2 reload && sleep 1"
|
37
|
+
when "arch"
|
38
|
+
service_name "httpd"
|
39
|
+
when "freebsd"
|
40
|
+
service_name "apache22"
|
41
|
+
end
|
42
|
+
supports [:restart, :reload, :status]
|
43
|
+
action :enable
|
44
|
+
end
|
45
|
+
|
46
|
+
if platform_family?("rhel", "fedora", "arch", "suse", "freebsd")
|
47
|
+
directory node['apache']['log_dir'] do
|
48
|
+
mode 00755
|
49
|
+
end
|
50
|
+
|
51
|
+
package "perl"
|
52
|
+
|
53
|
+
cookbook_file "/usr/local/bin/apache2_module_conf_generate.pl" do
|
54
|
+
source "apache2_module_conf_generate.pl"
|
55
|
+
mode 00755
|
56
|
+
owner "root"
|
57
|
+
group node['apache']['root_group']
|
58
|
+
end
|
59
|
+
|
60
|
+
%w{sites-available sites-enabled mods-available mods-enabled}.each do |dir|
|
61
|
+
directory "#{node['apache']['dir']}/#{dir}" do
|
62
|
+
mode 00755
|
63
|
+
owner "root"
|
64
|
+
group node['apache']['root_group']
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
execute "generate-module-list" do
|
69
|
+
command "/usr/local/bin/apache2_module_conf_generate.pl #{node['apache']['lib_dir']} #{node['apache']['dir']}/mods-available"
|
70
|
+
end
|
71
|
+
|
72
|
+
%w{a2ensite a2dissite a2enmod a2dismod}.each do |modscript|
|
73
|
+
template "/usr/sbin/#{modscript}" do
|
74
|
+
source "#{modscript}.erb"
|
75
|
+
mode 00700
|
76
|
+
owner "root"
|
77
|
+
group node['apache']['root_group']
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# installed by default on centos/rhel, remove in favour of mods-enabled
|
82
|
+
%w{ proxy_ajp auth_pam authz_ldap webalizer ssl welcome }.each do |f|
|
83
|
+
file "#{node['apache']['dir']}/conf.d/#{f}.conf" do
|
84
|
+
action :delete
|
85
|
+
backup false
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# installed by default on centos/rhel, remove in favour of mods-enabled
|
90
|
+
file "#{node['apache']['dir']}/conf.d/README" do
|
91
|
+
action :delete
|
92
|
+
backup false
|
93
|
+
end
|
94
|
+
|
95
|
+
# enable mod_deflate for consistency across distributions
|
96
|
+
include_recipe "apache2::mod_deflate"
|
97
|
+
end
|
98
|
+
|
99
|
+
if platform_family?("freebsd")
|
100
|
+
|
101
|
+
file "#{node['apache']['dir']}/Includes/no-accf.conf" do
|
102
|
+
action :delete
|
103
|
+
backup false
|
104
|
+
end
|
105
|
+
|
106
|
+
directory "#{node['apache']['dir']}/Includes" do
|
107
|
+
action :delete
|
108
|
+
end
|
109
|
+
|
110
|
+
%w{httpd-autoindex.conf httpd-dav.conf httpd-default.conf httpd-info.conf
|
111
|
+
httpd-languages.conf httpd-manual.conf httpd-mpm.conf
|
112
|
+
httpd-multilang-errordoc.conf httpd-ssl.conf httpd-userdir.conf
|
113
|
+
httpd-vhosts.conf}.each do |f|
|
114
|
+
|
115
|
+
file "#{node['apache']['dir']}/extra/#{f}" do
|
116
|
+
action :delete
|
117
|
+
backup false
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
directory "#{node['apache']['dir']}/extra" do
|
123
|
+
action :delete
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
directory "#{node['apache']['dir']}/ssl" do
|
129
|
+
mode 00755
|
130
|
+
owner "root"
|
131
|
+
group node['apache']['root_group']
|
132
|
+
end
|
133
|
+
|
134
|
+
directory "#{node['apache']['dir']}/conf.d" do
|
135
|
+
mode 00755
|
136
|
+
owner "root"
|
137
|
+
group node['apache']['root_group']
|
138
|
+
end
|
139
|
+
|
140
|
+
directory node['apache']['cache_dir'] do
|
141
|
+
mode 00755
|
142
|
+
owner "root"
|
143
|
+
group node['apache']['root_group']
|
144
|
+
end
|
145
|
+
|
146
|
+
template "apache2.conf" do
|
147
|
+
case node['platform_family']
|
148
|
+
when "rhel", "fedora", "arch"
|
149
|
+
path "#{node['apache']['dir']}/conf/httpd.conf"
|
150
|
+
when "debian"
|
151
|
+
path "#{node['apache']['dir']}/apache2.conf"
|
152
|
+
when "freebsd"
|
153
|
+
path "#{node['apache']['dir']}/httpd.conf"
|
154
|
+
end
|
155
|
+
source "apache2.conf.erb"
|
156
|
+
owner "root"
|
157
|
+
group node['apache']['root_group']
|
158
|
+
mode 00644
|
159
|
+
notifies :restart, "service[apache2]"
|
160
|
+
end
|
161
|
+
|
162
|
+
template "apache2-conf-security" do
|
163
|
+
path "#{node['apache']['dir']}/conf.d/security"
|
164
|
+
source "security.erb"
|
165
|
+
owner "root"
|
166
|
+
group node['apache']['root_group']
|
167
|
+
mode 00644
|
168
|
+
backup false
|
169
|
+
notifies :restart, "service[apache2]"
|
170
|
+
end
|
171
|
+
|
172
|
+
template "apache2-conf-charset" do
|
173
|
+
path "#{node['apache']['dir']}/conf.d/charset"
|
174
|
+
source "charset.erb"
|
175
|
+
owner "root"
|
176
|
+
group node['apache']['root_group']
|
177
|
+
mode 00644
|
178
|
+
backup false
|
179
|
+
notifies :restart, "service[apache2]"
|
180
|
+
end
|
181
|
+
|
182
|
+
template "#{node['apache']['dir']}/ports.conf" do
|
183
|
+
source "ports.conf.erb"
|
184
|
+
owner "root"
|
185
|
+
group node['apache']['root_group']
|
186
|
+
variables :apache_listen_ports => node['apache']['listen_ports'].map{|p| p.to_i}.uniq
|
187
|
+
mode 00644
|
188
|
+
notifies :restart, "service[apache2]"
|
189
|
+
end
|
190
|
+
|
191
|
+
template "#{node['apache']['dir']}/sites-available/default" do
|
192
|
+
source "default-site.erb"
|
193
|
+
owner "root"
|
194
|
+
group node['apache']['root_group']
|
195
|
+
mode 00644
|
196
|
+
notifies :restart, "service[apache2]"
|
197
|
+
end
|
198
|
+
|
199
|
+
node['apache']['default_modules'].each do |mod|
|
200
|
+
module_recipe_name = mod =~ /^mod_/ ? mod : "mod_#{mod}"
|
201
|
+
include_recipe "apache2::#{module_recipe_name}"
|
202
|
+
end
|
203
|
+
|
204
|
+
apache_site "default" if node['apache']['default_site_enabled']
|
205
|
+
|
206
|
+
service "apache2" do
|
207
|
+
action :start
|
208
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# Cookbook Name:: apache2
|
3
|
+
# Recipe:: god_monitor
|
4
|
+
#
|
5
|
+
# Copyright 2008-2009, Opscode, Inc.
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
apache_service = service "apache2" do
|
21
|
+
action :nothing
|
22
|
+
end
|
23
|
+
|
24
|
+
start_command = apache_service.start_command
|
25
|
+
stop_command = apache_service.stop_command
|
26
|
+
restart_command = apache_service.restart_command
|
27
|
+
|
28
|
+
god_monitor "apache2" do
|
29
|
+
config "apache2.god.erb"
|
30
|
+
start (start_command)?start_command : "/etc/init.d/#{apache_service.service_name} start"
|
31
|
+
restart (restart_command)?restart_command : "/etc/init.d/#{apache_service.service_name} restart"
|
32
|
+
stop (stop_command)?stop_command : "/etc/init.d/#{apache_service.service_name} stop"
|
33
|
+
end
|