diff --git a/Dockerfile b/Dockerfile
index c357792..4b1a156 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -8,46 +8,36 @@
# .
#
-FROM phusion/baseimage:0.9.11
+FROM phusion/baseimage:latest
MAINTAINER Homme Zwaagstra
# Set the locale. This affects the encoding of the Postgresql template
# databases.
ENV LANG C.UTF-8
+ENV DEBIAN_FRONTEND=noninteractive
RUN update-locale LANG=C.UTF-8
-# Ensure `add-apt-repository` is present
-RUN apt-get update -y
-RUN apt-get install -y software-properties-common python-software-properties
-RUN apt-get install -y libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-python-dev libboost-regex-dev libboost-system-dev libboost-thread-dev
-
-# Install remaining dependencies
-RUN apt-get install -y subversion git-core tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev libpq-dev libbz2-dev munin-node munin libprotobuf-c0-dev protobuf-c-compiler libfreetype6-dev libpng12-dev libtiff4-dev libicu-dev libgdal-dev libcairo-dev libcairomm-1.0-dev apache2 apache2-dev libagg-dev liblua5.2-dev ttf-unifont
-
-RUN apt-get install -y autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal1-dev mapnik-utils python-mapnik libmapnik-dev
-
-# Install postgresql and postgis
-RUN apt-get install -y postgresql-9.3-postgis-2.1 postgresql-contrib postgresql-server-dev-9.3
+# install needed packages & mapnik
+RUN apt-get -y update && \
+ apt-get -y install libboost-all-dev git-core tar unzip wget bzip2 build-essential autoconf libtool libxml2-dev libgeos-dev libgeos++-dev libpq-dev libbz2-dev libproj-dev munin-node munin libprotobuf-c0-dev protobuf-c-compiler libfreetype6-dev libpng12-dev libtiff5-dev libicu-dev libgdal-dev libcairo-dev libcairomm-1.0-dev apache2 apache2-dev libagg-dev liblua5.2-dev ttf-unifont lua5.1 liblua5.1-dev libgeotiff-epsg sudo && \
+ apt-get -y install postgresql postgresql-contrib postgis postgresql-9.5-postgis-2.2 && \
+ apt-get -y install make cmake g++ libboost-dev libboost-system-dev libboost-filesystem-dev libexpat1-dev zlib1g-dev libbz2-dev libpq-dev libgeos-dev libgeos++-dev libproj-dev lua5.2 liblua5.2-dev && \
+ apt-get -y install autoconf apache2-dev libtool libxml2-dev libbz2-dev libgeos-dev libgeos++-dev libproj-dev gdal-bin libgdal1-dev libmapnik-dev mapnik-utils python-mapnik && \
+ apt-get -y install npm nodejs-legacy && \
+ apt-get -y install fonts-noto && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /usr/share/doc && \
+ rm -rf /usr/share/man
+
# Install osm2pgsql
-RUN cd /tmp && git clone git://github.com/openstreetmap/osm2pgsql.git
-RUN cd /tmp/osm2pgsql && \
- ./autogen.sh && \
- ./configure && \
- make && make install
-
-# Install the Mapnik library
-RUN cd /tmp && git clone git://github.com/mapnik/mapnik
-RUN cd /tmp/mapnik && \
- git checkout 2.2.x && \
- python scons/scons.py configure INPUT_PLUGINS=all OPTIMIZATION=3 SYSTEM_FONTS=/usr/share/fonts/truetype/ && \
- python scons/scons.py && \
- python scons/scons.py install && \
- ldconfig
-
-# Verify that Mapnik has been installed correctly
-RUN python -c 'import mapnik'
+RUN cd /tmp && git clone git://github.com/openstreetmap/osm2pgsql.git && \
+ cd /tmp/osm2pgsql && \
+ mkdir build && cd build && \
+ cmake .. && \
+ make && make install && \
+ cd /tmp && rm -rf /tmp/osm2pgsql
# Install mod_tile and renderd
RUN cd /tmp && git clone git://github.com/openstreetmap/mod_tile.git
@@ -57,20 +47,19 @@ RUN cd /tmp/mod_tile && \
make && \
make install && \
make install-mod_tile && \
- ldconfig
+ ldconfig && \
+ cd /tmp && rm -rf /tmp/mod_tile
# Install the Mapnik stylesheet
-RUN cd /usr/local/src && svn co http://svn.openstreetmap.org/applications/rendering/mapnik mapnik-style
+RUN cd /usr/local/src && git clone git://github.com/gravitystorm/openstreetmap-carto.git
+RUN cd /usr/local/src/openstreetmap-carto && \
+ npm install -g carto && \
+ carto project.mml > mapnik.xml
# Install the coastline data
-RUN cd /usr/local/src/mapnik-style && ./get-coastlines.sh /usr/local/share
-
-# Configure mapnik style-sheets
-RUN cd /usr/local/src/mapnik-style/inc && cp fontset-settings.xml.inc.template fontset-settings.xml.inc
-ADD datasource-settings.sed /tmp/
-RUN cd /usr/local/src/mapnik-style/inc && sed --file /tmp/datasource-settings.sed datasource-settings.xml.inc.template > datasource-settings.xml.inc
-ADD settings.sed /tmp/
-RUN cd /usr/local/src/mapnik-style/inc && sed --file /tmp/settings.sed settings.xml.inc.template > settings.xml.inc
+RUN cd /usr/local/src/openstreetmap-carto && \
+ scripts/get-shapefiles.py && \
+ rm -f /usr/local/src/openstreetmap-carto/data/*zip
# Configure renderd
ADD renderd.conf.sed /tmp/
@@ -86,11 +75,11 @@ ADD mod_tile.conf /etc/apache2/mods-available/
RUN a2enmod mod_tile
# Ensure the webserver user can connect to the gis database
-RUN sed -i -e 's/local all all peer/local gis www-data peer/' /etc/postgresql/9.3/main/pg_hba.conf
+RUN sed -i -e 's/local all all peer/local gis www-data peer/' /etc/postgresql/9.5/main/pg_hba.conf
# Tune postgresql
ADD postgresql.conf.sed /tmp/
-RUN sed --file /tmp/postgresql.conf.sed --in-place /etc/postgresql/9.3/main/postgresql.conf
+RUN sed --file /tmp/postgresql.conf.sed --in-place /etc/postgresql/9.5/main/postgresql.conf
# Define the application logging logic
ADD syslog-ng.conf /etc/syslog-ng/conf.d/local.conf
@@ -108,9 +97,6 @@ RUN update-service --add /etc/sv/apache2
ADD renderd /etc/sv/renderd
RUN update-service --add /etc/sv/renderd
-# Clean up APT when done
-RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
-
# Expose the webserver and database ports
EXPOSE 80 5432
@@ -127,6 +113,8 @@ ADD README.md /usr/local/share/doc/
RUN mkdir -p /usr/local/share/doc/run
ADD help.txt /usr/local/share/doc/run/help.txt
+#add demo page for testing
+ADD map.html /var/www/html/index.html
# Add the entrypoint
ADD run.sh /usr/local/sbin/run
ENTRYPOINT ["/sbin/my_init", "--", "/usr/local/sbin/run"]
diff --git a/README.md b/README.md
index 24591e7..b938f4d 100644
--- a/README.md
+++ b/README.md
@@ -20,8 +20,8 @@ The container runs Ubuntu 14.04 (Trusty) and is based on the
[phusion/baseimage-docker](https://github.com/phusion/baseimage-docker). It
includes:
-* Postgresql 9.3
-* Apache 2.2
+* Postgresql 9.5
+* Apache 2.4
* The latest [Osm2pgsql](http://wiki.openstreetmap.org/wiki/Osm2pgsql) code (at
the time of image creation)
* The latest [Mapnik](http://mapnik.org/) code (at the time of image creation)
diff --git a/help.txt b/help.txt
index c3cba5a..e58a1a1 100644
--- a/help.txt
+++ b/help.txt
@@ -27,13 +27,19 @@ Import data:
The following will import the .osm file at `/tmp/import.osm` into the
database.
- docker run -v /data/osm-postgresql:/var/lib/postgresql -v /tmp:/data homme/openstreetmap-tiles \
+ docker run --rm -v /data/osm-postgresql:/var/lib/postgresql -v /tmp:/data/import homme/openstreetmap-tiles \
startdb import
Start the webserver:
Once data is loaded and users have been created run the webserver:
- docker run -P -v /data/osm-postgresql:/var/lib/postgresql homme/openstreetmap-tiles \
+ docker run --rm -P -v /data/osm-postgresql:/var/lib/postgresql homme/openstreetmap-tiles \
startdb startservices
+Run the CLI for debugging and starting services manually:
+ docker run --rm -P -ti -v /data/osm-postgresql:/var/lib/postgresql homme/openstreetmap-tiles \
+ cli
+
+If you want to keep the rendered tiles: mount a volume with "-v /data/osm-renderd-tiles:/var/lib/mod_tile"
+
For further information run the cli and look at /usr/local/share/doc/README.md.
diff --git a/map.html b/map.html
new file mode 100644
index 0000000..78ef95c
--- /dev/null
+++ b/map.html
@@ -0,0 +1,43 @@
+
+
+ OpenLayers Demo
+
+
+
+
+
+
+
+
+
diff --git a/postgresql/run b/postgresql/run
index 7e7dd9f..c6cf943 100755
--- a/postgresql/run
+++ b/postgresql/run
@@ -8,6 +8,6 @@
# permissions setting.
chown -R postgres /var/lib/postgresql/ || exit 1
-exec /sbin/setuser postgres /usr/lib/postgresql/9.3/bin/postgres \
- -D /var/lib/postgresql/9.3/main \
- -c config_file=/etc/postgresql/9.3/main/postgresql.conf
+exec /sbin/setuser postgres /usr/lib/postgresql/9.5/bin/postgres \
+ -D /var/lib/postgresql/9.5/main \
+ -c config_file=/etc/postgresql/9.5/main/postgresql.conf
diff --git a/renderd.conf.sed b/renderd.conf.sed
index 1bf57ab..ee6ebcb 100644
--- a/renderd.conf.sed
+++ b/renderd.conf.sed
@@ -1,6 +1,6 @@
# Perform sed substitutions for `renderd.conf`
s/;socketname=/socketname=/
-s/plugins_dir=\/usr\/lib\/mapnik\/input/plugins_dir=\/usr\/local\/lib\/mapnik\/input/
-s/\(font_dir=\/usr\/share\/fonts\/truetype\)/\1\/ttf-dejavu/
-s/XML=.*/XML=\/usr\/local\/src\/mapnik-style\/osm.xml/
+s/plugins_dir=\/usr\/lib\/mapnik\/input/plugins_dir=\/usr\/lib\/mapnik\/3.0\/input/
+s/\(font_dir=\/usr\/share\/fonts\/truetype\)/\1\/noto/
+s/XML=.*/XML=\/usr\/local\/src\/openstreetmap-carto\/mapnik.xml/
s/HOST=tile.openstreetmap.org/HOST=localhost/
diff --git a/run.sh b/run.sh
index 0bb7e04..c55d16c 100755
--- a/run.sh
+++ b/run.sh
@@ -23,15 +23,15 @@ startdb () {
initdb () {
echo "Initialising postgresql"
- if [ -d /var/lib/postgresql/9.3/main ] && [ $( ls -A /var/lib/postgresql/9.3/main | wc -c ) -ge 0 ]
+ if [ -d /var/lib/postgresql/9.5/main ] && [ $( ls -A /var/lib/postgresql/9.5/main | wc -c ) -ge 0 ]
then
- die "Initialisation failed: the directory is not empty: /var/lib/postgresql/9.3/main"
+ die "Initialisation failed: the directory is not empty: /var/lib/postgresql/9.5/main"
fi
- mkdir -p /var/lib/postgresql/9.3/main && chown -R postgres /var/lib/postgresql/
- sudo -u postgres -i /usr/lib/postgresql/9.3/bin/initdb --pgdata /var/lib/postgresql/9.3/main
- ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /var/lib/postgresql/9.3/main/server.crt
- ln -s /etc/ssl/private/ssl-cert-snakeoil.key /var/lib/postgresql/9.3/main/server.key
+ mkdir -p /var/lib/postgresql/9.5/main && chown -R postgres /var/lib/postgresql/
+ sudo -u postgres -i /usr/lib/postgresql/9.5/bin/initdb --pgdata /var/lib/postgresql/9.5/main
+ ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /var/lib/postgresql/9.5/main/server.crt
+ ln -s /etc/ssl/private/ssl-cert-snakeoil.key /var/lib/postgresql/9.5/main/server.key
}
createuser () {
@@ -49,22 +49,21 @@ createdb () {
setuser postgres createdb -O www-data $dbname
# Install the Postgis schema
- $asweb psql -d $dbname -f /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis.sql
+ $asweb psql -d $dbname -f /usr/share/postgresql/9.5/contrib/postgis-2.2/postgis.sql
+ $asweb psql -d $dbname -f /usr/share/postgresql/9.5/contrib/postgis-2.2/spatial_ref_sys.sql
$asweb psql -d $dbname -c 'CREATE EXTENSION HSTORE;'
# Set the correct table ownership
$asweb psql -d $dbname -c 'ALTER TABLE geometry_columns OWNER TO "www-data"; ALTER TABLE spatial_ref_sys OWNER TO "www-data";'
- # Add the 900913 Spatial Reference System
- $asweb psql -d $dbname -f /usr/local/share/osm2pgsql/900913.sql
}
import () {
# Find the most recent import.pbf or import.osm
- import=$( ls -1t /data/import.pbf /data/import.osm 2>/dev/null | head -1 )
+ import=$( ls -1t /data/import/import.pbf /data/import/import.osm 2>/dev/null | head -1 )
test -n "${import}" || \
- die "No import file present: expected /data/import.osm or /data/import.pbf"
+ die "No import file present: expected /data/import/import.osm or /data/import/import.pbf"
echo "Importing ${import} into gis"
echo "$OSM_IMPORT_CACHE" | grep -P '^[0-9]+$' || \
@@ -78,7 +77,8 @@ import () {
number_processes=8
fi
- $asweb osm2pgsql --slim --hstore --cache $OSM_IMPORT_CACHE --database gis --number-processes $number_processes $import
+ $asweb osm2pgsql --slim -G --hstore --cache $OSM_IMPORT_CACHE --tag-transform-script /usr/local/src/openstreetmap-carto/scripts/lua/openstreetmap-carto.lua --database gis --number-processes $number_processes -S /usr/local/src/openstreetmap-carto/openstreetmap-carto.style $import
+
}
dropdb () {