Imagery: add cache busting revision number
authorGrant Slater <git@firefishy.com>
Sun, 29 May 2016 18:27:46 +0000 (19:27 +0100)
committerGrant Slater <git@firefishy.com>
Sun, 29 May 2016 18:27:46 +0000 (19:27 +0100)
cookbooks/imagery/recipes/au_agri.rb
cookbooks/imagery/resources/layer.rb
cookbooks/imagery/templates/default/nginx_imagery_layer_fragment.conf.erb

index d17e726d5ec7c0aa24a6872bf2d29d23772e6dfe..85816c3f4f9726e11376e3ae08adba3a579164df 100644 (file)
@@ -31,4 +31,5 @@ imagery_layer "au_ga_agri" do
   background_colour "0 0 0" # Black
   projection "EPSG:3857"
   source "/data/imagery/au/agri/combine.vrt"
+  revision 1
 end
index 22509eb57403fc2b19d53a1f032033a66fd0cb35..e60ed7619db339566eb8650343ab8c12dfaf830c 100644 (file)
@@ -31,11 +31,10 @@ property :extent, String
 property :background_colour, String
 property :resample, String, :default => "average"
 property :imagemode, String
-property :extension, String,
-         :is => %w(png png8 jpeg),
-         :default => "png"
+property :extension, String, :default => "png"
 property :max_zoom, Fixnum, :default => 23
 property :url_aliases, [String, Array], :default => []
+property :revision, Fixnum, :default => 1
 
 action :create do
   template "/srv/imagery/mapserver/layer-#{layer}.map" do
@@ -53,7 +52,7 @@ action :create do
     environment "MS_MAPFILE" => "/srv/imagery/mapserver/layer-#{layer}.map",
                 "MS_MAP_PATTERN" => "^/srv/imagery/mapserver/",
                 "MS_ERRORFILE" => "/tmp/mapserver-layer-#{layer}.log",
-                "MS_DEBUGLEVEL" => "5"
+                "MS_DEBUGLEVEL" => "1"
     user "imagery"
     group "imagery"
     exec_start "/usr/bin/spawn-fcgi -n -s /run/mapserver-fastcgi/layer-#{layer}.socket -M 0666 -f /usr/lib/cgi-bin/mapserv"
index d5e4a420f98a6ed68100055f6018d89e3f07b4aa..50b3070c99abb908fc3e9f054dfb235b8a790ba6 100644 (file)
@@ -9,7 +9,7 @@ location ~* "^/layer/<%= @layer %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" {
 
   # Caching
   fastcgi_cache "fastcgi_cache_zone";
-  fastcgi_cache_key "<%= @layer %> $request_method $1 $2 $3";
+  fastcgi_cache_key "<%= @layer %><%= @revision %> $request_method $1 $2 $3";
   fastcgi_cache_lock on;
   fastcgi_cache_lock_timeout 30s;
   fastcgi_cache_valid 200 21d;