Added osm-bright from Mapbox

The osm-carto style is now available at http://host/osm/0/0/0.png
while osm-bright is at http://host/osmb/0/0/0.png

node-millstone is a new dependecy for osm-bright

Currently node-millstone downloads the 10m-populated-places-simple
shapefile which should be done in the Dockerfile (see issue #1).

Signed-off-by: Maximilian Güntner <maximilian.guentner@gmail.com>
master
Maximilian Güntner 2014-11-23 02:31:34 +01:00
parent c327388b11
commit be8422a779
4 changed files with 72 additions and 7 deletions

View File

@ -4,17 +4,25 @@ FROM debian:jessie
MAINTAINER Maximilian Güntner <maximilian.guentner@gmail.com>
ENV OSM_CARTO_VERSION 2.24.0
ENV OSM_BRIGHT_VERSION master
ENV MOD_TILE_VERSION master
ENV PARALLEL_BUILD 4
RUN touch /etc/inittab
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q autoconf libtool libmapnik-dev apache2-dev curl unzip gdal-bin mapnik-utils node-carto apache2 wget runit sudo
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -q autoconf libtool libmapnik-dev apache2-dev curl unzip gdal-bin mapnik-utils node-carto node-millstone 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
# Delete zip files
RUN find /usr/share/mapnik/openstreetmap-carto-$OSM_CARTO_VERSION/data \( -type f -iname "*.zip" -o -iname "*.tgz" \) -delete
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 && wget https://github.com/mapbox/osm-bright/archive/$OSM_BRIGHT_VERSION.tar.gz && tar -xzf $OSM_BRIGHT_VERSION.tar.gz && rm $OSM_BRIGHT_VERSION.tar.gz
RUN mv /tmp/osm-bright-$OSM_BRIGHT_VERSION /usr/share/mapnik
# Create symlink for shapefiles
RUN ln -s /usr/share/mapnik/openstreetmap-carto-$OSM_CARTO_VERSION/data /usr/share/mapnik/osm-bright-$OSM_BRIGHT_VERSION/shp
RUN cd /tmp && wget https://github.com/openstreetmap/mod_tile/archive/$MOD_TILE_VERSION.tar.gz && tar -xzf $MOD_TILE_VERSION.tar.gz && rm $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
@ -29,6 +37,7 @@ 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 ./renderd/renderd.conf /usr/local/etc/renderd.conf
COPY runit_bootstrap /usr/sbin/runit_bootstrap
RUN chmod 755 /usr/sbin/runit_bootstrap

View File

@ -25,7 +25,14 @@ 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)
world once you point your browser to [http://127.0.0.1:8080/osm/0/0/0.png](http://127.0.0.1:8080/osm/0/0/0.png)
## Available Styles
* [openstreetmap-carto](https://github.com/gravitystorm/openstreetmap-carto),
available at [http://host/osm/0/0/0.png](http://host/osm/0/0/0.png)
* [osm-bright](https://github.com/mapbox/osm-bright)
available at [http://host/osmb/0/0/0.png](http://host/osmb/0/0/0.png)
## About

25
renderd/renderd.conf Normal file
View File

@ -0,0 +1,25 @@
[renderd]
num_threads=4
tile_dir=/var/lib/mod_tile
stats_file=/var/run/renderd/renderd.stats
[mapnik]
plugins_dir={{PLUGINS_DIR}}
font_dir=/usr/share/fonts/truetype
font_dir_recurse=1
[osm_carto]
URI=/osm/
TILEDIR=/var/lib/mod_tile
XML={{OSM_CARTO_XML_DIR}}
HOST={{HOST}}
TILESIZE=256
[osm_bright]
URI=/osmb/
TILEDIR=/var/lib/mod_tile
XML={{OSM_BRIGHT_XML_DIR}}
HOST={{HOST}}
TILESIZE=256

View File

@ -1,12 +1,36 @@
#!/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
sed -i -e "s/{{OSM_CARTO_XML_DIR}}/\/usr\/share\/mapnik\/openstreetmap-carto-$OSM_CARTO_VERSION\/style.xml/" \
-e "s/{{PLUGINS_DIR}}/\/usr\/lib\/mapnik\/2.2\/input\//" \
-e "s/{{HOST}}/localhost/" \
/usr/local/etc/renderd.conf
sed -i -e "s/{{OSM_BRIGHT_XML_DIR}}/\/usr\/share\/mapnik\/osm-bright-$OSM_BRIGHT_VERSION\/OSMBright\/style.xml/" \
/usr/local/etc/renderd.conf
# osm-carto setup
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
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
# osm-bright setup
cd /usr/share/mapnik/osm-bright-$OSM_BRIGHT_VERSION/
cp configure.py.sample configure.py
# prepare configure.py
sed -i -e "s|^config\[\"path\"\].*|config\[\"path\"\] = \"$(pwd)\"|" \
-e "s/^config\[\"postgis\"\]\[\"host\"\].*/config\[\"postgis\"\]\[\"host\"\] = \"$PG_PORT_5432_TCP_ADDR\"/" \
-e "s/^config\[\"postgis\"\]\[\"port\"\].*/config\[\"postgis\"\]\[\"port\"\] = \"$PG_PORT_5432_TCP_PORT\"/" \
-e "s/^config\[\"postgis\"\]\[\"dbname\"\].*/config\[\"postgis\"\]\[\"dbname\"\] = \"$PG_ENV_OSM_DB\"/" \
-e "s/^config\[\"postgis\"\]\[\"user\"\].*/config\[\"postgis\"\]\[\"user\"\] = \"$PG_ENV_OSM_USER\"/" configure.py
./make.py
cd OSMBright
millstone project.mml > project.local.mml
carto project.local.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