Initial commit
Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>master
commit
d0334ba6f8
|
@ -0,0 +1,39 @@
|
|||
# DOCKER-VERSION 1.3.1
|
||||
# VERSION 0.1
|
||||
FROM debian:jessie
|
||||
MAINTAINER Maximilian Güntner <maximilian.guentner@gmail.com>
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
|
||||
ENV OSM_CARTO_VERSION 2.24.0
|
||||
ENV MOD_TILE_VERSION master
|
||||
ENV PARALLEL_BUILD 4
|
||||
|
||||
RUN touch /etc/inittab
|
||||
RUN apt-get update && apt-get install -y -q autoconf libtool libmapnik-dev apache2-dev curl unzip gdal-bin mapnik-utils node-carto apache2 wget runit sudo
|
||||
|
||||
RUN cd /tmp && wget https://github.com/gravitystorm/openstreetmap-carto/archive/v$OSM_CARTO_VERSION.tar.gz && tar -xzf v$OSM_CARTO_VERSION.tar.gz
|
||||
RUN mkdir /usr/share/mapnik && mv /tmp/openstreetmap-carto-$OSM_CARTO_VERSION /usr/share/mapnik/
|
||||
RUN cd /usr/share/mapnik/openstreetmap-carto-$OSM_CARTO_VERSION/ && ./get-shapefiles.sh && cp project.mml project.mml.orig
|
||||
|
||||
RUN cd /tmp && wget https://github.com/openstreetmap/mod_tile/archive/$MOD_TILE_VERSION.tar.gz && tar -xzf $MOD_TILE_VERSION.tar.gz
|
||||
RUN cd /tmp/mod_tile-$MOD_TILE_VERSION/ && ./autogen.sh && ./configure && make -j $PARALLEL_BUILD && make install && make install-mod_tile
|
||||
|
||||
RUN mkdir -p /var/lib/mod_tile && chown www-data:www-data /var/lib/mod_tile
|
||||
RUN mkdir -p /var/run/renderd && chown www-data:www-data /var/run/renderd
|
||||
|
||||
RUN mkdir -p /etc/service/renderd && mkdir -p /etc/service/apache2
|
||||
COPY ./apache2/run /etc/service/apache2/run
|
||||
COPY ./renderd/run /etc/service/renderd/run
|
||||
RUN chown root:root /etc/service/renderd/run /etc/service/apache2/run
|
||||
RUN chmod u+x /etc/service/renderd/run /etc/service/apache2/run
|
||||
|
||||
COPY ./tile.load /etc/apache2/mods-available/tile.load
|
||||
COPY ./apache2/000-default.conf /etc/apache2/sites-enabled/000-default.conf
|
||||
RUN ln -s /etc/apache2/mods-available/tile.load /etc/apache2/mods-enabled/
|
||||
|
||||
COPY runit_bootstrap /usr/sbin/runit_bootstrap
|
||||
RUN chmod 755 /usr/sbin/runit_bootstrap
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/usr/sbin/runit_bootstrap"]
|
|
@ -0,0 +1,32 @@
|
|||
# docker-renderd-osm
|
||||
|
||||
A basic image for rendering/serving tiles using OpenStreetMap data from an external
|
||||
PostgreSQL instance.
|
||||
|
||||
## Build instructions
|
||||
|
||||
Build using
|
||||
|
||||
# docker build -t mguentner/renderd-osm github.com/mguentner/docker-renderd-osm.git
|
||||
|
||||
## Running
|
||||
|
||||
This container is designed to work together with
|
||||
[openfirmware/docker-postgres-osm](https://registry.hub.docker.com/u/openfirmware/postgres-osm/).
|
||||
This document assumes that OpenStreetMap data has already been imported.
|
||||
If not build/pull [openfirmware/docker-osm2pgsql](https://registry.hub.docker.com/u/openfirmware/osm2pgsql/) and follow the instructions.
|
||||
|
||||
First, start the already configured PostgreSQL container:
|
||||
|
||||
# docker start postgres-osm
|
||||
|
||||
Now, start the renderd container and link them together:
|
||||
|
||||
# docker run -i -t -p 8080:80 --link postgres-osm:pg mguentner/renderd-osm:latest
|
||||
|
||||
Once the container is up you should be able to see a small map of the
|
||||
world once you point your browser to [http://127.0.0.1:8080/osm_tiles/0/0/0.png](http://127.0.0.1:8080/osm_tiles/0/0/0.png)
|
||||
|
||||
## About
|
||||
|
||||
This Dockerfile has been put together using the [Debian Tileserver Install Guide](https://wiki.debian.org/OSM/tileserver/jessie)
|
|
@ -0,0 +1,40 @@
|
|||
<VirtualHost *:80>
|
||||
# The ServerName directive sets the request scheme, hostname and port that
|
||||
# the server uses to identify itself. This is used when creating
|
||||
# redirection URLs. In the context of virtual hosts, the ServerName
|
||||
# specifies what hostname must appear in the request's Host: header to
|
||||
# match this virtual host. For the default virtual host (this file) this
|
||||
# value is not decisive as it is used as a last resort host regardless.
|
||||
# However, you must set it for any further virtual host explicitly.
|
||||
#ServerName www.example.com
|
||||
|
||||
ServerAdmin webmaster@localhost
|
||||
DocumentRoot /var/www/html
|
||||
|
||||
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
|
||||
# error, crit, alert, emerg.
|
||||
# It is also possible to configure the loglevel for particular
|
||||
# modules, e.g.
|
||||
#LogLevel info ssl:warn
|
||||
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
|
||||
# For most configuration files from conf-available/, which are
|
||||
# enabled or disabled at a global level, it is possible to
|
||||
# include a line for only one particular virtual host. For example the
|
||||
# following line enables the CGI configuration for this host only
|
||||
# after it has been globally disabled with "a2disconf".
|
||||
#Include conf-available/serve-cgi-bin.conf
|
||||
|
||||
LoadTileConfigFile /usr/local/etc/renderd.conf
|
||||
ModTileRenderdSocketName /var/run/renderd/renderd.sock
|
||||
# Timeout before giving up for a tile to be rendered
|
||||
ModTileRequestTimeout 0
|
||||
# Timeout before giving up for a tile to be rendered that is otherwise missing
|
||||
ModTileMissingRequestTimeout 30
|
||||
|
||||
</VirtualHost>
|
||||
|
||||
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
source /etc/apache2/envvars
|
||||
exec /usr/sbin/apache2ctl -DFOREGROUND
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
exec 2>&1
|
||||
source /etc/envvars
|
||||
sed -i "s/^XML=.*/XML=\/usr\/share\/mapnik\/openstreetmap-carto-$OSM_CARTO_VERSION\/style.xml/" /usr/local/etc/renderd.conf
|
||||
sed -i "s/^HOST=.*/HOST=localhost/" /usr/local/etc/renderd.conf
|
||||
sed -i "s/^plugins_dir=.*/plugins_dir=\/usr\/lib\/mapnik\/2.2\/input\//" /usr/local/etc/renderd.conf
|
||||
|
||||
cd /usr/share/mapnik/openstreetmap-carto-$OSM_CARTO_VERSION/
|
||||
cp project.mml.orig project.mml
|
||||
sed -i "s/\"dbname\": \"gis\"/\"host\": \"$PG_PORT_5432_TCP_ADDR\",\n\"port\": \"$PG_PORT_5432_TCP_PORT\",\n\"user\": \"$PG_ENV_OSM_USER\",\n\"dbname\":\"$PG_ENV_OSM_DB\"/" project.mml
|
||||
carto project.mml > style.xml
|
||||
exec sudo -u www-data LD_LIBRARY_PATH=/usr/local/lib/ /usr/local/bin/renderd -f --config /usr/local/etc/renderd.conf
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
# it is not possible to pass environment variables to runit
|
||||
# so we just save them in a file which we can source from
|
||||
# run scripts.
|
||||
export > /etc/envvars
|
||||
exec /usr/sbin/runsvdir-start
|
Loading…
Reference in New Issue