Skip to content

Commit

Permalink
COOK-230, add mod_expires directives to server_proxy, add more mime t…
Browse files Browse the repository at this point in the history
…ypes to mod_deflate
  • Loading branch information
hobodave committed Dec 23, 2009
1 parent dae239f commit 71deaf6
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 3 deletions.
15 changes: 14 additions & 1 deletion apache2/templates/default/mods/deflate.conf.erb
@@ -1,3 +1,16 @@
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
</IfModule>
23 changes: 23 additions & 0 deletions chef/attributes/server_proxy.rb
@@ -0,0 +1,23 @@
#
# Author:: David Abdemoulaie <opscode@hobodave.com>
# Cookbook Name:: chef
# Attributes:: server_proxy
#
# Copyright 2009, David Abdemoulaie
#
# 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.

set_unless[:chef][:doc_root] = "/usr/share/chef-server-slice/public"

set_unless[:chef][:server_proxy][:css_expire_hours] = "120"
set_unless[:chef][:server_proxy][:js_expire_hours] = "24"
2 changes: 2 additions & 0 deletions chef/recipes/server_proxy.rb
Expand Up @@ -33,6 +33,8 @@
include_recipe "apache2::mod_proxy_balancer"
include_recipe "apache2::mod_rewrite"
include_recipe "apache2::mod_headers"
include_recipe "apache2::mod_expires"
include_recipe "apache2::mod_deflate"

directory "/etc/chef/certificates" do
owner "root"
Expand Down
20 changes: 18 additions & 2 deletions chef/templates/default/chef_server.conf.erb
Expand Up @@ -2,6 +2,14 @@
ServerName <%= @params[:server_name] %>
ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>

DocumentRoot <%= @node[:chef][:doc_root] %>

ExpiresActive On
ExpiresByType text/css "access plus <%= @node[:chef][:server_proxy][:css_expire_hours] %> hours"
ExpiresByType text/javascript "access plus <%= @node[:chef][:server_proxy][:js_expire_hours] %> hours"
ExpiresByType application/x-javascript "access plus <%= @node[:chef][:server_proxy][:js_expire_hours] %> hours"
ExpiresByType application/javascript "access plus <%= @node[:chef][:server_proxy][:js_expire_hours] %> hours"

<Proxy balancer://chef_server>
BalancerMember http://127.0.0.1:4000
Order deny,allow
Expand All @@ -11,7 +19,7 @@
LogLevel info
ErrorLog <%= @params[:log_dir] %>/<%= @params[:name] %>-error.log
CustomLog <%= @params[:log_dir] %>/<%= @params[:name] %>-access.log combined

SSLEngine On
SSLCertificateFile /etc/chef/certificates/<%= @params[:server_name] %>.pem
SSLCertificateKeyFile /etc/chef/certificates/<%= @params[:server_name] %>.pem
Expand All @@ -27,6 +35,14 @@
ServerName <%= @params[:server_name] %>
ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>

DocumentRoot <%= @node[:chef][:doc_root] %>

ExpiresActive On
ExpiresByType text/css "access plus <%= @node[:chef][:server_proxy][:css_expire_hours] %> hours"
ExpiresByType text/javascript "access plus <%= @node[:chef][:server_proxy][:js_expire_hours] %> hours"
ExpiresByType application/x-javascript "access plus <%= @node[:chef][:server_proxy][:js_expire_hours] %> hours"
ExpiresByType application/javascript "access plus <%= @node[:chef][:server_proxy][:js_expire_hours] %> hours"

<Proxy balancer://chef_server_openid>
BalancerMember http://127.0.0.1:4001
Order deny,allow
Expand All @@ -36,7 +52,7 @@
LogLevel info
ErrorLog <%= @params[:log_dir] %>/<%= @params[:name] %>-error.log
CustomLog <%= @params[:log_dir] %>/<%= @params[:name] %>-access.log combined

SSLEngine On
SSLCertificateFile /etc/chef/certificates/<%= @params[:server_name] %>.pem
SSLCertificateKeyFile /etc/chef/certificates/<%= @params[:server_name] %>.pem
Expand Down

0 comments on commit 71deaf6

Please sign in to comment.