update to debian trixie; postgres 18; fix cron; use tcmalloc
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -1,4 +1,4 @@
|
|||||||
FROM ubuntu:24.04@sha256:7c06e91f61fa88c08cc74f7e1b7c69ae24910d745357e0dfe1d2c0322aaf20f9 AS compiler-common
|
FROM debian:trixie AS compiler-common
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
ENV LC_ALL=C.UTF-8
|
ENV LC_ALL=C.UTF-8
|
||||||
@@ -8,9 +8,9 @@ RUN apt-get update \
|
|||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates gnupg lsb-release locales \
|
ca-certificates gnupg lsb-release locales \
|
||||||
wget curl \
|
wget curl \
|
||||||
git-core unzip unrar postgresql-common \
|
git-core unzip unrar-free postgresql-common \
|
||||||
&& locale-gen $LANG && update-locale LANG=$LANG \
|
&& locale-gen $LANG && update-locale LANG=$LANG \
|
||||||
&& /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -i -v 17\
|
&& /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -i -v 18 \
|
||||||
&& apt-get update && apt-get -y upgrade\
|
&& apt-get update && apt-get -y upgrade\
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
@@ -49,7 +49,7 @@ ENV AUTOVACUUM=on
|
|||||||
ENV UPDATES=disabled
|
ENV UPDATES=disabled
|
||||||
ENV REPLICATION_URL=https://planet.openstreetmap.org/replication/hour/
|
ENV REPLICATION_URL=https://planet.openstreetmap.org/replication/hour/
|
||||||
ENV MAX_INTERVAL_SECONDS=3600
|
ENV MAX_INTERVAL_SECONDS=3600
|
||||||
ENV PG_VERSION=17
|
ENV PG_VERSION=18
|
||||||
|
|
||||||
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
|
RUN ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime && echo "$TZ" > /etc/timezone
|
||||||
|
|
||||||
@@ -84,6 +84,7 @@ RUN apt-get update \
|
|||||||
python3-shapely \
|
python3-shapely \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
renderd \
|
renderd \
|
||||||
|
libgoogle-perftools4 \
|
||||||
sudo \
|
sudo \
|
||||||
vim \
|
vim \
|
||||||
pipx \
|
pipx \
|
||||||
@@ -136,7 +137,7 @@ RUN chmod +x /usr/bin/openstreetmap-tiles-update-expire.sh \
|
|||||||
&& mkdir /var/log/tiles \
|
&& mkdir /var/log/tiles \
|
||||||
&& chmod a+rw /var/log/tiles \
|
&& chmod a+rw /var/log/tiles \
|
||||||
&& ln -s /home/renderer/src/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag \
|
&& ln -s /home/renderer/src/mod_tile/osmosis-db_replag /usr/bin/osmosis-db_replag \
|
||||||
&& echo "* * * * * renderer openstreetmap-tiles-update-expire.sh\n" >> /etc/crontab
|
&& echo "* * * * * renderer openstreetmap-tiles-update-expire.sh" >> /etc/crontab
|
||||||
|
|
||||||
# Configure PosgtreSQL
|
# Configure PosgtreSQL
|
||||||
COPY postgresql.custom.conf.tmpl /etc/postgresql/$PG_VERSION/main/
|
COPY postgresql.custom.conf.tmpl /etc/postgresql/$PG_VERSION/main/
|
||||||
|
|||||||
@@ -14,5 +14,6 @@
|
|||||||
|
|
||||||
<IfDefine ALLOW_CORS>
|
<IfDefine ALLOW_CORS>
|
||||||
Header set Access-Control-Allow-Origin "*"
|
Header set Access-Control-Allow-Origin "*"
|
||||||
|
Header set Access-Control-Allow-Methods "GET, OPTIONS"
|
||||||
</IfDefine>
|
</IfDefine>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
[renderd]
|
[renderd]
|
||||||
stats_file=/run/renderd/renderd.stats
|
stats_file=/run/renderd/renderd.stats
|
||||||
socketname=/run/renderd/renderd.sock
|
socketname=/run/renderd/renderd.sock
|
||||||
num_threads=4
|
num_threads=16
|
||||||
tile_dir=/var/cache/renderd/tiles
|
tile_dir=/var/cache/renderd/tiles
|
||||||
|
|
||||||
[mapnik]
|
[mapnik]
|
||||||
plugins_dir=/usr/lib/mapnik/3.1/input
|
plugins_dir=/usr/lib/x86_64-linux-gnu/mapnik/4.0/input
|
||||||
font_dir=/usr/share/fonts
|
font_dir=/usr/share/fonts
|
||||||
font_dir_recurse=true
|
font_dir_recurse=true
|
||||||
|
|
||||||
|
|||||||
12
run.sh
12
run.sh
@@ -64,7 +64,7 @@ if [ "$1" == "import" ]; then
|
|||||||
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO renderer;"
|
sudo -u postgres psql -d gis -c "ALTER TABLE geometry_columns OWNER TO renderer;"
|
||||||
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO renderer;"
|
sudo -u postgres psql -d gis -c "ALTER TABLE spatial_ref_sys OWNER TO renderer;"
|
||||||
setPostgresPassword
|
setPostgresPassword
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Download Luxembourg as sample if no data is provided
|
# Download Luxembourg as sample if no data is provided
|
||||||
if [ ! -f /data/region.osm.pbf ] && [ -z "${DOWNLOAD_PBF:-}" ]; then
|
if [ ! -f /data/region.osm.pbf ] && [ -z "${DOWNLOAD_PBF:-}" ]; then
|
||||||
@@ -188,24 +188,28 @@ if [ "$1" == "run" ]; then
|
|||||||
# Configure renderd threads
|
# Configure renderd threads
|
||||||
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /etc/renderd.conf
|
sed -i -E "s/num_threads=[0-9]+/num_threads=${THREADS:-4}/g" /etc/renderd.conf
|
||||||
|
|
||||||
|
cronPID=0
|
||||||
# start cron job to trigger consecutive updates
|
# start cron job to trigger consecutive updates
|
||||||
if [ "${UPDATES:-}" == "enabled" ] || [ "${UPDATES:-}" == "1" ]; then
|
if [ "${UPDATES:-}" == "enabled" ] || [ "${UPDATES:-}" == "1" ]; then
|
||||||
printenv > /etc/environment
|
printenv > /etc/environment
|
||||||
/etc/init.d/cron start
|
cron &
|
||||||
|
cronPID=$!
|
||||||
sudo -u renderer touch /var/log/tiles/run.log; tail -f /var/log/tiles/run.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/run.log; tail -f /var/log/tiles/run.log >> /proc/1/fd/1 &
|
||||||
sudo -u renderer touch /var/log/tiles/osmosis.log; tail -f /var/log/tiles/osmosis.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/osmosis.log; tail -f /var/log/tiles/osmosis.log >> /proc/1/fd/1 &
|
||||||
sudo -u renderer touch /var/log/tiles/expiry.log; tail -f /var/log/tiles/expiry.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/expiry.log; tail -f /var/log/tiles/expiry.log >> /proc/1/fd/1 &
|
||||||
sudo -u renderer touch /var/log/tiles/osm2pgsql.log; tail -f /var/log/tiles/osm2pgsql.log >> /proc/1/fd/1 &
|
sudo -u renderer touch /var/log/tiles/osm2pgsql.log; tail -f /var/log/tiles/osm2pgsql.log >> /proc/1/fd/1 &
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run while handling docker stop's SIGTERM
|
# Run while handling docker stop's SIGTERM
|
||||||
stop_handler() {
|
stop_handler() {
|
||||||
kill -TERM "$child"
|
kill -TERM "$child"
|
||||||
|
if [ $cronPID -gt 0 ] ; then
|
||||||
|
kill -TERM "$cronPID"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
trap stop_handler SIGTERM
|
trap stop_handler SIGTERM
|
||||||
|
|
||||||
sudo -u renderer renderd -f -c /etc/renderd.conf &
|
sudo LD_PRELOAD=libtcmalloc.so.4 -u renderer renderd -f -c /etc/renderd.conf &
|
||||||
child=$!
|
child=$!
|
||||||
wait "$child"
|
wait "$child"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user