Fix updates: Add env var support to tiles-update-expire, remove pam_loginuid, install db_replag
parent
4ad4a77041
commit
28e4e6fda5
|
@ -155,6 +155,10 @@ RUN cd /home/renderer/src/openstreetmap-carto && patch -p1 < external-data.yml.d
|
||||||
COPY ./style.diff /home/renderer/src/openstreetmap-carto
|
COPY ./style.diff /home/renderer/src/openstreetmap-carto
|
||||||
RUN cd /home/renderer/src/openstreetmap-carto && patch -p1 < style.diff
|
RUN cd /home/renderer/src/openstreetmap-carto && patch -p1 < style.diff
|
||||||
|
|
||||||
|
RUN grep -v pam_loginuid /etc/pam.d/cron > /etc/pam.d/cron.new && mv /etc/pam.d/cron.new /etc/pam.d/cron && \
|
||||||
|
sed 's!/var/cache/renderd/tiles!$1!' /home/renderer/src/mod_tile/utils/osmosis-db_replag > /usr/bin/osmosis-db_replag && \
|
||||||
|
chmod 755 /usr/bin/osmosis-db_replag
|
||||||
|
|
||||||
# Start running
|
# Start running
|
||||||
COPY run.sh /
|
COPY run.sh /
|
||||||
ENTRYPOINT ["/run.sh"]
|
ENTRYPOINT ["/run.sh"]
|
||||||
|
|
|
@ -27,7 +27,7 @@ podman run \
|
||||||
-e PGPORT=5432 \
|
-e PGPORT=5432 \
|
||||||
-e PGDB=osm \
|
-e PGDB=osm \
|
||||||
-e DOWNLOAD_PBF=https://download.geofabrik.de/russia-latest.osm.pbf \
|
-e DOWNLOAD_PBF=https://download.geofabrik.de/russia-latest.osm.pbf \
|
||||||
-e DOWNLOAD_POLY=https://download.geofabrik.de/russia.poly \
|
[-e DOWNLOAD_POLY=https://download.geofabrik.de/russia.poly \]
|
||||||
-e UPDATES=enabled \
|
-e UPDATES=enabled \
|
||||||
-v /run/postgresql:/run/postgresql \
|
-v /run/postgresql:/run/postgresql \
|
||||||
-v /home/osm/download:/data \
|
-v /home/osm/download:/data \
|
||||||
|
@ -53,6 +53,8 @@ podman run \
|
||||||
-v /run/postgresql:/run/postgresql \
|
-v /run/postgresql:/run/postgresql \
|
||||||
-v /home/osm/download:/data \
|
-v /home/osm/download:/data \
|
||||||
-v /home/osm/mod_tile:/var/lib/mod_tile \
|
-v /home/osm/mod_tile:/var/lib/mod_tile \
|
||||||
|
-v /home/osm/logs:/var/log/tiles \
|
||||||
|
-v /dev/log:/dev/log \
|
||||||
-p 8080:80 \
|
-p 8080:80 \
|
||||||
osm \
|
osm \
|
||||||
run
|
run
|
||||||
|
@ -133,7 +135,7 @@ You can find an example of the import performance to expect with this image on t
|
||||||
|
|
||||||
If you encounter such entries in the log, it will mean that the default shared memory limit (64 MB) is too low for the container and it should be raised:
|
If you encounter such entries in the log, it will mean that the default shared memory limit (64 MB) is too low for the container and it should be raised:
|
||||||
```
|
```
|
||||||
renderd[121]: ERROR: failed to render TILE ajt 2 0-3 0-3
|
renderd[121]: ERROR: failed to render TILE osm_retina 2 0-3 0-3
|
||||||
renderd[121]: reason: Postgis Plugin: ERROR: could not resize shared memory segment "/PostgreSQL.790133961" to 12615680 bytes: ### No space left on device
|
renderd[121]: reason: Postgis Plugin: ERROR: could not resize shared memory segment "/PostgreSQL.790133961" to 12615680 bytes: ### No space left on device
|
||||||
```
|
```
|
||||||
To raise it use `--shm-size` parameter. For example:
|
To raise it use `--shm-size` parameter. For example:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ export PATH=.:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
ACCOUNT=renderer
|
ACCOUNT=renderer
|
||||||
cd /home/$ACCOUNT/src/mod_tile/
|
cd /home/$ACCOUNT/src/mod_tile/
|
||||||
|
|
||||||
|
[ -f /home/$ACCOUNT/env ] && . /home/$ACCOUNT/env
|
||||||
|
export PGPASSWORD
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Extra OSM2PGSQL_OPTIONS may need setting if a tag transform script is
|
# Extra OSM2PGSQL_OPTIONS may need setting if a tag transform script is
|
||||||
# in use. See https://github.com/SomeoneElseOSM/SomeoneElse-style and
|
# in use. See https://github.com/SomeoneElseOSM/SomeoneElse-style and
|
||||||
|
@ -21,8 +24,7 @@ OSMOSIS_BIN=osmosis
|
||||||
OSM2PGSQL_BIN=osm2pgsql
|
OSM2PGSQL_BIN=osm2pgsql
|
||||||
TRIM_BIN=/home/$ACCOUNT/src/regional/trim_osc.py
|
TRIM_BIN=/home/$ACCOUNT/src/regional/trim_osc.py
|
||||||
|
|
||||||
DBNAME=gis
|
OSM2PGSQL_OPTIONS="-G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style ${OSM2PGSQL_EXTRA_ARGS}"
|
||||||
OSM2PGSQL_OPTIONS="-d $DBNAME -G --hstore --tag-transform-script /home/renderer/src/openstreetmap-carto/openstreetmap-carto.lua --number-processes ${THREADS:-4} -S /home/renderer/src/openstreetmap-carto/openstreetmap-carto.style ${OSM2PGSQL_EXTRA_ARGS}"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# When using trim_osc.py we can define either a bounding box (such as this
|
# When using trim_osc.py we can define either a bounding box (such as this
|
||||||
|
@ -31,7 +33,6 @@ OSM2PGSQL_OPTIONS="-d $DBNAME -G --hstore --tag-transform-script /home/renderer/
|
||||||
# This area will usually correspond to the data originally loaded.
|
# This area will usually correspond to the data originally loaded.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
TRIM_POLY_FILE="/var/lib/mod_tile/data.poly"
|
TRIM_POLY_FILE="/var/lib/mod_tile/data.poly"
|
||||||
TRIM_OPTIONS="-d $DBNAME"
|
|
||||||
#TRIM_REGION_OPTIONS="-b -14.17 48.85 2.12 61.27"
|
#TRIM_REGION_OPTIONS="-b -14.17 48.85 2.12 61.27"
|
||||||
TRIM_REGION_OPTIONS="-p $TRIM_POLY_FILE"
|
TRIM_REGION_OPTIONS="-p $TRIM_POLY_FILE"
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ fi
|
||||||
|
|
||||||
seq=`cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2`
|
seq=`cat $WORKOSM_DIR/state.txt | grep sequenceNumber | cut -d= -f2`
|
||||||
|
|
||||||
m_ok "start import from seq-nr $seq, replag is `osmosis-db_replag -h`"
|
m_ok "start import from seq-nr $seq, replag is `osmosis-db_replag /var/lib/mod_tile`"
|
||||||
|
|
||||||
/bin/cp $WORKOSM_DIR/state.txt $WORKOSM_DIR/last.state.txt
|
/bin/cp $WORKOSM_DIR/state.txt $WORKOSM_DIR/last.state.txt
|
||||||
m_ok "downloading diff"
|
m_ok "downloading diff"
|
||||||
|
@ -150,7 +151,12 @@ fi
|
||||||
|
|
||||||
if [ -f $TRIM_POLY_FILE ] ; then
|
if [ -f $TRIM_POLY_FILE ] ; then
|
||||||
m_ok "filtering diff"
|
m_ok "filtering diff"
|
||||||
if ! $TRIM_BIN $TRIM_OPTIONS $TRIM_REGION_OPTIONS -z $CHANGE_FILE $CHANGE_FILE 1>&2 2>> "$RUNLOG"; then
|
P=""
|
||||||
|
if [ "$PGPASSWORD" != "" ]; then
|
||||||
|
P=--password
|
||||||
|
fi
|
||||||
|
if ! $TRIM_BIN -d "$PGDB" --host "$PGHOST" --port "${PGPORT:-5432}" --user "$PGUSER" $P \
|
||||||
|
$TRIM_REGION_OPTIONS -z $CHANGE_FILE $CHANGE_FILE 1>&2 2>> "$RUNLOG"; then
|
||||||
m_error "Trim_osc error"
|
m_error "Trim_osc error"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -163,7 +169,8 @@ fi
|
||||||
# tiles in range to the list (note the "-" rather than ":" in the "-e"
|
# tiles in range to the list (note the "-" rather than ":" in the "-e"
|
||||||
# parameter).
|
# parameter).
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_MINZOOM-$EXPIRY_MAXZOOM $OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2> "$PGSQLLOG"; then
|
if ! $OSM2PGSQL_BIN -a --slim -e$EXPIRY_MINZOOM-$EXPIRY_MAXZOOM -H "$PGHOST" -P "${PGPORT:-5432}" -U "$PGUSER" -d "$PGDB" \
|
||||||
|
$OSM2PGSQL_OPTIONS -o "$EXPIRY_FILE.$$" $CHANGE_FILE 1>&2 2> "$PGSQLLOG"; then
|
||||||
m_error "osm2pgsql error"
|
m_error "osm2pgsql error"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -179,28 +186,26 @@ fi
|
||||||
m_ok "expiring tiles"
|
m_ok "expiring tiles"
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# When expiring tiles we need to define the style sheet if it's not "default".
|
# When expiring tiles we need to define the style sheet if it's not "default".
|
||||||
# In this case it's "ajt".
|
# In this case it's "osm_retina".
|
||||||
# Previously all tiles on the "dirty" list between $EXPIRY_MINZOOM and
|
# Previously all tiles on the "dirty" list between $EXPIRY_MINZOOM and
|
||||||
# $EXPIRY_MAXZOOM were dirtied. We currently re-render
|
# $EXPIRY_MAXZOOM were dirtied. We currently re-render
|
||||||
# tiles >= $EXPIRY_MINZOOM and < $EXPIRY_DELETEFROM, expiry from 14 and
|
# tiles >= $EXPIRY_MINZOOM and < $EXPIRY_DELETEFROM, expiry from 14 and
|
||||||
# delete >= $EXPIRY_DELETEFROM and <= $EXPIRY_MAXZOOM.
|
# delete >= $EXPIRY_DELETEFROM and <= $EXPIRY_MAXZOOM.
|
||||||
# The default path to renderd.sock is fixed.
|
# The default path to renderd.sock is fixed.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
if ! render_expired --map=ajt --min-zoom=$EXPIRY_MINZOOM --touch-from=$EXPIRY_TOUCHFROM --delete-from=$EXPIRY_DELETEFROM --max-zoom=$EXPIRY_MAXZOOM -s /var/run/renderd/renderd.sock < "$EXPIRY_FILE.$$" 2>&1 | tail -8 >> "$EXPIRYLOG"; then
|
if ! render_expired --map=osm_retina --min-zoom=$EXPIRY_MINZOOM --touch-from=$EXPIRY_TOUCHFROM \
|
||||||
|
--delete-from=$EXPIRY_DELETEFROM --max-zoom=$EXPIRY_MAXZOOM -t /var/lib/mod_tile \
|
||||||
|
-s /var/run/renderd/renderd.sock < "$EXPIRY_FILE.$$" 2>&1 | tail -8 >> "$EXPIRYLOG"; then
|
||||||
m_info "Expiry failed"
|
m_info "Expiry failed"
|
||||||
|
else
|
||||||
|
rm "$EXPIRY_FILE.$$"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm "$EXPIRY_FILE.$$"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Only remove the lock file after expiry (if system is slow we want to delay
|
# Only remove the lock file after expiry (if system is slow we want to delay
|
||||||
# the next import, not have multiple render_expired processes running)
|
# the next import, not have multiple render_expired processes running)
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
freelock "$LOCK_FILE"
|
freelock "$LOCK_FILE"
|
||||||
|
|
||||||
m_ok "Done with import"
|
m_ok "Done with import"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
8
run.sh
8
run.sh
|
@ -78,6 +78,14 @@ if [ "$1" = "run" ]; then
|
||||||
echo "export APACHE_ARGUMENTS='-D ALLOW_CORS'" >> /etc/apache2/envvars
|
echo "export APACHE_ARGUMENTS='-D ALLOW_CORS'" >> /etc/apache2/envvars
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "PGHOST='$PGHOST'" > /home/renderer/env
|
||||||
|
echo "PGPORT='$PGPORT'" >> /home/renderer/env
|
||||||
|
echo "PGUSER='$PGUSER'" >> /home/renderer/env
|
||||||
|
echo "PGDB='$PGDB'" >> /home/renderer/env
|
||||||
|
echo "PGPASSWORD='$PGPASSWORD'" >> /home/renderer/env
|
||||||
|
|
||||||
|
chown renderer /var/log/tiles
|
||||||
|
|
||||||
cd /home/renderer/src/openstreetmap-carto
|
cd /home/renderer/src/openstreetmap-carto
|
||||||
sed "s/ dbname: \"gis\"/ host: \"$PGHOST\"\n\
|
sed "s/ dbname: \"gis\"/ host: \"$PGHOST\"\n\
|
||||||
port: \"${PGPORT:-5432}\"\n\
|
port: \"${PGPORT:-5432}\"\n\
|
||||||
|
|
Loading…
Reference in New Issue