From: Tom Hughes Date: Tue, 25 Jun 2013 17:42:17 +0000 (+0100) Subject: Improve low zoom rerender script X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/8b2c27656d2827c725673084ec95c8ca0b01b6d1 Improve low zoom rerender script --- diff --git a/cookbooks/tile/recipes/default.rb b/cookbooks/tile/recipes/default.rb index cc2f6ea5f..238e8e79d 100644 --- a/cookbooks/tile/recipes/default.rb +++ b/cookbooks/tile/recipes/default.rb @@ -182,25 +182,6 @@ node[:tile][:data].each do |name,data| end end -template "/usr/local/bin/render-lowzoom" do - source "render-lowzoom.erb" - owner "root" - group "root" - mode 0755 -end - -template "/etc/init.d/render-lowzoom" do - source "render-lowzoom.init.erb" - owner "root" - group "root" - mode 0755 -end - -service "render-lowzoom" do - action :disable - supports :restart => true -end - nodejs_package "carto" nodejs_package "millstone" @@ -214,6 +195,27 @@ node[:tile][:styles].each do |name,details| style_directory = "/srv/tile.openstreetmap.org/styles/#{name}" tile_directory = "/srv/tile.openstreetmap.org/tiles/#{name}" + template "/usr/local/bin/update-lowzoom-#{name}" do + source "update-lowzoom.erb" + owner "root" + group "root" + mode 0755 + variables :style => name + end + + template "/etc/init.d/update-lowzoom-#{name}" do + source "update-lowzoom.init.erb" + owner "root" + group "root" + mode 0755 + variables :style => name + end + + service "update-lowzoom-#{name}" do + action :disable + supports :restart => true + end + file "#{tile_directory}/planet-import-complete" do action :create_if_missing owner "tile" @@ -243,7 +245,7 @@ node[:tile][:styles].each do |name,details| group "tile" subscribes :run, "git[#{style_directory}]" notifies :restart, "service[renderd]" - notifies :restart, "service[render-lowzoom]" + notifies :restart, "service[update-lowzoom-#{name}]" end end diff --git a/cookbooks/tile/templates/default/render-lowzoom.erb b/cookbooks/tile/templates/default/render-lowzoom.erb deleted file mode 100644 index f4aeb4faf..000000000 --- a/cookbooks/tile/templates/default/render-lowzoom.erb +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -# DO NOT EDIT - This file is being maintained by Chef - -# Send output to the log -exec > /var/log/tile/renderd-lowzoom.log 2>&1 -<% node[:tile][:styles].each do |name,details| -%> - -# Update low zoom tiles for style "<%= name %>" -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="<%= name %>" \ - --max-load=70 \ - --min-zoom=0 --max-zoom=12 - -# Update timestamp for style "<%= name %>" -touch \ - --reference="/srv/tile.openstreetmap.org/styles/<%= name %>/project.mml" \ - "/srv/tile.openstreetmap.org/tiles/<%= name %>/planet-import-complete" -<% end -%> - -exit 0 diff --git a/cookbooks/tile/templates/default/update-lowzoom.erb b/cookbooks/tile/templates/default/update-lowzoom.erb new file mode 100644 index 000000000..a3d2ee291 --- /dev/null +++ b/cookbooks/tile/templates/default/update-lowzoom.erb @@ -0,0 +1,32 @@ +#!/bin/bash + +# DO NOT EDIT - This file is being maintained by Chef + +# Send output to the log +exec > /var/log/tile/update-lowzoom-<%= @style %>.log 2>&1 + +# Update tiles from z0 to z10 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=10 + +# Update timestamp for style "<%= @style %>" +touch \ + --reference="/srv/tile.openstreetmap.org/styles/<%= @style %>/project.mml" \ + "/srv/tile.openstreetmap.org/tiles/<%= @style %>/planet-import-complete" + +# Update tiles from z11 to z12 for style "<%= @style %>" +render_old \ + --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=11 --max-zoom=12 + +exit 0 diff --git a/cookbooks/tile/templates/default/render-lowzoom.init.erb b/cookbooks/tile/templates/default/update-lowzoom.init.erb similarity index 51% rename from cookbooks/tile/templates/default/render-lowzoom.init.erb rename to cookbooks/tile/templates/default/update-lowzoom.init.erb index 986ce880a..3439f09b6 100644 --- a/cookbooks/tile/templates/default/render-lowzoom.init.erb +++ b/cookbooks/tile/templates/default/update-lowzoom.init.erb @@ -3,11 +3,11 @@ # DO NOT EDIT - This file is being maintained by Chef start() { - start-stop-daemon --start --chuid tile --background --make-pidfile -pidfile /var/run/render-lowzoom.pid --exec /usr/local/bin/render-lowzoom + start-stop-daemon --start --chuid tile --background --make-pidfile -pidfile /var/run/update-lowzoom-<%= @style %>.pid --exec /usr/local/bin/update-lowzoom-<%= @style %> } stop() { - start-stop-daemon --stop --retry 300 --pidfile /var/run/render-lowzoom.pid --exec /usr/local/bin/render-lowzoom + start-stop-daemon --stop --retry 300 --pidfile /var/run/update-lowzoom-<%= @style %>.pid --exec /usr/local/bin/update-lowzoom-<%= @style %> } case "$1" in