Rerender all low zoom tiles once a month
authorTom Hughes <tom@compton.nu>
Tue, 25 Jun 2013 18:08:23 +0000 (19:08 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 25 Jun 2013 18:09:14 +0000 (19:09 +0100)
cookbooks/tile/recipes/default.rb
cookbooks/tile/templates/default/render-lowzoom.cron.erb [new file with mode: 0644]
cookbooks/tile/templates/default/render-lowzoom.erb [new file with mode: 0644]

index 238e8e7..261c0e9 100644 (file)
@@ -398,6 +398,20 @@ template "/etc/logrotate.d/replicate" do
   mode 0644
 end
 
+template "/usr/local/bin/render-lowzoom" do
+  source "render-lowzoom.erb"
+  owner "root"
+  group "root"
+  mode 0755
+end
+
+template "/etc/cron.d/render-lowzoom" do
+  source "render-lowzoom.cron.erb"
+  owner "root"
+  group "root"
+  mode 0755
+end
+
 munin_plugin "mod_tile_fresh"
 munin_plugin "mod_tile_response"
 munin_plugin "mod_tile_zoom"
@@ -410,4 +424,3 @@ munin_plugin "renderd_zoom_time"
 munin_plugin "replication_delay" do
   conf "munin.erb"
 end
-
diff --git a/cookbooks/tile/templates/default/render-lowzoom.cron.erb b/cookbooks/tile/templates/default/render-lowzoom.cron.erb
new file mode 100644 (file)
index 0000000..b516a3d
--- /dev/null
@@ -0,0 +1,3 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+0 1 1-7 * * tile test $(date +%u) -eq 7 && /usr/local/bin/render-lowzoom
diff --git a/cookbooks/tile/templates/default/render-lowzoom.erb b/cookbooks/tile/templates/default/render-lowzoom.erb
new file mode 100644 (file)
index 0000000..de2a3dd
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# DO NOT EDIT - This file is being maintained by Chef
+
+# Send output to the log
+exec > /var/log/tile/render-lowzoom.log 2>&1
+<% node[:tile][:styles].each_key do |style| -%>
+
+# Update tiles from z0 to z12 for style "<%= @style %>"
+render_list \
+  --all --force \
+  --tile-dir=/srv/tile.openstreetmap.org/tiles \
+  --socket=/var/run/renderd/renderd.sock \
+  --num-threads=<%= ( node[:cpu][:total] - 2 ) / 4 %> \
+  --map="<%= style %>" \
+  --max-load=70 \
+  --min-zoom=0 --max-zoom=12
+<% end -%>
+
+exit 0