integration of update and tile expire procedure

see https://ircama.github.io/osm-carto-tutorials/updating-data/

Implements https://github.com/Overv/openstreetmap-tile-server/issues/2
This commit is contained in:
Steffen Volkmann
2019-06-13 15:39:04 +02:00
committed by Steffen Volkmann
parent d7c2817f9f
commit a9392359b9
4 changed files with 292 additions and 12 deletions

View File

@@ -9,41 +9,74 @@ First create a Docker volume to hold the PostgreSQL database that will contain t
docker volume create openstreetmap-data
Next, download an .osm.pbf extract from geofabrik.de for the region that you're interested in. You can then start importing it into PostgreSQL by running a container and mounting the file as `/data.osm.pbf`. For example:
docker run -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf -v openstreetmap-data:/var/lib/postgresql/10/main overv/openstreetmap-tile-server import
```
docker run -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v openstreetmap-data:/var/lib/postgresql/10/main \
overv/openstreetmap-tile-server \
import
```
If the container exits without errors, then your data has been successfully imported and you are now ready to run the tile server.
### optional step to allow consecutive updates of osm extracts
if your import is a extract of planet and is based on polygon then you should download this polynom data and use follwing command for the import procedure:
```
docker run -v /absolute/path/to/luxembourg.osm.pbf:/data.osm.pbf \
-v /absolute/path/to/luxembourg.poly:/data.poly \
-v /openstreetmap-data:/var/lib/postgresql/10/main \
overv/openstreetmap-tile-server \
import
```
## Running the server
Run the server like this:
docker run -p 80:80 -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server run
```
docker run -p 80:80 \
-v openstreetmap-data:/var/lib/postgresql/10/main \
-d overv/openstreetmap-tile-server \
run
```
Your tiles will now be available at `http://localhost:80/tile/{z}/{x}/{y}.png`. The demo map in `leaflet-demo.html` will then be available on `http://localhost:80`. Note that it will initially quite a bit of time to render the larger tiles for the first time.
## Preserving rendered tiles
Tiles that have already been rendered will be stored in `/var/lib/mod_tile`. To make sure that this data survives container restarts, you should create another volume for it:
```
docker volume create openstreetmap-rendered-tiles
docker run -p 80:80 -v openstreetmap-data:/var/lib/postgresql/10/main -v openstreetmap-rendered-tiles:/var/lib/mod_tile -d overv/openstreetmap-tile-server run
docker run -p 80:80
-v openstreetmap-data:/var/lib/postgresql/10/main
-v openstreetmap-rendered-tiles:/var/lib/mod_tile
-d overv/openstreetmap-tile-server \
run
```
## Performance tuning and tweaking
## Performance tuning
### update and tile expire procedure
The environment variable "UPDATES" (default value =disabled) allows you to run the container with consecutive updates.
```
docker run -p 80:80 \
-v openstreetmap-data:/var/lib/postgresql/10/main \
-v openstreetmap-rendered-tiles:/var/lib/mod_tile \
-d overv/openstreetmap-tile-server \
-e UPDATES=enabled \
run
```
Details for update procedure and invoked scripts can you find here [link](https://ircama.github.io/osm-carto-tutorials/updating-data/)
### THREADS
The import and tile serving processes use 4 threads by default, but this number can be changed by setting the `THREADS` environment variable. For example:
```
docker run -p 80:80 -e THREADS=24 -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server run
```
### AUTOVACUUM
The database use the autovacuum feature by default. This behavior can be changed with `AUTOVACUUM` environment variable. For example:
docker run -p 80:80 -e AUTOVACUUM=off -v openstreetmap-data:/var/lib/postgresql/10/main -d overv/openstreetmap-tile-server
## Benchmarks
### Benchmarks
You can find an example of the import performance to expect with this image on the [OpenStreetMap wiki](https://wiki.openstreetmap.org/wiki/Osm2pgsql/benchmarks#debian_9_.2F_openstreetmap-tile-server).