]> git.openstreetmap.org Git - chef.git/commitdiff
imagery: add backend retry upstream logic
authorGrant Slater <git@firefishy.com>
Fri, 7 Sep 2018 01:26:19 +0000 (02:26 +0100)
committerGrant Slater <git@firefishy.com>
Fri, 7 Sep 2018 01:26:19 +0000 (02:26 +0100)
cookbooks/imagery/templates/default/nginx_imagery.conf.erb
cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb

index ec8a7ca312fe815f475bcf44d94b8fe65afa4592..20e8d5642a39e94b3bd4df842e1369ecd5dd2d4f 100644 (file)
@@ -7,6 +7,11 @@ server {
     return 301 https://$host$request_uri;
 }
 
+upstream <%= @name %>_fastcgi {
+    server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>.socket";
+    server "unix:/var/run/mapserver-fastcgi/layer-<%= @name %>.socket";
+}
+
 server {
     listen [::]:443 ssl;
     listen *:443 ssl;
index 922ec7a9600107a58ec729dba9c140b88d3328fa..b96a6719c1e8d2951d84c30bcb185aeb059f42f9 100644 (file)
@@ -1,9 +1,8 @@
 # DO NOT EDIT - This file is being maintained by Chef
-
 location ~* "^/layer/<%= @layer %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" {
   # Override QUERY_STRING to force mapserver query parameters
   fastcgi_param QUERY_STRING "map=/srv/imagery/mapserver/layer-<%= @layer %>.map&mode=tile&layers=<%= @layer %>&tilemode=gmap&tile=$2+$3+$1";
-  fastcgi_pass "unix:/var/run/mapserver-fastcgi/layer-<%= @site %>.socket";
+  fastcgi_pass "<%= @site %>_fastcgi";
   fastcgi_buffers 8 64k;
   include fastcgi_params;
   fastcgi_param REQUEST_METHOD "GET";
@@ -27,6 +26,7 @@ location ~* "^/layer/<%= @layer %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" {
 
   fastcgi_catch_stderr "Image handling error";
 
+  fastcgi_next_upstream error timeout invalid_header http_500 http_503;
   fastcgi_next_upstream_tries 3;
 
   # Do not GZIP tiles