Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

setup 6 Drupal sites for testing Bakery over SSL

  • Loading branch information...
commit 6be53c1969c3e0258101002ce3a79b3c3f16f173 1 parent 801a4ee
@bjeavons authored
View
20 Vagrantfile
@@ -44,7 +44,25 @@ Vagrant::Config.run do |config|
:subs => ["d6.masterd7.vbox", "d7.masterd7.vbox"]
},
"d6subd7" => {:alias => "d6.masterd7.vbox", :core => "6", :master => "masterd7.vbox"},
- "d7subd7" => {:alias => "d7.masterd7.vbox", :core => "7", :master => "masterd7.vbox"}
+ "d7subd7" => {:alias => "d7.masterd7.vbox", :core => "7", :master => "masterd7.vbox"},
+ "smasterd7" => {
+ :alias => "smasterd7.vbox",
+ :core => "7",
+ :master => "smasterd7.vbox",
+ :subs => ["d6.smasterd7.vbox", "d7.smasterd7.vbox"],
+ :secure => true
+ },
+ "sd6subd7" => {:alias => "d6.smasterd7.vbox", :core => "6", :master => "smasterd7.vbox", :secure => true},
+ "sd7subd7" => {:alias => "d7.smasterd7.vbox", :core => "7", :master => "smasterd7.vbox", :secure => true},
+ "smasterd6" => {
+ :alias => "smasterd6.vbox",
+ :core => "6",
+ :master => "smasterd6.vbox",
+ :subs => ["d6.smasterd6.vbox", "d7.smasterd6.vbox"],
+ :secure => true
+ },
+ "sd6subd6" => {:alias => "d6.smasterd6.vbox", :core => "6", :master => "smasterd6.vbox", :secure => true},
+ "sd7subd6" => {:alias => "d7.smasterd6.vbox", :core => "7", :master => "smasterd6.vbox", :secure => true}
}
})
end
View
32 cookbooks/bakery/files/default/apache.pem
@@ -0,0 +1,32 @@
+-----BEGIN PRIVATE KEY-----
+MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBANusd+koWVDPAXxY
+HjoStvPWadmgO8kZ+UH/D4cS1TOx3K2hJXGOuvR9q1SB6S1nL6g53nWHkMi2eHwE
+ijCkFa7vSueOxXz2qvOm5VKZ4Hk5DQj6oEXSTYM1woXk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MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDbrHfpKFlQzwF8WB46Erbz
+1mnZoDvJGflB/w+HEtUzsdytoSVxjrr0fatUgektZy+oOd51h5DItnh8BIowpBWu
+70rnjsV89qrzpuVSmeB5OQ0I+qBF0k2DNcKF5LrVSwPwUXrjat29Qq3DZHhv1we0
+oGtX/xrgRS/MS7O272CpzQIDAQABo1AwTjAdBgNVHQ4EFgQUxRFnWMlDIL09OPLE
+9I5NwFnCkYkwHwYDVR0jBBgwFoAUxRFnWMlDIL09OPLE9I5NwFnCkYkwDAYDVR0T
+BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBJe7Dk8EOzSuJfmDgGv7trtPu3jdnx
+D8PWphhcfck0ZjDQzj3UxkDUWd0zuoMMim2n+faP+cO/26+YrN12e8nAXIg+kssD
+woTw+Ggc7VyPd+qx5QQz46xzfIMgRE39g+G16a6XluGqO6aYqsrSta3svqlxCJmY
+aAAKXNJocXCqAA==
+-----END CERTIFICATE-----
View
1,438 cookbooks/bakery/files/default/sd6subd6.sql
1,438 additions, 0 deletions not shown
View
1,439 cookbooks/bakery/files/default/sd6subd7.sql
1,439 additions, 0 deletions not shown
View
1,439 cookbooks/bakery/files/default/smasterd6.sql
1,439 additions, 0 deletions not shown
View
20 cookbooks/bakery/recipes/apps.rb
@@ -8,15 +8,20 @@
sites << site
# Configure the site vhost
web_app site do
- template "sites.conf.erb"
+ if attrs[:secure]
+ template "sites_ssl.conf.erb"
+ else
+ template "sites.conf.erb"
+ end
server_name site
server_aliases [site]
docroot "#{node[:www_root]}/#{name}/htdocs"
end
end
+# Allow sites within the vm to communicate
file '/etc/hosts' do
- content "127.0.0.1 localhost #{sites.join(' ')}
+ content "127.0.0.1 localhost ms-ubuntu-11 #{sites.join(' ')}
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
@@ -25,4 +30,13 @@
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts"
-end
+end
+
+# Create apache key and cert file
+cookbook_file "/etc/apache2/apache.pem" do
+ source "apache.pem"
+ mode 0755
+ owner "root"
+ group "root"
+ action :create_if_missing
+end
View
1  cookbooks/bakery/recipes/common.rb
@@ -42,3 +42,4 @@
content "[client]\nuser=root\npass=#{node[:mysql][:server_root_password]}"
action :create
end
+
View
63 cookbooks/bakery/templates/default/sites_ssl.conf.erb
@@ -0,0 +1,63 @@
+<VirtualHost *:443>
+ ServerName <%= @params[:server_name] %>
+ ServerAlias <% @params[:server_aliases].each do |a| %><%= "#{a}" %> <% end %>
+ DocumentRoot <%= @params[:docroot] %>
+ RewriteEngine On
+
+ SSLEngine on
+ SSLCertificateFile /etc/apache2/apache.pem
+
+ <Directory <%= @params[:docroot] %>>
+ Options FollowSymLinks
+ AllowOverride All
+ Order allow,deny
+ Allow from all
+ </Directory>
+
+ <Directory />
+ Options FollowSymLinks
+ AllowOverride None
+ </Directory>
+
+ <Location /server-status>
+ SetHandler server-status
+
+ Order Allow,Deny
+ Allow from all
+ </Location>
+
+ LogLevel info
+ ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
+ CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
+
+ RewriteEngine On
+ RewriteLog <%= node[:apache][:log_dir] %>/<%= @application_name %>-rewrite.log
+ # level 0 => Do not log rewrite
+ RewriteLogLevel 0
+
+ ###
+ # Canonical host, <%= @params[:server_name] %>
+ ###
+ # For sites running on a port other than 80
+ RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC]
+ RewriteCond %{HTTP_HOST} !^$
+ RewriteCond %{SERVER_PORT} !^80$
+ RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>:%{SERVER_PORT}/$1 [L,R=301]
+ # For sites running on port 80
+ RewriteCond %{HTTP_HOST} !^<%= @params[:server_name] %> [NC]
+ RewriteCond %{HTTP_HOST} !^$
+ RewriteRule ^/(.*)$ http://<%= @params[:server_name] %>/$1 [L,R=301]
+
+ ###
+ # Maintenance file
+ ###
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
+ RewriteRule ^.*$ /system/maintenance.html [L,R=302]
+ # For sites running on a port other than 80
+ RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
+ RewriteCond %{SCRIPT_FILENAME} !maintenance.html
+ RewriteCond %{SERVER_PORT} !^80$
+ RewriteRule ^.*$ http://<%= @params[:server_name] %>:%{SERVER_PORT}/system/maintenance.html [L,R=302]
+
+</VirtualHost>
Please sign in to comment.
Something went wrong with that request. Please try again.