Dockerfile: add tirex (alternative renderd implementation)

Implements issue67
This commit is contained in:
Steffen Volkmann 2019-10-06 15:23:13 +02:00
parent bfcc7d7c44
commit b846ab99c2
4 changed files with 188 additions and 1 deletions

View File

@ -7,6 +7,7 @@ FROM ubuntu:18.04
ENV TZ=UTC
ENV AUTOVACUUM=on
ENV UPDATES=disabled
ENV RENDERERAPP=renderd
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install dependencies
@ -68,9 +69,11 @@ RUN echo "deb [ allow-insecure=yes ] http://apt.postgresql.org/pub/repos/apt/ bi
osmium-tool \
cron \
python3-psycopg2 python3-shapely python3-lxml \
libipc-sharelite-perl libjson-perl libgd-gd2-perl libwww-perl devscripts \
nano mc psmisc \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
&& rm -rf /var/lib/{apt,dpkg,cache,log}
# Set up renderer user
RUN adduser --disabled-password --gecos "" renderer
@ -165,6 +168,41 @@ RUN cd ~/src \
&& git checkout 612fe3e040d8bb70d2ab3b133f3b2cfc6c940520 \
&& chmod u+x ~/src/regional/trim_osc.py
# clone, build and install tirex
# according to fpllowing wiki article:
# https://wiki.openstreetmap.org/wiki/Tirex/Building_and_Installing
USER renderer
WORKDIR /home/renderer/src
RUN git clone https://github.com/openstreetmap/tirex.git \
&& git -C tirex checkout v0.6.1
WORKDIR /home/renderer/src/tirex
RUN make
USER root
RUN make install
RUN mkdir /var/lib/tirex \
&& mkdir /var/log/tirex \
&& mkdir /var/run/tirex \
&& mkdir /var/lib/mod_tile/ajx \
&& chown renderer:renderer /var/lib/tirex \
&& chown renderer:renderer /var/run/tirex \
&& chown renderer:renderer /var/log/tirex \
&& chown renderer /var/lib/mod_tile/ajx
COPY ajt.conf /etc/tirex/renderer/mapnik/
COPY mapnik.conf /etc/tirex/renderer/
COPY tirex.conf /etc/tirex/tirex.conf
RUN ln -s /var/lib/mod_tile /var/lib/tirex/tiles
# remove not required tirex sample renderer and maps
RUN rm -fr /etc/tirex/renderer/openseamap \
&& rm -fr /etc/tirex/renderer/wms \
&& rm -fr /etc/tirex/renderer/mapserver \
&& rm -fr /etc/tirex/renderer/openseamap.conf \
&& rm -fr /etc/tirex/renderer/wms.conf \
&& rm -fr /etc/tirex/renderer/mapserver.conf
# Start running
USER root
COPY run.sh /

10
ajt.conf Executable file
View File

@ -0,0 +1,10 @@
# symbolic name
name=ajt
#tile directoryS
tiledir=/var/lib/mod_tile/ajt
minz=0
maxz=18
mapfile=/home/renderer/src/openstreetmap-carto/mapnik.xml
scalefactor=1.0
tilesize=256

50
mapnik.conf Normal file
View File

@ -0,0 +1,50 @@
#-----------------------------------------------------------------------------
#
# Konfiguration for Mapnik renderer
#
# /etc/tirex/renderer/mapnik.conf
#
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# General configuration
#-----------------------------------------------------------------------------
# symbolic name
name=mapnik
# path to executable of renderer
path=/usr/lib/tirex/backends/mapnik
# UDP port where the master can contact this renderer
# must be individual for each renderer
port=9331
# number of processes that should be started
procs=4
# syslog facility
#syslog_facility=daemon
# activate this to see debug messages from renderer
debug=1
#-----------------------------------------------------------------------------
# Backend specific configuration
#-----------------------------------------------------------------------------
# Directory with input plugins for mapnik.
plugindir=/usr/lib/mapnik/3.0/input
# The directory where the Mapnik rendering engine loads its TrueType fonts from.
# If the style sheet references fonts that are not present here, the renderer will
# throw an exception.
# fontdir=/usr/lib/mapnik/fonts
fontdir=/usr/share/fonts/
fontdir_recurse=1
# Set this to 1 if you want fonts loaded recursively from directories
# inside the mapnik_fontdir directory. Defaults to 0.
#fontdir_recurse=0
#-- THE END ------------------------------------------------------------------

