tilecache: restart nginx on certificate change
authorGrant Slater <git@firefishy.com>
Tue, 15 Apr 2014 09:58:30 +0000 (10:58 +0100)
committerGrant Slater <git@firefishy.com>
Tue, 15 Apr 2014 10:38:46 +0000 (11:38 +0100)
cookbooks/tilecache/attributes/default.rb
cookbooks/tilecache/recipes/default.rb
cookbooks/tilecache/templates/default/nginx_tile_ssl.conf.erb

index e91bd96178dab5d304cd37e50fae092947532cd7..be6944bdc94cebc9a37d6e9daa1f17b32b37a45f 100644 (file)
@@ -11,3 +11,5 @@ default[:tilecache][:net_bucket_refill] = "32768"
 #Per Class C bucket size
 default[:tilecache][:net_bucket_size] = "33554432"
 
+default[:tilecache][:ssl][:certificate] = "tile.openstreetmap"
+
index 13f752cd1382c6527ea299cc906c254474bfd037..4711428a20343525b703bd2b1c01fb9ba74915dd 100644 (file)
@@ -17,7 +17,8 @@
 # limitations under the License.
 #
 
-node.default[:ssl][:certificates] = node[:ssl][:certificates] | [ "tile.openstreetmap" ]
+certificate = node[:tilecache][:ssl][:certificate]
+node.default[:ssl][:certificates] = node[:ssl][:certificates] | [ certificate ]
 
 include_recipe "ssl"
 include_recipe "squid"
@@ -78,6 +79,15 @@ end
 
 nginx_site "tile-ssl" do
   template "nginx_tile_ssl.conf.erb"
+  variables :certificate => certificate
+end
+
+service "nginx-certificate-restart" do
+  service_name "nginx"
+  action :nothing
+  subscribes :restart, "cookbook_file[/etc/ssl/certs/rapidssl.pem]"
+  subscribes :restart, "cookbook_file[/etc/ssl/certs/#{certificate}.pem]"
+  subscribes :restart, "file[/etc/ssl/private/#{certificate}.key]"
 end
 
 tilerenders.each do |render|
index 284b3dfd5b72cdc8e3b5b0c5b5597e5a68d23d45..1801232456bacdac1d5cb19a6e67fa863d2571d4 100644 (file)
@@ -2,8 +2,8 @@ server {
     listen       443 ssl;
     server_name  localhost;
 
-    ssl_certificate      /etc/ssl/certs/tile.openstreetmap.pem;
-    ssl_certificate_key  /etc/ssl/private/tile.openstreetmap.key;
+    ssl_certificate      /etc/ssl/certs/<%= @certificate %>.pem;
+    ssl_certificate_key  /etc/ssl/private/<%= @certificate %>.key;
 
     ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv3;
     ssl_ciphers aRSA+HIGH:+kEDH:+kRSA:!kSRP:!kPSK:+3DES:!MD5;