]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tile/templates/default/update-lowzoom.erb
build(deps): bump cookstyle from 8.4.0 to 8.5.0
[chef.git] / cookbooks / tile / templates / default / update-lowzoom.erb
1 #!/bin/bash
2
3 # DO NOT EDIT - This file is being maintained by Chef
4
5 # Define function to update tiles from z0 to z12 for style "<%= @style %>"
6 function update_tiles
7 {
8   render_old \
9     --timestamp=$(stat -c %Y "/srv/tile.openstreetmap.org/styles/<%= @style %>/project.xml") \
10     --tile-dir=/srv/tile.openstreetmap.org/tiles \
11     --socket=/run/renderd/renderd.sock \
12     --num-threads=<%= @threads %> \
13     --map="<%= @style %>" \
14     --max-load=<%= node.cpu_cores - 1 %> \
15     --min-zoom=0 --max-zoom=12
16 }
17
18 max_tries=120
19 count=0
20
21 # Loop running the update command until it suceeds
22 until update_tiles
23 do
24   count=$((count + 1))
25   if [ "$count" -ge "$max_tries" ]; then
26     echo "Aborting <%= @style %> after $max_tries failed attempts"
27     exit 1
28   fi
29   sleep 30
30 done
31
32 # Update timestamp for style "<%= @style %>"
33 touch \
34   --reference="/srv/tile.openstreetmap.org/styles/<%= @style %>/project.xml" \
35   "/srv/tile.openstreetmap.org/tiles/<%= @style %>/planet-import-complete"
36
37 exit 0