Merge branch 'Y0ngg4n-postgresql-12-upgrade'

This commit is contained in:
Alexander Overvoorde 2019-10-20 21:49:03 +02:00
commit ca1626a9fc
4 changed files with 32 additions and 23 deletions

View File

@ -10,7 +10,10 @@ ENV UPDATES=disabled
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
# Install dependencies # Install dependencies
RUN echo "deb [ allow-insecure=yes ] http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" >> /etc/apt/sources.list.d/pgdg.list \ RUN apt-get update \
&& apt-get install wget gnupg2 lsb-core -y \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb [ trusted=yes ] http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \ && apt-get update \
&& apt-get install -y apt-transport-https ca-certificates \ && apt-get install -y apt-transport-https ca-certificates \
&& apt-get install -y --no-install-recommends --allow-unauthenticated \ && apt-get install -y --no-install-recommends --allow-unauthenticated \
@ -24,7 +27,9 @@ RUN echo "deb [ allow-insecure=yes ] http://apt.postgresql.org/pub/repos/apt/ bi
fonts-noto-hinted \ fonts-noto-hinted \
fonts-noto-unhinted \ fonts-noto-unhinted \
clang \ clang \
gcc \
gdal-bin \ gdal-bin \
make \
git-core \ git-core \
libagg-dev \ libagg-dev \
libboost-all-dev \ libboost-all-dev \
@ -52,10 +57,9 @@ RUN echo "deb [ allow-insecure=yes ] http://apt.postgresql.org/pub/repos/apt/ bi
nodejs \ nodejs \
npm \ npm \
postgis \ postgis \
postgresql-10 \ postgresql-12 \
postgresql-10-postgis-2.5 \ postgresql-server-dev-12 \
postgresql-10-postgis-2.5-scripts \ postgresql-contrib-12 \
postgresql-contrib-10 \
protobuf-c-compiler \ protobuf-c-compiler \
python-mapnik \ python-mapnik \
sudo \ sudo \
@ -72,6 +76,11 @@ RUN echo "deb [ allow-insecure=yes ] http://apt.postgresql.org/pub/repos/apt/ bi
&& apt-get autoremove --yes \ && apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ && rm -rf /var/lib/{apt,dpkg,cache,log}/
# Set up PostGIS
RUN wget http://download.osgeo.org/postgis/source/postgis-3.0.0rc2.tar.gz
RUN tar -xvzf postgis-3.0.0rc2.tar.gz
RUN cd postgis-3.0.0rc2 && ./configure && make && make install
# Set up renderer user # Set up renderer user
RUN adduser --disabled-password --gecos "" renderer RUN adduser --disabled-password --gecos "" renderer
USER renderer USER renderer

View File

@ -8,5 +8,5 @@ push: build
test: build test: build
docker volume create openstreetmap-data docker volume create openstreetmap-data
docker run -v openstreetmap-data:/var/lib/postgresql/10/main overv/openstreetmap-tile-server import docker run -v openstreetmap-data:/var/lib/postgresql/12/main overv/openstreetmap-tile-server import
docker run -v openstreetmap-data:/var/lib/postgresql/10/main -p 80:80 -d overv/openstreetmap-tile-server run docker run -v openstreetmap-data:/var/lib/postgresql/12/main -p 80:80 -d overv/openstreetmap-tile-server run

View File

@ -13,7 +13,7 @@ Next, download an .osm.pbf extract from geofabrik.de for the region that you're
``` ```
docker run \ docker run \
-v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \ -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
overv/openstreetmap-tile-server \ overv/openstreetmap-tile-server \
import import
``` ```
@ -28,7 +28,7 @@ If your import is an extract of the planet and has polygonal bounds associated w
docker run \ docker run \
-v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \ -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v /absolute/path/to/luxembourg.poly:/data.poly \ -v /absolute/path/to/luxembourg.poly:/data.poly \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
overv/openstreetmap-tile-server \ overv/openstreetmap-tile-server \
import import
``` ```
@ -42,7 +42,7 @@ Run the server like this:
``` ```
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
@ -57,7 +57,7 @@ Tiles that have already been rendered will be stored in `/var/lib/mod_tile`. To
docker volume create openstreetmap-rendered-tiles docker volume create openstreetmap-rendered-tiles
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \ -v openstreetmap-rendered-tiles:/var/lib/mod_tile \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
@ -73,7 +73,7 @@ Given that you've specified both the OSM data and polygon as specified in the *A
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-e UPDATES=enabled \ -e UPDATES=enabled \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \ -v openstreetmap-rendered-tiles:/var/lib/mod_tile \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
@ -88,7 +88,7 @@ To enable the `Access-Control-Allow-Origin` header to be able to retrieve tiles
``` ```
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-e ALLOW_CORS=1 \ -e ALLOW_CORS=1 \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
@ -102,7 +102,7 @@ To connect to the PostgreSQL database inside the container, make sure to expose
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-p 5432:5432 \ -p 5432:5432 \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
@ -120,7 +120,7 @@ docker run \
-p 80:80 \ -p 80:80 \
-p 5432:5432 \ -p 5432:5432 \
-e PGPASSWORD=secret \ -e PGPASSWORD=secret \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
@ -136,7 +136,7 @@ The import and tile serving processes use 4 threads by default, but this number
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-e THREADS=24 \ -e THREADS=24 \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
@ -148,7 +148,7 @@ The import and tile serving processes use 800 MB RAM cache by default, but this
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-e "OSM2PGSQL_EXTRA_ARGS=-C 4096" \ -e "OSM2PGSQL_EXTRA_ARGS=-C 4096" \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
@ -160,7 +160,7 @@ The database use the autovacuum feature by default. This behavior can be changed
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-e AUTOVACUUM=off \ -e AUTOVACUUM=off \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run
``` ```
@ -173,7 +173,7 @@ If you are planning to import the entire planet or you are running into memory e
docker run \ docker run \
-v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \ -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v openstreetmap-nodes:/nodes \ -v openstreetmap-nodes:/nodes \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
-e "OSM2PGSQL_EXTRA_ARGS=--flat-nodes /nodes/flat_nodes.bin" \ -e "OSM2PGSQL_EXTRA_ARGS=--flat-nodes /nodes/flat_nodes.bin" \
overv/openstreetmap-tile-server \ overv/openstreetmap-tile-server \
import import
@ -198,7 +198,7 @@ To raise it use `--shm-size` parameter. For example:
``` ```
docker run \ docker run \
-p 80:80 \ -p 80:80 \
-v openstreetmap-data:/var/lib/postgresql/10/main \ -v openstreetmap-data:/var/lib/postgresql/12/main \
--shm-size="192m" \ --shm-size="192m" \
-d overv/openstreetmap-tile-server \ -d overv/openstreetmap-tile-server \
run run

6
run.sh
View File

@ -3,9 +3,9 @@
set -x set -x
function createPostgresConfig() { function createPostgresConfig() {
cp /etc/postgresql/10/main/postgresql.custom.conf.tmpl /etc/postgresql/10/main/postgresql.custom.conf cp /etc/postgresql/12/main/postgresql.custom.conf.tmpl /etc/postgresql/12/main/postgresql.custom.conf
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/10/main/postgresql.custom.conf sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/12/main/postgresql.custom.conf
cat /etc/postgresql/10/main/postgresql.custom.conf cat /etc/postgresql/12/main/postgresql.custom.conf
} }
function setPostgresPassword() { function setPostgresPassword() {