]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/imagery/resources/layer.rb
Imagery - Add OSSV palette file
[chef.git] / cookbooks / imagery / resources / layer.rb
index dddd665221ec4bbc1cd17a1f93834447afa81093..8d9ffac141af9f8937845b27cc23e5f7acb452ab 100644 (file)
@@ -59,4 +59,42 @@ action :create do
     subscribes :restart, "template[/srv/imagery/mapserver/layer-#{name}.map]"
     subscribes :restart, "template[/etc/init/mapserv-fgi-layer-#{name}.conf]"
   end
+
+  directory "/srv/imagery/nginx/#{site}" do
+    owner "root"
+    group "root"
+    mode 0755
+    recursive true
+  end
+
+  template "/srv/imagery/nginx/#{site}/layer-#{name}.conf" do
+    cookbook "imagery"
+    source "nginx_imagery_layer_fragment.conf.erb"
+    owner "root"
+    group "root"
+    mode 0644
+    variables new_resource.to_hash
+    notifies :reload, "service[nginx]", :delayed
+  end
+end
+
+action :delete do
+  service "mapserv-fgi-layer-#{name}.conf" do
+    provider Chef::Provider::Service::Upstart
+    action [:stop, :disable]
+    supports :status => true, :restart => true, :reload => false
+  end
+
+  file "/srv/imagery/mapserver/layer-#{name}.map" do
+    action :delete
+  end
+
+  file "/etc/init/mapserv-fgi-layer-#{name}.conf" do
+    action :delete
+  end
+
+  file "/srv/imagery/nginx/#{site}/layer-#{name}.conf" do
+    action :delete
+    notifies :reload, "service[nginx]", :delayed
+  end
 end