some changes for v4 of openstreetmap-carto (add LUA transform script)
[osmrrze.git] / scripts / doosmupdate.sh
index 9491349eb7b0435b15744713a4a167e9be738c6e..786734e1c5ba0bd6eeb38fe7068ce5eebdd86411 100755 (executable)
@@ -3,16 +3,25 @@
 LOCKFILE=/home.local/osm/run/.osmupdate.lock
 CHANGESFILE=/home.local/osm/run/osmosis-changes.osc.gz
 EXPIRYFILE=/home.local/osm/run/expiredtiles.lst
+RERENDEREXPIREDTRIGGERFILE=/home.local/osm/run/rerenderexpiredtiles.setting
 OSMOSISWORKDIR=/home.local/osm/.osmosis
 WEBSTATEFILE=/var/www/lastdbupdate.txt
 # Note: set the expire-tiles to 3 less than the real maximum,
 # as this makes the tilelist MUCH shorter, and the tiles get rerendered
 # anyways due to the metatile-layout!
+#UPDATECMD="/usr/bin/osm2pgsql --slim --cache=8000 --append --database=osm \
+#           --style=/home.local/osm/dbstyle/osm2pgsql-new.style \
+#           --flat-nodes=/mnt/database/flatnodes/flatnodes.db \
+#           --hstore --multi-geometry \
+#           --expire-tiles=17-17 --expire-output=$EXPIRYFILE \
+#           $CHANGESFILE"
 UPDATECMD="/usr/bin/osm2pgsql --slim --cache=8000 --append --database=osm \
-           --style=/home.local/osm/dbstyle/osm2pgsql-new.style \
+           --style=/home.local/osm/dbstyle/openstreetmap-carto.style \
+           --tag-transform-script /home.local/osm/dbstyle/openstreetmap-carto.lua \
            --flat-nodes=/mnt/database/flatnodes/flatnodes.db \
-           --hstore --expire-tiles=17-17 \
-           --expire-output=$EXPIRYFILE  $CHANGESFILE"
+           --hstore --multi-geometry --number-processes 4 \
+           --expire-tiles=17-17 --expire-output=$EXPIRYFILE \
+           $CHANGESFILE"
 
 cleanup()
 {
@@ -68,18 +77,34 @@ echo "Update seems to have been successful."
 grep timestamp $OSMOSISWORKDIR/state.txt | sed -e 's/timestamp=//g' -e 's/T/ /g' -e 's/\\:/:/g' > $WEBSTATEFILE
 echo -n "Updated database: now at upstream state of "
 cat $WEBSTATEFILE
-touch /var/lib/tirex/tiles/planet-import-complete
+#touch /var/lib/tirex/tiles/planet-import-complete
 if [ -e $EXPIRYFILE ] ; then
-       echo "Expiryfile exists. Telling tirex to rerender the tiles mentioned there..."
-       echo "Number of lines: `wc -l $EXPIRYFILE`"
-       cat $EXPIRYFILE | /home.local/osm/bin/osmtilecleanup.pl \
-                                   --action rerenderexpiredlist --zoom 13-20 \
-                                   --rrs /home.local/osm/bin/osmrerenderwrapper.sh \
+       if [ -e $RERENDEREXPIREDTRIGGERFILE ] ; then
+               echo "Expiryfile and triggerfile  exists. Marking the tiles mentioned there as expired..."
+               echo "Number of lines: `wc -l $EXPIRYFILE`"
+               # Used to be zoom 13-20 but that causes too much load. Reduced to 15-20.
+               cat $EXPIRYFILE | sudo -u tirex /home.local/osm/bin/osmtilecleanup.pl \
+                                   --action touchexpiredlist --zoom 15-20 \
                                    /var/lib/tirex/tiles/osm
-       cat $EXPIRYFILE | /home.local/osm/bin/osmtilecleanup.pl \
-                                   --action rerenderexpiredlist --zoom 13-20 \
-                                   --rrs /home.local/osm/bin/osmrerenderwrapper-osmde.sh \
+               cat $EXPIRYFILE | sudo -u tirex /home.local/osm/bin/osmtilecleanup.pl \
+                                   --action touchexpiredlist --zoom 15-20 \
                                    /var/lib/tirex/tiles/osmde
+               cat $EXPIRYFILE | sudo -u tirex /home.local/osm/bin/osmtilecleanup.pl \
+                                   --action touchexpiredlist --zoom 15-20 \
+                                   /var/lib/tirex/tiles/osmhd
+               cat $EXPIRYFILE | sudo -u tirex /home.local/osm/bin/osmtilecleanup.pl \
+                                   --action touchexpiredlist --zoom 15-20 \
+                                   /var/lib/tirex/tiles/osmdehd
+               # Now immediately rerender all the tiles there that are in our area.
+               # The rest gets done on demand by mod_tile.
+               echo "Triggering rerendering of expired tiles in our area..."
+               tirex-batch --prio=31 --expire=+3600 --filter='exists;older(1450000000)' map=osm   bbox=10.93,49.37,11.14,49.63 z=15-20
+               tirex-batch --prio=31 --expire=+3600 --filter='exists;older(1450000000)' map=osmde bbox=10.93,49.37,11.14,49.63 z=15-20
+               tirex-batch --prio=31 --expire=+3600 --filter='exists;older(1450000000)' map=osmhd bbox=10.93,49.37,11.14,49.63 z=15-20
+               tirex-batch --prio=31 --expire=+3600 --filter='exists;older(1450000000)' map=osmdehd bbox=10.93,49.37,11.14,49.63 z=15-20
+       else
+               echo "Expiryfile exists but rerendering is disabled."
+       fi
        rm $EXPIRYFILE
 fi
 echo "Ending update script cleanly: `date`"
This page took 0.055435 seconds and 4 git commands to generate.