89
tirex.conf Normal file
View File

@ -0,0 +1,89 @@
#-----------------------------------------------------------------------------
#
# /etc/tirex/tirex.conf
#
# Configuration file for the Tirex tile rendering system.
#
#-----------------------------------------------------------------------------
# Directory where statistics are stored
#stats_dir=/var/lib/tirex/stats
# How many rows and columns of tiles are there in a metatile.
#metatile_rows=8
#metatile_columns=8
# The name of the UNIX domain socket for communicating with ModTile.
#modtile_socket_name=/var/lib/tirex/modtile.sock
modtile_socket_name=/var/run/renderd/renderd.sock
# Directory where UNIX domain sockets are created
#socket_dir=/var/run/tirex
#-----------------------------------------------------------------------------
# MASTER
#-----------------------------------------------------------------------------
# The master writes its process ID into this file.
#master_pidfile=/var/run/tirex/tirex-master.pid
# Syslog facility used in tirex-master.
#master_syslog_facility=daemon
# Logfile where all rendered jobs are logged.
#master_logfile=/var/log/tirex/jobs.log
# If the rendering of a metatile takes more than this many minutes the master
# gives up on it and removes the job from the list of currently rendering tiles.
# This must be larger than backend_manager_alive_timeout and should be larger than
# the rendering of any tile can need. Its only used to make sure that a
# rendering process that is long gone doesn't take up resources forever.
#master_rendering_timeout=10
# Buckets for different priorities.
bucket name=live minprio=1 maxproc=4 maxload=20
bucket name=important minprio=10 maxproc=3 maxload=8
bucket name=background minprio=20 maxproc=2 maxload=4
#-----------------------------------------------------------------------------
# BACKEND-MANAGER
#-----------------------------------------------------------------------------
# The tirex-backend-manager writes its process ID into this file
#backend_manager_pidfile=/var/run/tirex/tirex-backend-manager.pid
# Syslog facility used by tirex-backend-manager
#backend_manager_syslog_facility=daemon
# If a rendering process doesn't send an alive message in this many minutes
# to the backend-manager, it will be killed by the manager. Make this smaller
# than master_rendering_timeout.
#backend_manager_alive_timeout=8
#-----------------------------------------------------------------------------
# SYNCD
#-----------------------------------------------------------------------------
# The syncd process writes its process ID into this file
#syncd_pidfile=/var/run/tirex/tirex-syncd.pid
# If this is defined, the syncd will copy rendered tiles to this server.
# A comma-separated list is allowed.
#sync_to_host=some.other.host,yet.another.host
# UDP port where the syncd listens for messages from master.
#syncd_udp_port=9323
# Number of seconds syncd will sleep after doing something, to allow
# some tiles to collect in the replication queue. This queue is simply
# the UDP packet buffer of the local OS. If this number is larger than
# 10 or 20 seconds then there's a danger of replications being dropped
#syncd_aggregate_delay=5
# command to execute for replicating the space-separated list of files
# %FILES% to host %HOST%. By default uses a ssh connection with a
# persistent control connection that will be re-created on demand.
#syncd_command=tar -C/ -cf - %FILES% | ssh %HOST% -oControlMaster=auto -oControlPersist=1h -oControlPath=/var/run/tirex/ssh-control-%h-%r-%p -Tq "tar -C/ -xf -"
#-- THE END ------------------------------------------------------------------