X-Git-Url: https://git.openstreetmap.org./chef.git/blobdiff_plain/ddb1840147187f05afa60aba2ca861b62443dac6..f7546eabebf1b335815bf9c5de2dd7689ac143e1:/cookbooks/tile/templates/default/replicate.erb diff --git a/cookbooks/tile/templates/default/replicate.erb b/cookbooks/tile/templates/default/replicate.erb index 24e418198..aa69177ec 100644 --- a/cookbooks/tile/templates/default/replicate.erb +++ b/cookbooks/tile/templates/default/replicate.erb @@ -2,9 +2,10 @@ # DO NOT EDIT - This file is being maintained by Chef -# Initialize timestamp with day of latest planet dump -# Setting to midnight ensures we get conistent data after first run -# osmosis --read-replication-interval-init +# Before running updates, the replication needs to be set up with the timestamp +# set to the day of the latest planet dump. Setting to midnight ensures we get +# conistent data after first run. osmosis --read-replication-interval-init is +# used to initially create the state file # Define exit handler function onexit { @@ -27,7 +28,7 @@ trap onexit EXIT while true do # Work out the name of the next file - file="changes-${sequenceNumber}.osm.gz" + file="changes-${sequenceNumber}.osc.gz" # Save state file so we can rollback if an error occurs cp state.txt state-prev.txt @@ -66,17 +67,22 @@ do echo "Fetched new data from ${prevSequenceNumber} to ${sequenceNumber} into ${file}" # Apply the changes to the database + osm2pgsql --database gis --slim --append --number-processes=1 \ <% if node[:tile][:node_file] -%> - osm2pgsql --slim --append --flat-nodes=<%= node[:tile][:node_file] %> ${file} -<% else -%> - osm2pgsql --slim --append ${file} + --flat-nodes=<%= node[:tile][:node_file] %> \ <% end -%> +<% if node[:tile][:styles][:default][:revision] >= "v4.0.0" -%> + --multi-geometry --hstore \ + --style=/srv/tile.openstreetmap.org/styles/default/openstreetmap-carto.style \ + --tag-transform-script=/srv/tile.openstreetmap.org/styles/default/openstreetmap-carto.lua \ +<% end -%> + ${file} # No need to rollback now rm state-prev.txt - # Expire tiles which are touched by the changes - sudo -u www-data /usr/local/bin/expire-tiles ${file} > /dev/null 2>&1 & + # Queue these changes for expiry processing + ln ${file} expire-queue/$file fi # Delete old downloads