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
--- /dev/null
+# DO NOT EDIT - This file is being maintained by Chef
+
+location ~* "^/layer/<%= @name %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" {
+ fastcgi_param QUERY_STRING "map=/srv/imagery/<%= @name %>.map&mode=tile&layers=<%= @name %>&tilemode=gmap&tile=$2+$3+$1";
+ fastcgi_pass "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>.socket";
+ include fastcgi_params;
+ gzip off;
+}