Imagery - make mapserv upstart restart safe
authorGrant Slater <git@firefishy.com>
Sun, 31 Jan 2016 20:26:44 +0000 (20:26 +0000)
committerGrant Slater <git@firefishy.com>
Sun, 31 Jan 2016 20:31:04 +0000 (20:31 +0000)
cookbooks/imagery/recipes/default.rb
cookbooks/imagery/templates/default/mapserv_fcgi.conf.erb

index 7c3d186aaa642b744fd5385478235fe361444d32..99a8c1700768c13a465bb73e8f1dee97824633e6 100644 (file)
@@ -40,13 +40,6 @@ package "imagemagick"
 package "xz-utils"
 package "unzip"
 
-# Create Directory for mapserver-fastcgi imagery sockets
-directory "/var/run/mapserver-fastcgi" do
-  owner "imagery"
-  group "imagery"
-  mode 0755
-end
-
 directory "/srv/imagery/mapserver" do
   owner "root"
   group "root"
index 9f6e250932e8bd3c2bf816fd0ffa238d260c181d..4e71350fbeedb5901702e902bddf68b43dc483bd 100644 (file)
@@ -9,9 +9,6 @@ stop on runlevel [!2345]
 
 respawn
 
-setuid imagery
-setgid imagery
-
 limit nofile 16384 16384
 
 # https://trac.osgeo.org/mapserver/wiki/EnvironmentVariables
@@ -20,9 +17,16 @@ env MS_MAP_PATTERN="^/srv/imagery/mapserver/"
 env MS_ERRORFILE="/tmp/mapserver-layer-<%= @name %>.log"
 env MS_DEBUGLEVEL="5"
 
+pre-start script
+    mkdir -p -m 0775 /var/run/mapserver-fastcgi
+    chown imagery:imagery /var/run/mapserver-fastcgi
+end script
+
 script
     exec /usr/bin/spawn-fcgi \
         -n \
+        -u imagery \
+        -g imagery \
         -s /var/run/mapserver-fastcgi/layer-<%= @name %>.socket \
         -M 0666 \
         -f /usr/lib/cgi-bin/mapserv