imagery: ensure mapserver is restarted when required
authorGrant Slater <git@firefishy.com>
Sat, 11 Jun 2016 18:59:56 +0000 (19:59 +0100)
committerGrant Slater <git@firefishy.com>
Sat, 11 Jun 2016 18:59:56 +0000 (19:59 +0100)
cookbooks/imagery/resources/layer.rb
cookbooks/imagery/templates/default/mapserver.map.erb

index b9fb548c35f794619108cad79b1fba72edd9f0ad..4e51cbee07dbf55f29a5c7554b9610892819cbed 100644 (file)
@@ -73,16 +73,18 @@ action :create do
     user "imagery"
     group "imagery"
     exec_start_pre "/bin/rm -f /run/mapserver-fastcgi/layer-#{layer}.socket"
     user "imagery"
     group "imagery"
     exec_start_pre "/bin/rm -f /run/mapserver-fastcgi/layer-#{layer}.socket"
-    exec_start "/usr/bin/spawn-fcgi -s /run/mapserver-fastcgi/layer-#{layer}.socket -M 0666 -P /run/mapserver-fastcgi/layer-#{layer}.pid -- /usr/bin/multiwatch -f 4 --signal=TERM -- /usr/lib/cgi-bin/mapserv"
+    exec_start "/usr/bin/spawn-fcgi -s /run/mapserver-fastcgi/layer-#{layer}.socket -M 0666 -P /run/mapserver-fastcgi/layer-#{layer}.pid -- /usr/bin/multiwatch -f 6 --signal=TERM -- /usr/lib/cgi-bin/mapserv"
     pid_file "/run/mapserver-fastcgi/layer-#{layer}.pid"
     type "forking"
     restart "always"
   end
 
   service "mapserv-fcgi-#{layer}" do
     pid_file "/run/mapserver-fastcgi/layer-#{layer}.pid"
     type "forking"
     restart "always"
   end
 
   service "mapserv-fcgi-#{layer}" do
+    provider Chef::Provider::Service::Systemd
     action [:enable, :start]
     action [:enable, :start]
+    supports :status => true, :restart => true, :reload => false
     subscribes :restart, "template[/srv/imagery/mapserver/layer-#{layer}.map]"
     subscribes :restart, "template[/srv/imagery/mapserver/layer-#{layer}.map]"
-    subscribes :restart, "systemd_service[mapserv-fcgi]"
+    subscribes :restart, "systemd_service[mapserv-fcgi-#{layer}]"
   end
 
   directory "/srv/imagery/nginx/#{site}" do
   end
 
   directory "/srv/imagery/nginx/#{site}" do
index fd30b07639eefbb4f8424b6434d1a5291bb9a286..84a3803d01256f76d373898d2c189561a72b1341 100644 (file)
@@ -48,7 +48,7 @@ MAP
     END
     STATUS       DEFAULT
     TYPE         RASTER
     END
     STATUS       DEFAULT
     TYPE         RASTER
-    PROCESSING "RESAMPLE=AVERAGE"
-    PROCESSING "CLOSE_CONNECTION=DEFER"
+    PROCESSING   "RESAMPLE=AVERAGE"
+    PROCESSING   "CLOSE_CONNECTION=DEFER"
   END # layer
 END
   END # layer
 END