Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

prepare for deployment

  • Loading branch information...
commit 58c481f7969abe9bdd82475d83cd9c4f36f91be4 1 parent 998e7bc
@notnoop authored
Showing with 2,862 additions and 9 deletions.
  1. +1 −0  Vagrantfile
  2. +78 −0 cookbooks/apache2/README.rdoc
  3. +87 −0 cookbooks/apache2/attributes/default.rb
  4. +26 −0 cookbooks/apache2/definitions/apache_conf.rb
  5. +43 −0 cookbooks/apache2/definitions/apache_module.rb
  6. +40 −0 cookbooks/apache2/definitions/apache_site.rb
  7. +49 −0 cookbooks/apache2/definitions/web_app.rb
  8. +41 −0 cookbooks/apache2/files/default/apache2_module_conf_generate.pl
  9. +197 −0 cookbooks/apache2/metadata.rb
  10. +209 −0 cookbooks/apache2/recipes/default.rb
  11. +33 −0 cookbooks/apache2/recipes/god_monitor.rb
  12. +22 −0 cookbooks/apache2/recipes/mod_alias.rb
  13. +20 −0 cookbooks/apache2/recipes/mod_auth_basic.rb
  14. +20 −0 cookbooks/apache2/recipes/mod_auth_digest.rb
  15. +83 −0 cookbooks/apache2/recipes/mod_auth_openid.rb
  16. +20 −0 cookbooks/apache2/recipes/mod_authn_file.rb
  17. +20 −0 cookbooks/apache2/recipes/mod_authnz_ldap.rb
  18. +20 −0 cookbooks/apache2/recipes/mod_authz_default.rb
  19. +20 −0 cookbooks/apache2/recipes/mod_authz_groupfile.rb
  20. +20 −0 cookbooks/apache2/recipes/mod_authz_host.rb
  21. +20 −0 cookbooks/apache2/recipes/mod_authz_user.rb
  22. +22 −0 cookbooks/apache2/recipes/mod_autoindex.rb
  23. +20 −0 cookbooks/apache2/recipes/mod_cgi.rb
  24. +20 −0 cookbooks/apache2/recipes/mod_dav.rb
  25. +22 −0 cookbooks/apache2/recipes/mod_dav_svn.rb
  26. +22 −0 cookbooks/apache2/recipes/mod_deflate.rb
  27. +22 −0 cookbooks/apache2/recipes/mod_dir.rb
  28. +20 −0 cookbooks/apache2/recipes/mod_env.rb
  29. +20 −0 cookbooks/apache2/recipes/mod_expires.rb
  30. +46 −0 cookbooks/apache2/recipes/mod_fcgid.rb
  31. +20 −0 cookbooks/apache2/recipes/mod_headers.rb
  32. +20 −0 cookbooks/apache2/recipes/mod_ldap.rb
  33. +24 −0 cookbooks/apache2/recipes/mod_log_config.rb
  34. +22 −0 cookbooks/apache2/recipes/mod_mime.rb
  35. +22 −0 cookbooks/apache2/recipes/mod_negotiation.rb
  36. +37 −0 cookbooks/apache2/recipes/mod_php5.rb
  37. +22 −0 cookbooks/apache2/recipes/mod_proxy.rb
  38. +20 −0 cookbooks/apache2/recipes/mod_proxy_ajp.rb
  39. +20 −0 cookbooks/apache2/recipes/mod_proxy_balancer.rb
  40. +20 −0 cookbooks/apache2/recipes/mod_proxy_connect.rb
  41. +20 −0 cookbooks/apache2/recipes/mod_proxy_http.rb
  42. +32 −0 cookbooks/apache2/recipes/mod_python.rb
  43. +20 −0 cookbooks/apache2/recipes/mod_rewrite.rb
  44. +22 −0 cookbooks/apache2/recipes/mod_setenvif.rb
  45. +43 −0 cookbooks/apache2/recipes/mod_ssl.rb
  46. +22 −0 cookbooks/apache2/recipes/mod_status.rb
  47. +27 −0 cookbooks/apache2/recipes/mod_wsgi.rb
  48. +22 −0 cookbooks/apache2/templates/default/a2dismod.erb
  49. +29 −0 cookbooks/apache2/templates/default/a2dissite.erb
  50. +37 −0 cookbooks/apache2/templates/default/a2enmod.erb
  51. +38 −0 cookbooks/apache2/templates/default/a2ensite.erb
  52. +232 −0 cookbooks/apache2/templates/default/apache2.conf.erb
  53. +19 −0 cookbooks/apache2/templates/default/apache2.god.erb
  54. +6 −0 cookbooks/apache2/templates/default/charset.erb
  55. +57 −0 cookbooks/apache2/templates/default/default-site.erb
  56. +12 −0 cookbooks/apache2/templates/default/mod_auth_openid.rb.erb
  57. +2 −0  cookbooks/apache2/templates/default/mods/README
  58. +24 −0 cookbooks/apache2/templates/default/mods/alias.conf.erb
  59. +6 −0 cookbooks/apache2/templates/default/mods/authopenid.load.erb
  60. +101 −0 cookbooks/apache2/templates/default/mods/autoindex.conf.erb
  61. +16 −0 cookbooks/apache2/templates/default/mods/deflate.conf.erb
  62. +5 −0 cookbooks/apache2/templates/default/mods/dir.conf.erb
  63. +10 −0 cookbooks/apache2/templates/default/mods/fcgid.conf.erb
  64. +196 −0 cookbooks/apache2/templates/default/mods/mime.conf.erb
  65. +18 −0 cookbooks/apache2/templates/default/mods/negotiation.conf.erb
  66. +19 −0 cookbooks/apache2/templates/default/mods/proxy.conf.erb
  67. +28 −0 cookbooks/apache2/templates/default/mods/setenvif.conf.erb
  68. +72 −0 cookbooks/apache2/templates/default/mods/ssl.conf.erb
  69. +16 −0 cookbooks/apache2/templates/default/mods/status.conf.erb
  70. +2 −0  cookbooks/apache2/templates/default/port_apache.erb
  71. +6 −0 cookbooks/apache2/templates/default/ports.conf.erb
  72. +50 −0 cookbooks/apache2/templates/default/security.erb
  73. +43 −0 cookbooks/apache2/templates/default/web_app.conf.erb
  74. +4 −2 cookbooks/app/recipes/default.rb
  75. +29 −0 cookbooks/app/recipes/server.rb
  76. +29 −0 cookbooks/app/templates/default/app.wsgi
  77. +2 −2 cookbooks/app/templates/default/settings.py.erb
  78. +21 −0 cookbooks/app/templates/default/web_app.conf.erb
  79. +7 −0 cookbooks/postgresql/attributes/default.rb
  80. +1 −3 cookbooks/postgresql/recipes/server_debian.rb
  81. +7 −2 solo.json
