Skip to content

Commit

Permalink
Make setup for automatic updates optional through UPDATES variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Overv committed Nov 7, 2019
1 parent 626158f commit 64c66a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ If the container exits without errors, then your data has been successfully impo

### Automatic updates (optional)

If your import is an extract of the planet and has polygonal bounds associated with it, like those from geofabrik.de, then it is possible to set your server up for automatic updates. Make sure to reference both the OSM file and the polygon file during the import process to facilitate this:
If your import is an extract of the planet and has polygonal bounds associated with it, like those from geofabrik.de, then it is possible to set your server up for automatic updates. Make sure to reference both the OSM file and the polygon file during the import process to facilitate this, and also include the `UPDATES=enabled` variable:

```
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 \
overv/openstreetmap-tile-server \
import
```

Refer to the section *Automatic updating and tile expiry* to actually enable the updates.
Refer to the section *Automatic updating and tile expiry* to actually enable the updates while running the tile server.

## Running the server

Expand Down Expand Up @@ -67,7 +68,7 @@ docker run \

### Enabling automatic updating (optional)

Given that you've specified both the OSM data and polygon as specified in the *Automatic updates* section during server setup, you can enable the updating process by setting the variable `UPDATES` to `enabled`:
Given that you've set up your import as described in the *Automatic updates* section during server setup, you can enable the updating process by setting the `UPDATES` variable while running your server as well:

```
docker run \
Expand Down
14 changes: 8 additions & 6 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@ if [ "$1" = "import" ]; then
wget -nv http://download.geofabrik.de/europe/luxembourg.poly -O /data.poly
fi

# determine and set osmosis_replication_timestamp (for consecutive updates)
osmium fileinfo /data.osm.pbf > /var/lib/mod_tile/data.osm.pbf.info
osmium fileinfo /data.osm.pbf | grep 'osmosis_replication_timestamp=' | cut -b35-44 > /var/lib/mod_tile/replication_timestamp.txt
REPLICATION_TIMESTAMP=$(cat /var/lib/mod_tile/replication_timestamp.txt)
if [ "$UPDATES" = "enabled" ]; then
# determine and set osmosis_replication_timestamp (for consecutive updates)
osmium fileinfo /data.osm.pbf > /var/lib/mod_tile/data.osm.pbf.info
osmium fileinfo /data.osm.pbf | grep 'osmosis_replication_timestamp=' | cut -b35-44 > /var/lib/mod_tile/replication_timestamp.txt
REPLICATION_TIMESTAMP=$(cat /var/lib/mod_tile/replication_timestamp.txt)

# initial setup of osmosis workspace (for consecutive updates)
sudo -u renderer openstreetmap-tiles-update-expire $REPLICATION_TIMESTAMP
# initial setup of osmosis workspace (for consecutive updates)
sudo -u renderer openstreetmap-tiles-update-expire $REPLICATION_TIMESTAMP
fi

# copy polygon file if available
if [ -f /data.poly ]; then
Expand Down

0 comments on commit 64c66a7

Please sign in to comment.