]> git.openstreetmap.org Git - chef.git/commitdiff
taginfo: use pyosmium for planet updates
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 8 Aug 2018 21:44:50 +0000 (23:44 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 8 Aug 2018 21:44:50 +0000 (23:44 +0200)
cookbooks/taginfo/recipes/default.rb
cookbooks/taginfo/templates/default/update-planet.erb

index 4eb552e09ccf56fbb6be99aa03c545502f6fe93c..288f39a96d98f777e299ab1389f72bf1ad07d78e 100644 (file)
@@ -40,7 +40,7 @@ package %w[
 
 package %w[
   sqlite3
 
 package %w[
   sqlite3
-  osmosis
+  pyosmium
   curl
   pbzip2
 ]
   curl
   pbzip2
 ]
@@ -196,7 +196,7 @@ node[:taginfo][:sites].each do |site|
     notifies :restart, "passenger_application[#{directory}/taginfo/web/public]"
   end
 
     notifies :restart, "passenger_application[#{directory}/taginfo/web/public]"
   end
 
-  %w[taginfo/web/tmp bin data data/old download sources planet planet/log planet/replication].each do |dir|
+  %w[taginfo/web/tmp bin data data/old download sources planet planet/log].each do |dir|
     directory "#{directory}/#{dir}" do
       owner "taginfo"
       group "taginfo"
     directory "#{directory}/#{dir}" do
       owner "taginfo"
       group "taginfo"
@@ -212,19 +212,6 @@ node[:taginfo][:sites].each do |site|
     mode 0o644
   end
 
     mode 0o644
   end
 
-  template "#{directory}/planet/replication/configuration.txt" do
-    source "configuration.txt.erb"
-    owner "taginfo"
-    group "taginfo"
-    mode 0o644
-  end
-
-  file "#{directory}/planet/replication/download.lock" do
-    owner "taginfo"
-    group "taginfo"
-    mode 0o644
-  end
-
   template "#{directory}/bin/update-planet" do
     source "update-planet.erb"
     owner "taginfo"
   template "#{directory}/bin/update-planet" do
     source "update-planet.erb"
     owner "taginfo"
index 7f55c078ccb2ddb6d3a27da3215588f741b08721..db3d54c75470cbeb9aad500e38f9a25b8075833e 100644 (file)
@@ -2,10 +2,6 @@
 
 # DO NOT EDIT - This file is being maintained by Chef
 
 
 # DO NOT EDIT - This file is being maintained by Chef
 
-# abort on error
-
-set -e
-
 # setup
 
 PLANETDIR="<%= @directory %>/planet"
 # setup
 
 PLANETDIR="<%= @directory %>/planet"
@@ -13,36 +9,25 @@ LOGDIR="${PLANETDIR}/log"
 PLANETPREV="${PLANETDIR}/planet-previous.pbf"
 PLANETCURR="${PLANETDIR}/planet.pbf"
 PLANETNEW="${PLANETDIR}/planet-new.pbf"
 PLANETPREV="${PLANETDIR}/planet-previous.pbf"
 PLANETCURR="${PLANETDIR}/planet.pbf"
 PLANETNEW="${PLANETDIR}/planet-new.pbf"
-STATEDIR="${PLANETDIR}/replication"
-OSCFILE="${PLANETDIR}/$(date +%Y%m%d-%H%M).osc"
-OSCFILEPREV="${PLANETDIR}/previous.osc"
-
-OSMIUM=<%= @directory %>/osmium-tool/build/src/osmium
 
 # start logging
 
 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
 
 
 # start logging
 
 exec > "${LOGDIR}/$(date +%Y%m%d-%H%M).log" 2>&1
 
-# if there are old .osc files, they have to be taken into account
+retval=1
+while [ $retval -eq 1 ]; do
+    pyosmium-up-to-date -o $PLANETNEW $PLANETCURR
+    retval=$?
+done
 
 
-OLDFILE="$(find "${PLANETDIR}" -name "2*-*.osc" -print)"
-if [ -z "$OLDFILE" ]
-then
-   osmosis --rri "$STATEDIR" --simc --write-xml-change "$OSCFILE"
-else
-   osmosis --rxc "$OLDFILE" --rri "$STATEDIR" --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
+if [ $retval -ne 0 ]; then
+  exit $retval
 fi
 
 fi
 
-# osc file is ready, create new planet file
-
-#osmosis --read-xml-change "$OSCFILE" --read-bin "$PLANETCURR" --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf file="$PLANETNEW"
-$OSMIUM apply-changes --verbose --fsync --output=$PLANETNEW $PLANETCURR $OSCFILE
-
 # cleanup
 
 mv "$PLANETCURR" "$PLANETPREV"
 mv "$PLANETNEW" "$PLANETCURR"
 # cleanup
 
 mv "$PLANETCURR" "$PLANETPREV"
 mv "$PLANETNEW" "$PLANETCURR"
-mv "$OSCFILE" "$OSCFILEPREV"
 
 # expire old logs
 
 
 # expire old logs