Upgrade versions (#248)

This commit is contained in:
galewis2 2022-03-28 09:12:13 -04:00 committed by GitHub
parent e6e8c2d427
commit f1203714c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 42 deletions

View File

@ -11,8 +11,8 @@ before_script:
script:
- docker build --pull --cache-from overv/openstreetmap-tile-server --tag overv/openstreetmap-tile-server .
- docker volume create openstreetmap-data
- docker run --rm -v openstreetmap-data:/var/lib/postgresql/12/main overv/openstreetmap-tile-server import
- docker run --rm -v openstreetmap-data:/var/lib/postgresql/12/main -p 8080:80 -d overv/openstreetmap-tile-server run
- docker run --rm -v openstreetmap-data:/var/lib/postgresql/14/main overv/openstreetmap-tile-server import
- docker run --rm -v openstreetmap-data:/var/lib/postgresql/14/main -p 8080:80 -d overv/openstreetmap-tile-server run
- sleep 30
- make DOCKER_IMAGE=overv/openstreetmap-tile-server stop
after_script:

View File

@ -6,27 +6,32 @@ RUN apt-get update \
git-core \
checkinstall \
g++ \
gnupg2 \
make \
tar \
wget \
ca-certificates
ca-certificates \
&& apt-get update
###########################################################################################################
FROM compiler-common AS compiler-postgis
RUN apt-get install -y --no-install-recommends \
postgresql-server-dev-12 \
RUN echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
postgresql-server-dev-14 \
libxml2-dev \
libgeos-dev \
libproj-dev
RUN wget https://download.osgeo.org/postgis/source/postgis-3.1.1.tar.gz -O postgis.tar.gz \
libproj-dev \
&& wget https://download.osgeo.org/postgis/source/postgis-3.2.1.tar.gz -O postgis.tar.gz \
&& mkdir -p postgis_src \
&& tar -xvzf postgis.tar.gz --strip 1 -C postgis_src \
&& rm postgis.tar.gz \
&& cd postgis_src \
&& ./configure --without-protobuf --without-raster \
&& make -j $(nproc) \
&& checkinstall --pkgversion="3.1.1" --install=no --default make install
&& checkinstall --pkgversion="3.2.1" --install=no --default make install
###########################################################################################################
@ -78,10 +83,10 @@ FROM compiler-common AS compiler-stylesheet
RUN apt-get install -y --no-install-recommends \
npm
RUN cd ~ \
&& git clone --single-branch --branch v5.3.1 https://github.com/gravitystorm/openstreetmap-carto.git --depth 1 \
&& git clone --single-branch --branch v5.4.0 https://github.com/gravitystorm/openstreetmap-carto.git --depth 1 \
&& cd openstreetmap-carto \
&& sed -ie 's#https:\/\/naciscdn.org\/naturalearth\/110m\/cultural\/ne_110m_admin_0_boundary_lines_land.zip#https:\/\/naturalearth.s3.amazonaws.com\/110m_cultural\/ne_110m_admin_0_boundary_lines_land.zip#g' external-data.yml \
&& npm install -g carto@0.18.2 \
&& npm install -g carto@1.2.0 \
&& carto project.mml > mapnik.xml
###########################################################################################################
@ -114,13 +119,13 @@ RUN apt-get update \
fonts-noto-cjk \
fonts-noto-hinted \
fonts-noto-unhinted \
gnupg2 \
gdal-bin \
liblua5.3-dev \
lua5.3 \
mapnik-utils \
osmium-tool \
osmosis \
postgresql-12 \
python-is-python3 \
python3-mapnik \
python3-lxml \
@ -130,6 +135,10 @@ RUN apt-get update \
sudo \
ttf-unifont \
wget \
&& echo "deb http://apt.postgresql.org/pub/repos/apt focal-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& apt-get update \
&& apt-get install -y --no-install-recommends postgresql-14 \
&& apt-get clean autoclean \
&& apt-get autoremove --yes \
&& rm -rf /var/lib/{apt,dpkg,cache,log}/
@ -166,20 +175,20 @@ RUN mkdir /nodes \
&& chown renderer:renderer /nodes
# Configure PosgtreSQL
COPY postgresql.custom.conf.tmpl /etc/postgresql/12/main/
COPY postgresql.custom.conf.tmpl /etc/postgresql/14/main/
RUN chown -R postgres:postgres /var/lib/postgresql \
&& chown postgres:postgres /etc/postgresql/12/main/postgresql.custom.conf.tmpl \
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/12/main/pg_hba.conf \
&& echo "host all all ::/0 md5" >> /etc/postgresql/12/main/pg_hba.conf
&& chown postgres:postgres /etc/postgresql/14/main/postgresql.custom.conf.tmpl \
&& echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/14/main/pg_hba.conf \
&& echo "host all all ::/0 md5" >> /etc/postgresql/14/main/pg_hba.conf
###########################################################################################################
FROM final-base AS final
# Install PostGIS
COPY --from=compiler-postgis postgis_src/postgis-src_3.1.1-1_amd64.deb .
RUN dpkg -i postgis-src_3.1.1-1_amd64.deb \
&& rm postgis-src_3.1.1-1_amd64.deb
COPY --from=compiler-postgis postgis_src/postgis-src_3.2.1-1_amd64.deb .
RUN dpkg -i postgis-src_3.2.1-1_amd64.deb \
&& rm postgis-src_3.2.1-1_amd64.deb
# Install osm2pgsql
COPY --from=compiler-osm2pgsql /root/osm2pgsql/build/build_1-1_amd64.deb .

View File

@ -10,8 +10,8 @@ push: build
test: build
docker volume create openstreetmap-data
docker run --rm -v openstreetmap-data:/var/lib/postgresql/12/main ${DOCKER_IMAGE} import
docker run --rm -v openstreetmap-data:/var/lib/postgresql/12/main -p 8080:80 -d ${DOCKER_IMAGE} run
docker run --rm -v openstreetmap-data:/var/lib/postgresql/14/main ${DOCKER_IMAGE} import
docker run --rm -v openstreetmap-data:/var/lib/postgresql/14/main -p 8080:80 -d ${DOCKER_IMAGE} run
stop:
docker rm -f `docker ps | grep '${DOCKER_IMAGE}' | awk '{ print $$1 }'` || true

View File

@ -15,7 +15,7 @@ Next, download an .osm.pbf extract from geofabrik.de for the region that you're
```
docker run \
-v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
overv/openstreetmap-tile-server \
import
```
@ -35,7 +35,7 @@ docker run \
-e UPDATES=enabled \
-v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v /absolute/path/to/luxembourg.poly:/data.poly \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
overv/openstreetmap-tile-server \
import
```
@ -50,7 +50,7 @@ It is also possible to let the container download files for you rather than moun
docker run \
-e DOWNLOAD_PBF=https://download.geofabrik.de/europe/luxembourg-latest.osm.pbf \
-e DOWNLOAD_POLY=https://download.geofabrik.de/europe/luxembourg.poly \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
overv/openstreetmap-tile-server \
import
```
@ -62,7 +62,7 @@ Run the server like this:
```
docker run \
-p 8080:80 \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-d overv/openstreetmap-tile-server \
run
```
@ -81,7 +81,7 @@ Tiles that have already been rendered will be stored in `/var/lib/mod_tile`. To
docker volume create openstreetmap-rendered-tiles
docker run \
-p 8080:80 \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \
-d overv/openstreetmap-tile-server \
run
@ -97,7 +97,7 @@ Given that you've set up your import as described in the *Automatic updates* sec
docker run \
-p 8080:80 \
-e UPDATES=enabled \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \
-d overv/openstreetmap-tile-server \
run
@ -112,7 +112,7 @@ To enable the `Access-Control-Allow-Origin` header to be able to retrieve tiles
```
docker run \
-p 8080:80 \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-e ALLOW_CORS=enabled \
-d overv/openstreetmap-tile-server \
run
@ -126,7 +126,7 @@ To connect to the PostgreSQL database inside the container, make sure to expose
docker run \
-p 8080:80 \
-p 5432:5432 \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-d overv/openstreetmap-tile-server \
run
```
@ -144,7 +144,7 @@ docker run \
-p 8080:80 \
-p 5432:5432 \
-e PGPASSWORD=secret \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-d overv/openstreetmap-tile-server \
run
```
@ -160,7 +160,7 @@ The import and tile serving processes use 4 threads by default, but this number
docker run \
-p 8080:80 \
-e THREADS=24 \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-d overv/openstreetmap-tile-server \
run
```
@ -172,7 +172,7 @@ The import and tile serving processes use 800 MB RAM cache by default, but this
docker run \
-p 8080:80 \
-e "OSM2PGSQL_EXTRA_ARGS=-C 4096" \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-d overv/openstreetmap-tile-server \
run
```
@ -184,7 +184,7 @@ The database use the autovacuum feature by default. This behavior can be changed
docker run \
-p 8080:80 \
-e AUTOVACUUM=off \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-d overv/openstreetmap-tile-server \
run
```
@ -197,7 +197,7 @@ If you are planning to import the entire planet or you are running into memory e
docker run \
-v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v openstreetmap-nodes:/nodes \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
-e "OSM2PGSQL_EXTRA_ARGS=--flat-nodes /nodes/flat_nodes.bin" \
overv/openstreetmap-tile-server \
import
@ -222,7 +222,7 @@ To raise it use `--shm-size` parameter. For example:
```
docker run \
-p 8080:80 \
-v openstreetmap-data:/var/lib/postgresql/12/main \
-v openstreetmap-data:/var/lib/postgresql/14/main \
--shm-size="192m" \
-d overv/openstreetmap-tile-server \
run

View File

@ -4,7 +4,7 @@ services:
map:
image: overv/openstreetmap-tile-server
volumes:
- openstreetmap-data:/var/lib/postgresql/12/main
- openstreetmap-data:/var/lib/postgresql/14/main
ports:
- "8080:80"
command: "run"

View File

@ -6,8 +6,8 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ==" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js" integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw==" crossorigin=""></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
<style>
html, body, #map {

10
run.sh
View File

@ -3,9 +3,9 @@
set -euo pipefail
function createPostgresConfig() {
cp /etc/postgresql/12/main/postgresql.custom.conf.tmpl /etc/postgresql/12/main/conf.d/postgresql.custom.conf
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/12/main/conf.d/postgresql.custom.conf
cat /etc/postgresql/12/main/conf.d/postgresql.custom.conf
cp /etc/postgresql/14/main/postgresql.custom.conf.tmpl /etc/postgresql/14/main/conf.d/postgresql.custom.conf
sudo -u postgres echo "autovacuum = $AUTOVACUUM" >> /etc/postgresql/14/main/conf.d/postgresql.custom.conf
cat /etc/postgresql/14/main/conf.d/postgresql.custom.conf
}
function setPostgresPassword() {
@ -28,8 +28,8 @@ set -x
if [ "$1" = "import" ]; then
# Ensure that database directory is in right state
chown postgres:postgres -R /var/lib/postgresql
if [ ! -f /var/lib/postgresql/12/main/PG_VERSION ]; then
sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl -D /var/lib/postgresql/12/main/ initdb -o "--locale C.UTF-8"
if [ ! -f /var/lib/postgresql/14/main/PG_VERSION ]; then
sudo -u postgres /usr/lib/postgresql/14/bin/pg_ctl -D /var/lib/postgresql/14/main/ initdb -o "--locale C.UTF-8"
fi
# Initialize PostgreSQL