View
1  Vagrantfile
@@ -70,6 +70,7 @@ Vagrant::Config.run do |config|
:name => "sample",
:user => "vagrant"
},
+ :debug => "True"
})
end
View
78 cookbooks/apache2/README.rdoc
@@ -0,0 +1,78 @@
+= DESCRIPTION:
+
+Complete Debian/Ubuntu style Apache2 configuration.
+
+= REQUIREMENTS:
+
+Debian or Ubuntu preferred.
+
+Red Hat, CentOS, Fedora and ArchLinux can be used but will be converted to a Debian/Ubuntu style Apache as it's far easier to manage with Chef.
+
+= ATTRIBUTES:
+
+The file attributes/apache.rb contains the following attribute types:
+
+* platform specific locations and settings.
+* general settings
+* prefork attributes
+* worker attributes
+
+General settings and prefork/worker attributes are tunable.
+
+= USAGE:
+
+Include the apache2 recipe to install Apache2 and get 'sane' default settings. Configuration is modularized through Apache vhost sites a la Debian style configuration.
+
+For Red Hat, CentOS and Fedora you should first disable selinux as it's not supported (yet), then remove the stock httpd and all it's dependencies prior to attempting to use this recipe. Many packages in these distributions drop conflicting configs into conf.d, all of which haven't been accounted for yet. Starting from scratch will also make it far easier to debug.
+
+== Defines:
+
+* +apache_module+: sets up an Apache module.
+* +apache_conf+: sets up a config file for an apache module.
+* +apache_site+: sets up a vhost site. The conf file must be available.
+* +web_app+: copies the template for a web app and enables it as a site via +apache_site+.
+
+== Web Apps:
+
+Various applications that can be set up with Apache as the front end, such as PHP, Django, Rails and others can use the web_app define to set up the template and the Apache site. The define is kind of dumb, so the template needs have the application implementation settings, since we don't know what your app is or what is needed from Apache.
+
+We only prototype one parameter for the +web_app+ define, "template". This is used to specify the name of the template to use in the current cookbook. When you use +web_app+, you can set up any parameters you want to use in your template. They will get passed to the template through the params hash. For example, the sample +web_app.conf.erb+ template in this cookbook makes use of these.
+
+* +docroot+
+* +server_name+
+* +server_aliases+
+
+These are available as +params[:docroot]+, +params[:server_name]+, +params[:server_aliases]+ prefixed with an @ within the template.
+
+If 'cookbook' and 'template' are not specified, the current cookbook's +templates/default/web_app.conf.erb+ will be used. If this template is not suitable for your application, copy it to your cookbook and customize as needed.
+
+== God Monitor:
+
+There's a new recipe, +apache2::god_monitor+. You will need to make sure to include the 'god' recipe before using the +apache2::god_monitor+ recipe in your cookbook.
+
+== OpenID Auth
+
+Installs the +mod_auth_openid+ module from source. Specify an array of OpenIDs that are allowed to authenticate with the attribute +apache[:allowed_openids]+. Use the following in a vhost to protect with OpenID authentication:
+
+ AuthOpenIDEnabled On
+ AuthOpenIDDBLocation /var/cache/apache2/mod_auth_openid.db
+ AuthOpenIDUserProgram /usr/local/bin/mod_auth_openid.rb
+
+Change the DBLocation as appropriate for your platform. You'll need to change the file in the recipe to match. The UserProgram is optional if you don't want to limit access by certain OpenIDs.
+
+= LICENSE & AUTHOR:
+
+Author:: Joshua Timberman (<joshua@opscode.com>)
+Copyright:: 2009, Opscode, Inc
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
View
87 cookbooks/apache2/attributes/default.rb
@@ -0,0 +1,87 @@
+#
+# Cookbook Name:: apache2
+# Attributes:: apache
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Where the various parts of apache are
+case platform
+when "redhat","centos","fedora","suse"
+ set[:apache][:dir] = "/etc/httpd"
+ set[:apache][:log_dir] = "/var/log/httpd"
+ set[:apache][:user] = "apache"
+ set[:apache][:binary] = "/usr/sbin/httpd"
+ set[:apache][:icondir] = "/var/www/icons/"
+ set[:apache][:cache_dir] = "/var/cache/httpd"
+when "debian","ubuntu"
+ set[:apache][:dir] = "/etc/apache2"
+ set[:apache][:log_dir] = "/var/log/apache2"
+ set[:apache][:user] = "www-data"
+ set[:apache][:binary] = "/usr/sbin/apache2"
+ set[:apache][:icondir] = "/usr/share/apache2/icons"
+ set[:apache][:cache_dir] = "/var/cache/apache2"
+when "arch"
+ set[:apache][:dir] = "/etc/httpd"
+ set[:apache][:log_dir] = "/var/log/httpd"
+ set[:apache][:user] = "http"
+ set[:apache][:binary] = "/usr/sbin/httpd"
+ set[:apache][:icondir] = "/usr/share/httpd/icons"
+ set[:apache][:cache_dir] = "/var/cache/httpd"
+else
+ set[:apache][:dir] = "/etc/apache2"
+ set[:apache][:log_dir] = "/var/log/apache2"
+ set[:apache][:user] = "www-data"
+ set[:apache][:binary] = "/usr/sbin/apache2"
+ set[:apache][:icondir] = "/usr/share/apache2/icons"
+ set[:apache][:cache_dir] = "/var/cache/apache2"
+end
+
+###
+# These settings need the unless, since we want them to be tunable,
+# and we don't want to override the tunings.
+###
+
+# General settings
+default[:apache][:listen_ports] = [ "80","443" ]
+default[:apache][:contact] = "ops@example.com"
+default[:apache][:timeout] = 300
+default[:apache][:keepalive] = "On"
+default[:apache][:keepaliverequests] = 100
+default[:apache][:keepalivetimeout] = 5
+
+# Security
+default[:apache][:servertokens] = "Prod"
+default[:apache][:serversignature] = "On"
+default[:apache][:traceenable] = "On"
+
+# mod_auth_openids
+default[:apache][:allowed_openids] = Array.new
+
+# Prefork Attributes
+default[:apache][:prefork][:startservers] = 16
+default[:apache][:prefork][:minspareservers] = 16
+default[:apache][:prefork][:maxspareservers] = 32
+default[:apache][:prefork][:serverlimit] = 400
+default[:apache][:prefork][:maxclients] = 400
+default[:apache][:prefork][:maxrequestsperchild] = 10000
+
+# Worker Attributes
+default[:apache][:worker][:startservers] = 4
+default[:apache][:worker][:maxclients] = 1024
+default[:apache][:worker][:minsparethreads] = 64
+default[:apache][:worker][:maxsparethreads] = 192
+default[:apache][:worker][:threadsperchild] = 64
+default[:apache][:worker][:maxrequestsperchild] = 0
View
26 cookbooks/apache2/definitions/apache_conf.rb
@@ -0,0 +1,26 @@
+#
+# Cookbook Name:: apache2
+# Definition:: apache_conf
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :apache_conf do
+ template "#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf" do
+ source "mods/#{params[:name]}.conf.erb"
+ notifies :restart, resources(:service => "apache2")
+ mode 0644
+ end
+end
View
43 cookbooks/apache2/definitions/apache_module.rb
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: apache2
+# Definition:: apache_module
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :apache_module, :enable => true, :conf => false do
+ include_recipe "apache2"
+
+ if params[:conf]
+ apache_conf params[:name]
+ end
+
+ if params[:enable]
+ execute "a2enmod #{params[:name]}" do
+ command "/usr/sbin/a2enmod #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ not_if do (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.load") and
+ ((File.exists?("#{node[:apache][:dir]}/mods-available/#{params[:name]}.conf"))?
+ (File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.conf")):(true)))
+ end
+ end
+ else
+ execute "a2dismod #{params[:name]}" do
+ command "/usr/sbin/a2dismod #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ only_if do ::File.symlink?("#{node[:apache][:dir]}/mods-enabled/#{params[:name]}.load") end
+ end
+ end
+end
View
40 cookbooks/apache2/definitions/apache_site.rb
@@ -0,0 +1,40 @@
+#
+# Cookbook Name:: apache2
+# Definition:: apache_site
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :apache_site, :enable => true do
+ include_recipe "apache2"
+
+ if params[:enable]
+ execute "a2ensite #{params[:name]}" do
+ command "/usr/sbin/a2ensite #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ not_if do
+ ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") or
+ ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/000-#{params[:name]}")
+ end
+ only_if do ::File.exists?("#{node[:apache][:dir]}/sites-available/#{params[:name]}") end
+ end
+ else
+ execute "a2dissite #{params[:name]}" do
+ command "/usr/sbin/a2dissite #{params[:name]}"
+ notifies :restart, resources(:service => "apache2")
+ only_if do ::File.symlink?("#{node[:apache][:dir]}/sites-enabled/#{params[:name]}") end
+ end
+ end
+end
View
49 cookbooks/apache2/definitions/web_app.rb
@@ -0,0 +1,49 @@
+#
+# Cookbook Name:: apache2
+# Definition:: web_app
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+define :web_app, :template => "web_app.conf.erb" do
+
+ application_name = params[:name]
+
+ include_recipe "apache2"
+ include_recipe "apache2::mod_rewrite"
+ include_recipe "apache2::mod_deflate"
+ include_recipe "apache2::mod_headers"
+
+ template "#{node[:apache][:dir]}/sites-available/#{application_name}.conf" do
+ source params[:template]
+ owner "root"
+ group "root"
+ mode 0644
+ if params[:cookbook]
+ cookbook params[:cookbook]
+ end
+ variables(
+ :application_name => application_name,
+ :params => params
+ )
+ if ::File.exists?("#{node[:apache][:dir]}/sites-enabled/#{application_name}.conf")
+ notifies :reload, resources(:service => "apache2"), :delayed
+ end
+ end
+
+ apache_site "#{params[:name]}.conf" do
+ enable enable_setting
+ end
+end
View
41 cookbooks/apache2/files/default/apache2_module_conf_generate.pl
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+
+=begin
+
+Generates Ubuntu style module.load files.
+
+./apache2_module_conf_generate.pl /usr/lib64/httpd/modules /etc/httpd/mods-available
+
+ARGV[0] is the apache modules directory, ARGV[1] is where you want 'em.
+
+=cut
+
+use File::Find;
+
+use strict;
+use warnings;
+
+die "Must have '/path/to/modules' and '/path/to/modules.load'"
+ unless $ARGV[0] && $ARGV[1];
+
+find(
+ {
+ wanted => sub {
+ return 1 if $File::Find::name !~ /\.so$/;
+ my $modfile = $_;
+ $modfile =~ /(lib|mod_)(.+)\.so$/;
+ my $modname = $2;
+ my $filename = "$ARGV[1]/$modname.load";
+ unless ( -f $filename ) {
+ open( FILE, ">", $filename ) or die "Cannot open $filename";
+ print FILE "LoadModule " . $modname . "_module $File::Find::name\n";
+ close(FILE);
+ }
+ },
+ follow => 1,
+ },
+ $ARGV[0]
+);
+
+exit 0;
+
View
197 cookbooks/apache2/metadata.rb
@@ -0,0 +1,197 @@
+maintainer "Opscode, Inc."
+maintainer_email "cookbooks@opscode.com"
+license "Apache 2.0"
+description "Installs and configures all aspects of apache2 using Debian style symlinks with helper definitions"
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
+version "0.99.4"
+recipe "apache2", "Main Apache configuration"
+recipe "apache2::mod_alias", "Apache module 'alias' with config file"
+recipe "apache2::mod_auth_basic", "Apache module 'auth_basic'"
+recipe "apache2::mod_auth_digest", "Apache module 'auth_digest'"
+recipe "apache2::mod_auth_openid", "Apache module 'authopenid'"
+recipe "apache2::mod_authn_file", "Apache module 'authn_file'"
+recipe "apache2::mod_authnz_ldap", "Apache module 'authnz_ldap'"
+recipe "apache2::mod_authz_default", "Apache module 'authz_default'"
+recipe "apache2::mod_authz_groupfile", "Apache module 'authz_groupfile'"
+recipe "apache2::mod_authz_host", "Apache module 'authz_host'"
+recipe "apache2::mod_authz_user", "Apache module 'authz_user'"
+recipe "apache2::mod_autoindex", "Apache module 'autoindex' with config file"
+recipe "apache2::mod_cgi", "Apache module 'cgi'"
+recipe "apache2::mod_dav", "Apache module 'dav'"
+recipe "apache2::mod_dav_svn", "Apache module 'dav_svn'"
+recipe "apache2::mod_deflate", "Apache module 'deflate' with config file"
+recipe "apache2::mod_dir", "Apache module 'dir' with config file"
+recipe "apache2::mod_env", "Apache module 'env'"
+recipe "apache2::mod_expires", "Apache module 'expires'"
+recipe "apache2::mod_fcgid", "Apache module 'fcgid', package on ubuntu/debian, rhel/centos, compile source on suse; with config file"
+recipe "apache2::mod_headers", "Apache module 'headers'"
+recipe "apache2::mod_ldap", "Apache module 'ldap'"
+recipe "apache2::mod_log_config", "Apache module 'log_config'"
+recipe "apache2::mod_mime", "Apache module 'mime' with config file"
+recipe "apache2::mod_negotiation", "Apache module 'negotiation' with config file"
+recipe "apache2::mod_php5", "Apache module 'php5'"
+recipe "apache2::mod_proxy", "Apache module 'proxy' with config file"
+recipe "apache2::mod_proxy_ajp", "Apache module 'proxy_ajp'"
+recipe "apache2::mod_proxy_balancer", "Apache module 'proxy_balancer'"
+recipe "apache2::mod_proxy_connect", "Apache module 'proxy_connect'"
+recipe "apache2::mod_proxy_http", "Apache module 'proxy_http'"
+recipe "apache2::mod_python", "Apache module 'python'"
+recipe "apache2::mod_rewrite", "Apache module 'rewrite'"
+recipe "apache2::mod_setenvif", "Apache module 'setenvif' with config file"
+recipe "apache2::mod_ssl", "Apache module 'ssl' with config file, adds port 443 to listen_ports"
+recipe "apache2::mod_status", "Apache module 'status' with config file"
+
+%w{redhat centos debian ubuntu arch}.each do |os|
+ supports os
+end
+
+attribute "apache",
+ :display_name => "Apache Hash",
+ :description => "Hash of Apache attributes",
+ :type => "hash"
+
+attribute "apache/dir",
+ :display_name => "Apache Directory",
+ :description => "Location for Apache configuration",
+ :default => "/etc/apache2"
+
+attribute "apache/log_dir",
+ :display_name => "Apache Log Directory",
+ :description => "Location for Apache logs",
+ :default => "/etc/apache2"
+
+attribute "apache/user",
+ :display_name => "Apache User",
+ :description => "User Apache runs as",
+ :default => "www-data"
+
+attribute "apache/binary",
+ :display_name => "Apache Binary",
+ :description => "Apache server daemon program",
+ :default => "/usr/sbin/apache2"
+
+attribute "apache/icondir",
+ :display_name => "Apache Icondir",
+ :description => "Directory location for icons",
+ :default => "/usr/share/apache2/icons"
+
+attribute "apache/listen_ports",
+ :display_name => "Apache Listen Ports",
+ :description => "Ports that Apache should listen on",
+ :type => "array",
+ :default => [ "80", "443" ]
+
+attribute "apache/contact",
+ :display_name => "Apache Contact",
+ :description => "Email address of webmaster",
+ :default => "ops@example.com"
+
+attribute "apache/timeout",
+ :display_name => "Apache Timeout",
+ :description => "Connection timeout value",
+ :default => "300"
+
+attribute "apache/keepalive",
+ :display_name => "Apache Keepalive",
+ :description => "HTTP persistent connections",
+ :default => "On"
+
+attribute "apache/keepaliverequests",
+ :display_name => "Apache Keepalive Requests",
+ :description => "Number of requests allowed on a persistent connection",
+ :default => "100"
+
+attribute "apache/keepalivetimeout",
+ :display_name => "Apache Keepalive Timeout",
+ :description => "Time to wait for requests on persistent connection",
+ :default => "5"
+
+attribute "apache/servertokens",
+ :display_name => "Apache Server Tokens",
+ :description => "Server response header",
+ :default => "Prod"
+
+attribute "apache/serversignature",
+ :display_name => "Apache Server Signature",
+ :description => "Configure footer on server-generated documents",
+ :default => "On"
+
+attribute "apache/traceenable",
+ :display_name => "Apache Trace Enable",
+ :description => "Determine behavior of TRACE requests",
+ :default => "On"
+
+attribute "apache/allowed_openids",
+ :display_name => "Apache Allowed OpenIDs",
+ :description => "Array of OpenIDs allowed to authenticate",
+ :default => ""
+
+attribute "apache/prefork",
+ :display_name => "Apache Prefork",
+ :description => "Hash of Apache prefork tuning attributes.",
+ :type => "hash"
+
+attribute "apache/prefork/startservers",
+ :display_name => "Apache Prefork MPM StartServers",
+ :description => "Number of MPM servers to start",
+ :default => "16"
+
+attribute "apache/prefork/minspareservers",
+ :display_name => "Apache Prefork MPM MinSpareServers",
+ :description => "Minimum number of spare server processes",
+ :default => "16"
+
+attribute "apache/prefork/maxspareservers",
+ :display_name => "Apache Prefork MPM MaxSpareServers",
+ :description => "Maximum number of spare server processes",
+ :default => "32"
+
+attribute "apache/prefork/serverlimit",
+ :display_name => "Apache Prefork MPM ServerLimit",
+ :description => "Upper limit on configurable server processes",
+ :default => "400"
+
+attribute "apache/prefork/maxclients",
+ :display_name => "Apache Prefork MPM MaxClients",
+ :description => "Maximum number of simultaneous connections",
+ :default => "400"
+
+attribute "apache/prefork/maxrequestsperchild",
+ :display_name => "Apache Prefork MPM MaxRequestsPerChild",
+ :description => "Maximum number of request a child process will handle",
+ :default => "10000"
+
+attribute "apache/worker",
+ :display_name => "Apache Worker",
+ :description => "Hash of Apache prefork tuning attributes.",
+ :type => "hash"
+
+attribute "apache/worker/startservers",
+ :display_name => "Apache Worker MPM StartServers",
+ :description => "Initial number of server processes to start",
+ :default => "4"
+
+attribute "apache/worker/maxclients",
+ :display_name => "Apache Worker MPM MaxClients",
+ :description => "Maximum number of simultaneous connections",
+ :default => "1024"
+
+attribute "apache/worker/minsparethreads",
+ :display_name => "Apache Worker MPM MinSpareThreads",
+ :description => "Minimum number of spare worker threads",
+ :default => "64"
+
+attribute "apache/worker/maxsparethreads",
+ :display_name => "Apache Worker MPM MaxSpareThreads",
+ :description => "Maximum number of spare worker threads",
+ :default => "192"
+
+attribute "apache/worker/threadsperchild",
+ :display_name => "Apache Worker MPM ThreadsPerChild",
+ :description => "Constant number of worker threads in each server process",
+ :default => "64"
+
+attribute "apache/worker/maxrequestsperchild",
+ :display_name => "Apache Worker MPM MaxRequestsPerChild",
+ :description => "Maximum number of request a child process will handle",
+ :default => "0"
View
209 cookbooks/apache2/recipes/default.rb
@@ -0,0 +1,209 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package "apache2" do
+ case node[:platform]
+ when "centos","redhat","fedora","suse"
+ package_name "httpd"
+ when "debian","ubuntu"
+ package_name "apache2"
+ when "arch"
+ package_name "apache"
+ end
+ action :install
+end
+
+service "apache2" do
+ case node[:platform]
+ when "centos","redhat","fedora","suse"
+ service_name "httpd"
+ # If restarted/reloaded too quickly httpd has a habit of failing.
+ # This may happen with multiple recipes notifying apache to restart - like
+ # during the initial bootstrap.
+ restart_command "/sbin/service httpd restart && sleep 1"
+ reload_command "/sbin/service httpd reload && sleep 1"
+ when "debian","ubuntu"
+ service_name "apache2"
+ restart_command "/usr/sbin/invoke-rc.d apache2 restart && sleep 1"
+ reload_command "/usr/sbin/invoke-rc.d apache2 reload && sleep 1"
+ when "arch"
+ service_name "httpd"
+ end
+ supports value_for_platform(
+ "debian" => { "4.0" => [ :restart, :reload ], "default" => [ :restart, :reload, :status ] },
+ "ubuntu" => { "default" => [ :restart, :reload, :status ] },
+ "centos" => { "default" => [ :restart, :reload, :status ] },
+ "redhat" => { "default" => [ :restart, :reload, :status ] },
+ "fedora" => { "default" => [ :restart, :reload, :status ] },
+ "arch" => { "default" => [ :restart, :reload, :status ] },
+ "default" => { "default" => [:restart, :reload ] }
+ )
+ action :enable
+end
+
+if platform?("centos", "redhat", "fedora", "suse", "arch")
+ directory node[:apache][:log_dir] do
+ mode 0755
+ action :create
+ end
+
+ cookbook_file "/usr/local/bin/apache2_module_conf_generate.pl" do
+ source "apache2_module_conf_generate.pl"
+ mode 0755
+ owner "root"
+ group "root"
+ end
+
+ %w{sites-available sites-enabled mods-available mods-enabled}.each do |dir|
+ directory "#{node[:apache][:dir]}/#{dir}" do
+ mode 0755
+ owner "root"
+ group "root"
+ action :create
+ end
+ end
+
+ execute "generate-module-list" do
+ if node[:kernel][:machine] == "x86_64"
+ libdir = value_for_platform("arch" => { "default" => "lib" }, "default" => "lib64")
+ else
+ libdir = "lib"
+ end
+ command "/usr/local/bin/apache2_module_conf_generate.pl /usr/#{libdir}/httpd/modules /etc/httpd/mods-available"
+ action :run
+ end
+
+ %w{a2ensite a2dissite a2enmod a2dismod}.each do |modscript|
+ template "/usr/sbin/#{modscript}" do
+ source "#{modscript}.erb"
+ mode 0755
+ owner "root"
+ group "root"
+ end
+ end
+
+ # installed by default on centos/rhel, remove in favour of mods-enabled
+ file "#{node[:apache][:dir]}/conf.d/proxy_ajp.conf" do
+ action :delete
+ backup false
+ end
+ file "#{node[:apache][:dir]}/conf.d/README" do
+ action :delete
+ backup false
+ end
+
+ # welcome page moved to the default-site.rb temlate
+ file "#{node[:apache][:dir]}/conf.d/welcome.conf" do
+ action :delete
+ backup false
+ end
+end
+
+directory "#{node[:apache][:dir]}/ssl" do
+ action :create
+ mode 0755
+ owner "root"
+ group "root"
+end
+
+directory "#{node[:apache][:dir]}/conf.d" do
+ action :create
+ mode 0755
+ owner "root"
+ group "root"
+end
+
+directory node[:apache][:cache_dir] do
+ action :create
+ mode 0755
+ owner node[:apache][:user]
+end
+
+template "apache2.conf" do
+ case node[:platform]
+ when "centos","redhat","fedora","arch"
+ path "#{node[:apache][:dir]}/conf/httpd.conf"
+ when "debian","ubuntu"
+ path "#{node[:apache][:dir]}/apache2.conf"
+ end
+ source "apache2.conf.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "security" do
+ path "#{node[:apache][:dir]}/conf.d/security"
+ source "security.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ backup false
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "charset" do
+ path "#{node[:apache][:dir]}/conf.d/charset"
+ source "charset.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ backup false
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "#{node[:apache][:dir]}/ports.conf" do
+ source "ports.conf.erb"
+ group "root"
+ owner "root"
+ variables :apache_listen_ports => node[:apache][:listen_ports]
+ mode 0644
+ notifies :restart, resources(:service => "apache2")
+end
+
+template "#{node[:apache][:dir]}/sites-available/default" do
+ source "default-site.erb"
+ owner "root"
+ group "root"
+ mode 0644
+ notifies :restart, resources(:service => "apache2")
+end
+
+include_recipe "apache2::mod_status"
+include_recipe "apache2::mod_alias"
+include_recipe "apache2::mod_auth_basic"
+include_recipe "apache2::mod_authn_file"
+include_recipe "apache2::mod_authz_default"
+include_recipe "apache2::mod_authz_groupfile"
+include_recipe "apache2::mod_authz_host"
+include_recipe "apache2::mod_authz_user"
+include_recipe "apache2::mod_autoindex"
+include_recipe "apache2::mod_dir"
+include_recipe "apache2::mod_env"
+include_recipe "apache2::mod_mime"
+include_recipe "apache2::mod_negotiation"
+include_recipe "apache2::mod_setenvif"
+include_recipe "apache2::mod_log_config" if platform?("centos", "redhat", "fedora", "suse", "arch")
+
+apache_site "default" if platform?("centos", "redhat", "fedora")
+
+service "apache2" do
+ action :start
+end
View
33 cookbooks/apache2/recipes/god_monitor.rb
@@ -0,0 +1,33 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: god_monitor
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_service = service "apache2" do
+ action :nothing
+end
+
+start_command = apache_service.start_command
+stop_command = apache_service.stop_command
+restart_command = apache_service.restart_command
+
+god_monitor "apache2" do
+ config "apache2.god.erb"
+ start (start_command)?start_command : "/etc/init.d/#{apache_service.service_name} start"
+ restart (restart_command)?restart_command : "/etc/init.d/#{apache_service.service_name} restart"
+ stop (stop_command)?stop_command : "/etc/init.d/#{apache_service.service_name} stop"
+end
View
22 cookbooks/apache2/recipes/mod_alias.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: alias
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "alias" do
+ conf true
+end
View
20 cookbooks/apache2/recipes/mod_auth_basic.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: auth_basic
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "auth_basic"
View
20 cookbooks/apache2/recipes/mod_auth_digest.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: auth_digest
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "auth_digest"
View
83 cookbooks/apache2/recipes/mod_auth_openid.rb
@@ -0,0 +1,83 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: mod_auth_openid
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+openid_dev_pkgs = value_for_platform(
+ "ubuntu" => { "default" => %w{ apache2-prefork-dev libopkele-dev libopkele3 } },
+ "debian" => { "default" => %w{ apache2-prefork-dev libopkele-dev libopkele3 } },
+ "arch" => { "default" => ["libopkele"] }
+)
+
+case node[:platform]
+when "arch"
+ include_recipe "pacman"
+ package "tidyhtml"
+end
+
+openid_dev_pkgs.each do |pkg|
+ case node[:platform]
+ when "arch"
+ pacman_aur pkg do
+ action [:build, :install]
+ end
+ else
+ package pkg
+ end
+end
+
+remote_file "#{Chef::Config[:file_cache_path]}/mod_auth_openid-0.4.tar.gz" do
+ source "http://butterfat.net/releases/mod_auth_openid/mod_auth_openid-0.4.tar.gz"
+ mode 0644
+end
+
+bash "install mod_auth_openid" do
+ cwd Chef::Config[:file_cache_path]
+ code <<-EOH
+ tar zxvf mod_auth_openid-0.4.tar.gz
+ cd mod_auth_openid-0.4 && ./configure
+ perl -pi -e "s/-i -a -n 'authopenid'/-i -n 'authopenid'/g" Makefile
+ make && make install
+ EOH
+ case node[:platform]
+ when "arch"
+ not_if { ::File.exists?("/usr/lib/httpd/modules/mod_auth_openid.so") }
+ else
+ not_if { ::File.exists?("/usr/lib/apache2/modules/mod_auth_openid.so") }
+ end
+end
+
+file "#{node[:apache][:cache_dir]}/mod_auth_openid.db" do
+ owner node[:apache][:user]
+ mode 0640
+end
+
+template "#{node[:apache][:dir]}/mods-available/authopenid.load" do
+ source "mods/authopenid.load.erb"
+ owner "root"
+ group "root"
+ mode 0644
+end
+
+apache_module "authopenid"
+
+template "/usr/local/bin/mod_auth_openid.rb" do
+ source "mod_auth_openid.rb.erb"
+ owner node[:apache][:user]
+ group node[:apache][:user]
+ mode 0750
+end
View
20 cookbooks/apache2/recipes/mod_authn_file.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authn_file
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authn_file"
View
20 cookbooks/apache2/recipes/mod_authnz_ldap.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authnz_ldap
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authnz_ldap"
View
20 cookbooks/apache2/recipes/mod_authz_default.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_default
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_default"
View
20 cookbooks/apache2/recipes/mod_authz_groupfile.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_groupfile
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_groupfile"
View
20 cookbooks/apache2/recipes/mod_authz_host.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_host
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_host"
View
20 cookbooks/apache2/recipes/mod_authz_user.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: authz_user
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "authz_user"
View
22 cookbooks/apache2/recipes/mod_autoindex.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: autoindex
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "autoindex" do
+ conf true
+end
View
20 cookbooks/apache2/recipes/mod_cgi.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: cgi
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "cgi"
View
20 cookbooks/apache2/recipes/mod_dav.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: dav
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "dav"
View
22 cookbooks/apache2/recipes/mod_dav_svn.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: dav_svn
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+package "libapache2-svn"
+
+apache_module "dav_svn"
View
22 cookbooks/apache2/recipes/mod_deflate.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: deflate
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "deflate" do
+ conf true
+end
View
22 cookbooks/apache2/recipes/mod_dir.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: dir
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "dir" do
+ conf true
+end
View
20 cookbooks/apache2/recipes/mod_env.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: env
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "env"
View
20 cookbooks/apache2/recipes/mod_expires.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: expires
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "expires"
View
46 cookbooks/apache2/recipes/mod_fcgid.rb
@@ -0,0 +1,46 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: fcgid
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if platform?("debian", "ubuntu")
+ package "libapache2-mod-fcgid"
+elsif platform?("centos", "redhat", "fedora", "arch")
+ package "mod_fcgid" do
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+
+ file "#{node[:apache][:dir]}/conf.d/fcgid.conf" do
+ action :delete
+ backup false
+ end
+elsif platform?("suse")
+ apache_lib_path = node[:architecture] == "i386" ? "/usr/lib/httpd" : "/usr/lib64/httpd"
+ package "httpd-devel"
+ bash "install-fcgid" do
+ code <<-EOH
+(cd #{Chef::Config[:file_cache_path]}; wget http://superb-east.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz)
+(cd #{Chef::Config[:file_cache_path]}; tar zxvf mod_fcgid.2.2.tgz)
+(cd #{Chef::Config[:file_cache_path]}; perl -pi -e 's!/usr/local/apache2!#{apache_lib_path}!g' ./mod_fcgid.2.2/Makefile)
+(cd #{Chef::Config[:file_cache_path]}/mod_fcgid.2.2; make install)
+EOH
+ end
+end
+
+apache_module "fcgid" do
+ conf true
+end
View
20 cookbooks/apache2/recipes/mod_headers.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: headers
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "headers"
View
20 cookbooks/apache2/recipes/mod_ldap.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: ldap
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "ldap"
View
24 cookbooks/apache2/recipes/mod_log_config.rb
@@ -0,0 +1,24 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: log_config
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if platform?("centos", "redhat", "fedora", "suse", "arch")
+ apache_module "log_config"
+else
+ include_recipe "apache2"
+end
View
22 cookbooks/apache2/recipes/mod_mime.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: mime
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "mime" do
+ conf true
+end
View
22 cookbooks/apache2/recipes/mod_negotiation.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: negotiation
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "negotiation" do
+ conf true
+end
View
37 cookbooks/apache2/recipes/mod_php5.rb
@@ -0,0 +1,37 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: php5
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "debian", "ubuntu"
+ package "libapache2-mod-php5" do
+ action :install
+ end
+when "arch"
+ package "php-apache" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+when "centos", "redhat", "fedora"
+ package "php53" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+end
+
+apache_module "php5"
View
22 cookbooks/apache2/recipes/mod_proxy.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy" do
+ conf true
+end
View
20 cookbooks/apache2/recipes/mod_proxy_ajp.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_ajp"
View
20 cookbooks/apache2/recipes/mod_proxy_balancer.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_balancer"
View
20 cookbooks/apache2/recipes/mod_proxy_connect.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_connect"
View
20 cookbooks/apache2/recipes/mod_proxy_http.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: proxy_http
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "proxy_http"
View
32 cookbooks/apache2/recipes/mod_python.rb
@@ -0,0 +1,32 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: python
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+ when "debian", "ubuntu"
+ package "libapache2-mod-python" do
+ action :install
+ end
+ when "centos", "redhat", "fedora"
+ package "mod_python" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+end
+
+apache_module "python"
View
20 cookbooks/apache2/recipes/mod_rewrite.rb
@@ -0,0 +1,20 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: rewrite
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "rewrite"
View
22 cookbooks/apache2/recipes/mod_setenvif.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: setenvif
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "setenvif" do
+ conf true
+end
View
43 cookbooks/apache2/recipes/mod_ssl.rb
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: ssl
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+if platform?("centos", "redhat", "fedora")
+ package "mod_ssl" do
+ action :install
+ notifies :run, resources(:execute => "generate-module-list"), :immediately
+ end
+
+ file "#{node[:apache][:dir]}/conf.d/ssl.conf" do
+ action :delete
+ backup false
+ end
+end
+
+ports = node[:apache][:listen_ports].include?("443") ? node[:apache][:listen_ports] : [node[:apache][:listen_ports], "443"].flatten
+
+template "#{node[:apache][:dir]}/ports.conf" do
+ source "ports.conf.erb"
+ variables :apache_listen_ports => ports
+ notifies :restart, resources(:service => "apache2")
+ mode 0644
+end
+
+apache_module "ssl" do
+ conf true
+end
View
22 cookbooks/apache2/recipes/mod_status.rb
@@ -0,0 +1,22 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: status
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apache_module "status" do
+ conf true
+end
View
27 cookbooks/apache2/recipes/mod_wsgi.rb
@@ -0,0 +1,27 @@
+#
+# Cookbook Name:: apache2
+# Recipe:: python
+#
+# Copyright 2008-2009, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+case node[:platform]
+when "debian","ubuntu"
+ package "libapache2-mod-wsgi"
+when "redhat","centos","fedora", "arch"
+ package "mod_wsgi"
+end
+
+apache_module "wsgi"
View
22 cookbooks/apache2/templates/default/a2dismod.erb
@@ -0,0 +1,22 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which module would you like to disable?"
+ echo -n "Your choices are: "
+ ls $SYSCONFDIR/mods-enabled/*.load | \
+ sed -e "s,$SYSCONFDIR/mods-enabled/,,g" | sed -e 's/\.load$//g;' | xargs echo
+ echo -n "Module name? "
+ read MODNAME
+else
+ MODNAME=$1
+fi
+
+if ! [ -e $SYSCONFDIR/mods-enabled/$MODNAME.load ]; then
+ echo "This module is already disabled, or does not exist!"
+ exit 1
+fi
+
+rm -f $SYSCONFDIR/mods-enabled/$MODNAME.*
+echo "Module $MODNAME disabled; reload apache to fully disable."
View
29 cookbooks/apache2/templates/default/a2dissite.erb
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which site would you like to disable?"
+ echo -n "Your choices are: "
+ ls $node[:apache][:dir]/sites-enabled/* | \
+ sed -e "s,$SYSCONFDIR/sites-enabled/,,g" | xargs echo
+ echo -n "Site name? "
+ read SITENAME
+else
+ SITENAME=$1
+fi
+
+if [ $SITENAME = "default" ]; then
+ PRIORITY="000"
+fi
+
+if ! [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \
+ -e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then
+ echo "This site is already disabled, or does not exist!"
+ exit 1
+fi
+
+if ! rm $SYSCONFDIR/sites-enabled/$SITENAME 2>/dev/null; then
+ rm -f $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME"
+fi
+echo "Site $SITENAME disabled; reload apache to disable."
View
37 cookbooks/apache2/templates/default/a2enmod.erb
@@ -0,0 +1,37 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which module would you like to enable?"
+ echo -n "Your choices are: "
+ ls $SYSCONFDIR/mods-available/*.load | \
+ sed -e "s,$SYSCONFDIR/mods-available/,,g" | sed -e 's/\.load$//g;' | xargs echo
+ echo -n "Module name? "
+ read MODNAME
+else
+ MODNAME=$1
+fi
+
+#figure out if we're on a prefork or threaded mpm
+if [ -x /usr/sbin/apache2 ]; then
+ PREFORK=`/usr/sbin/apache2 -l | grep prefork || true`
+fi
+
+if [ -e $SYSCONFDIR/mods-enabled/$MODNAME.load && -e $SYSCONFDIR/mods-enabled/$MODNAME.conf ]; then
+ echo "This module is already enabled!"
+ exit 0
+fi
+
+if ! [ -e $SYSCONFDIR/mods-available/$MODNAME.load ]; then
+ echo "This module does not exist!"
+ exit 1
+fi
+
+for i in conf load; do
+ if [ -e $SYSCONFDIR/mods-available/$MODNAME.$i -a ! -e $SYSCONFDIR/mods-enabled/$MODNAME.$i ]; then
+ ln -sf $SYSCONFDIR/mods-available/$MODNAME.$i $SYSCONFDIR/mods-enabled/$MODNAME.$i;
+ fi
+done
+
+echo "Module $MODNAME installed; reload apache to enable."
View
38 cookbooks/apache2/templates/default/a2ensite.erb
@@ -0,0 +1,38 @@
+#!/bin/sh -e
+
+SYSCONFDIR='<%= node[:apache][:dir] %>'
+
+if [ -z $1 ]; then
+ echo "Which site would you like to enable?"
+ echo -n "Your choices are: "
+ ls $SYSCONFDIR/sites-available/* | \
+ sed -e "s,$SYSCONFDIR/sites-available/,,g" | xargs echo
+ echo -n "Site name? "
+ read SITENAME
+else
+ SITENAME=$1
+fi
+
+if [ $SITENAME = "default" ]; then
+ PRIORITY="000"
+fi
+
+if [ -e $SYSCONFDIR/sites-enabled/$SITENAME -o \
+ -e $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME" ]; then
+ echo "This site is already enabled!"
+ exit 0
+fi
+
+if ! [ -e $SYSCONFDIR/sites-available/$SITENAME ]; then
+ echo "This site does not exist!"
+ exit 1
+fi
+
+if [ $SITENAME = "default" ]; then
+ ln -sf $SYSCONFDIR/sites-available/$SITENAME \
+ $SYSCONFDIR/sites-enabled/"$PRIORITY"-"$SITENAME"
+else
+ ln -sf $SYSCONFDIR/sites-available/$SITENAME $SYSCONFDIR/sites-enabled/$SITENAME
+fi
+
+echo "Site $SITENAME installed; reload apache to enable."
View
232 cookbooks/apache2/templates/default/apache2.conf.erb
@@ -0,0 +1,232 @@
+#
+# Generated by Chef
+#
+# Based on the Ubuntu apache2.conf
+
+ServerRoot "<%= node[:apache][:dir] %>"
+
+#
+# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
+#
+<% if node[:platform] == "debian" || node[:platform] == "ubuntu" -%>
+LockFile /var/lock/apache2/accept.lock
+<% else %>
+LockFile logs/accept.lock
+<% end -%>
+
+#
+# PidFile: The file in which the server should record its process
+# identification number when it starts.
+#
+<% if node[:platform] == "debian" || node[:platform] == "ubuntu" -%>
+PidFile /var/run/apache2.pid
+<% elsif node[:platform] == "centos" || node[:platform] == "redhat" || node[:platform] == "fedora" -%>
+PidFile /var/run/httpd.pid
+<% elsif node[:platform] == "arch" -%>
+PidFile /var/run/httpd/httpd.pid
+<% else -%>
+PidFile logs/httpd.pid
+<% end -%>
+
+#
+# Timeout: The number of seconds before receives and sends time out.
+#
+Timeout <%= node[:apache][:timeout] %>
+
+#
+# KeepAlive: Whether or not to allow persistent connections (more than
+# one request per connection). Set to "Off" to deactivate.
+#
+KeepAlive <%= node[:apache][:keepalive] %>
+
+#
+# MaxKeepAliveRequests: The maximum number of requests to allow
+# during a persistent connection. Set to 0 to allow an unlimited amount.
+# We recommend you leave this number high, for maximum performance.
+#
+MaxKeepAliveRequests <%= node[:apache][:keepaliverequests] %>
+
+#
+# KeepAliveTimeout: Number of seconds to wait for the next request from the
+# same client on the same connection.
+#
+KeepAliveTimeout <%= node[:apache][:keepalivetimeout] %>
+
+##
+## Server-Pool Size Regulation (MPM specific)
+##
+
+# prefork MPM
+# StartServers: number of server processes to start
+# MinSpareServers: minimum number of server processes which are kept spare
+# MaxSpareServers: maximum number of server processes which are kept spare
+# MaxClients: maximum number of server processes allowed to start
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_prefork_module>
+ StartServers <%= node[:apache][:prefork][:startservers] %>
+ MinSpareServers <%= node[:apache][:prefork][:minspareservers] %>
+ MaxSpareServers <%= node[:apache][:prefork][:maxspareservers] %>
+ ServerLimit <%= node[:apache][:prefork][:serverlimit] %>
+ MaxClients <%= node[:apache][:prefork][:maxclients] %>
+ MaxRequestsPerChild <%= node[:apache][:prefork][:maxrequestsperchild] %>
+</IfModule>
+
+# worker MPM
+# StartServers: initial number of server processes to start
+# MaxClients: maximum number of simultaneous client connections
+# MinSpareThreads: minimum number of worker threads which are kept spare
+# MaxSpareThreads: maximum number of worker threads which are kept spare
+# ThreadsPerChild: constant number of worker threads in each server process
+# MaxRequestsPerChild: maximum number of requests a server process serves
+<IfModule mpm_worker_module>
+ StartServers <%= node[:apache][:worker][:startservers] %>
+ MaxClients <%= node[:apache][:worker][:maxclients] %>
+ MinSpareThreads <%= node[:apache][:worker][:minsparethreads] %>
+ MaxSpareThreads <%= node[:apache][:worker][:maxsparethreads] %>
+ ThreadsPerChild <%= node[:apache][:worker][:threadsperchild] %>
+ MaxRequestsPerChild <%= node[:apache][:worker][:maxrequestsperchild] %>
+</IfModule>
+
+User <%= node[:apache][:user] %>
+Group <%= node[:apache][:user] %>
+
+#
+# AccessFileName: The name of the file to look for in each directory
+# for additional configuration directives. See also the AllowOverride
+# directive.
+#
+
+AccessFileName .htaccess
+
+#
+# The following lines prevent .htaccess and .htpasswd files from being
+# viewed by Web clients.
+#
+<Files ~ "^\.ht">
+ Order allow,deny
+ Deny from all
+</Files>
+
+#
+# DefaultType is the default MIME type the server will use for a document
+# if it cannot otherwise determine one, such as from filename extensions.
+# If your server contains mostly text or HTML documents, "text/plain" is
+# a good value. If most of your content is binary, such as applications
+# or images, you may want to use "application/octet-stream" instead to
+# keep browsers from trying to display binary files as though they are
+# text.
+#
+DefaultType text/plain
+
+
+#
+# HostnameLookups: Log the names of clients or just their IP addresses
+# e.g., www.apache.org (on) or 204.62.129.132 (off).
+# The default is off because it'd be overall better for the net if people
+# had to knowingly turn this feature on, since enabling it means that
+# each client request will result in AT LEAST one lookup request to the
+# nameserver.
+#
+HostnameLookups Off
+
+# ErrorLog: The location of the error log file.
+# If you do not specify an ErrorLog directive within a <VirtualHost>
+# container, error messages relating to that virtual host will be
+# logged here. If you *do* define an error logfile for a <VirtualHost>
+# container, that host's errors will be logged there and not here.
+#
+ErrorLog <%= node[:apache][:log_dir] %>/error.log
+
+#
+# LogLevel: Control the number of messages logged to the error_log.
+# Possible values include: debug, info, notice, warn, error, crit,
+# alert, emerg.
+#
+LogLevel warn
+
+# Include module configuration:
+Include <%= node[:apache][:dir] %>/mods-enabled/*.load
+Include <%= node[:apache][:dir] %>/mods-enabled/*.conf
+
+# Include ports listing
+Include <%= node[:apache][:dir] %>/ports.conf
+
+#
+# The following directives define some format nicknames for use with
+# a CustomLog directive (see below).
+#
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%{Referer}i -> %U" referer
+LogFormat "%{User-agent}i" agent
+#
+
+# Customizable error responses come in three flavors:
+# 1) plain text 2) local redirects 3) external redirects
+#
+# Some examples:
+#ErrorDocument 500 "The server made a boo boo."
+#ErrorDocument 404 /missing.html
+#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
+#ErrorDocument 402 http://www.example.com/subscription_info.html
+#
+
+#
+# Putting this all together, we can internationalize error responses.
+#
+# We use Alias to redirect any /error/HTTP_<error>.html.var response to
+# our collection of by-error message multi-language collections. We use
+# includes to substitute the appropriate text.
+#
+# You can modify the messages' appearance without changing any of the
+# default HTTP_<error>.html.var files by adding the line:
+#
+# Alias /error/include/ "/your/include/path/"
+#
+# which allows you to create your own set of files by starting with the
+# /usr/share/apache2/error/include/ files and copying them to /your/include/path/,
+# even on a per-VirtualHost basis. The default include files will display
+# your Apache version number and your ServerAdmin email address regardless
+# of the setting of ServerSignature.
+#
+# The internationalized error documents require mod_alias, mod_include
+# and mod_negotiation. To activate them, uncomment the following 30 lines.
+
+# Alias /error/ "/usr/share/apache2/error/"
+#
+# <Directory "/usr/share/apache2/error">
+# AllowOverride None
+# Options IncludesNoExec
+# AddOutputFilter Includes html
+# AddHandler type-map var
+# Order allow,deny
+# Allow from all
+# LanguagePriority en cs de es fr it nl sv pt-br ro
+# ForceLanguagePriority Prefer Fallback
+# </Directory>
+#
+# ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
+# ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
+# ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
+# ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
+# ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
+# ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
+# ErrorDocument 410 /error/HTTP_GONE.html.var
+# ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
+# ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
+# ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
+# ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
+# ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
+# ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
+# ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var