kopia lustrzana https://github.com/kartoza/docker-osm
Improvements to dockerfile: use storage volumes rather than a storage container. Added make command to remove those volumes. Readme cleanups
rodzic
d325ca6bf8
commit
cb30f182fb
|
@ -1,3 +1,4 @@
|
||||||
|
.DS_Store
|
||||||
.idea
|
.idea
|
||||||
*.*~
|
*.*~
|
||||||
*.log
|
*.log
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -59,6 +59,13 @@ rm: kill
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) rm
|
@docker-compose -f $(COMPOSE_FILE) -p $(PROJECT_ID) rm
|
||||||
|
|
||||||
|
rm: clean
|
||||||
|
@echo
|
||||||
|
@echo "------------------------------------------------------------------"
|
||||||
|
@echo "Removing all volumes!!!! "
|
||||||
|
@echo "------------------------------------------------------------------"
|
||||||
|
@docker volume rm docker-osm_osm-postgis-data docker-osm_import_queue docker-osm_import_done docker-osm_cache
|
||||||
|
|
||||||
logs:
|
logs:
|
||||||
@echo
|
@echo
|
||||||
@echo "------------------------------------------------------------------"
|
@echo "------------------------------------------------------------------"
|
||||||
|
|
|
@ -1,106 +1,10 @@
|
||||||
storage:
|
# Useage:
|
||||||
image: ubuntu:latest
|
|
||||||
container_name: dockerosm_storage
|
|
||||||
hostname: storage
|
|
||||||
volumes:
|
|
||||||
# These are sharable to other containers
|
|
||||||
- ./settings:/home/settings
|
|
||||||
- /home/import_done
|
|
||||||
- /home/import_queue
|
|
||||||
- /home/cache
|
|
||||||
#- ./import_done:/home/import_done
|
|
||||||
#- ./import_queue:/home/import_queue
|
|
||||||
#- ./cache:/home/cache
|
|
||||||
|
|
||||||
db:
|
# docker-compose -f docker-compose.yml -f docker-compose-web.yml
|
||||||
# About the postgresql version, it should match in the dockerfile of docker-imposm3
|
|
||||||
image: kartoza/postgis:9.6-2.4
|
|
||||||
container_name: dockerosm_db
|
|
||||||
hostname: db
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER=docker
|
|
||||||
- POSTGRES_PASS=docker
|
|
||||||
- POSTGRES_DBNAME=gis
|
|
||||||
volumes_from:
|
|
||||||
- storage
|
|
||||||
# Uncomment to use the postgis database from outside the docker network
|
|
||||||
# ports:
|
|
||||||
# - "5432:5432"
|
|
||||||
|
|
||||||
imposm:
|
|
||||||
# image: kartoza/docker-osm:imposm-latest
|
|
||||||
build: docker-imposm3
|
|
||||||
container_name: dockerosm_imposm
|
|
||||||
volumes_from:
|
|
||||||
- storage
|
|
||||||
links:
|
|
||||||
- db:db
|
|
||||||
environment:
|
|
||||||
- POSTGRES_USER=docker
|
|
||||||
- POSTGRES_PASS=docker
|
|
||||||
- POSTGRES_DBNAME=gis
|
|
||||||
- POSTGRES_PORT=5432
|
|
||||||
- POSTGRES_HOST=db
|
|
||||||
# seconds between 2 executions of the script
|
|
||||||
# if 0, then no update will be done, only the first initial import from the PBF
|
|
||||||
- TIME=120
|
|
||||||
# folder for settings (with *.json and *.sql)
|
|
||||||
- SETTINGS=settings
|
|
||||||
# folder for caching
|
|
||||||
- CACHE=cache
|
|
||||||
# folder for diff which has been imported
|
|
||||||
- IMPORT_DONE=import_done
|
|
||||||
# folder for diff which hasn't been imported yet
|
|
||||||
- IMPORT_QUEUE=import_queue
|
|
||||||
# it can be 3857
|
|
||||||
- SRID=4326
|
|
||||||
# see http://imposm.org/docs/imposm3/latest/tutorial.html#optimize
|
|
||||||
- OPTIMIZE=false
|
|
||||||
# see http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables
|
|
||||||
- DBSCHEMA_PRODUCTION=public
|
|
||||||
# http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables
|
|
||||||
- DBSCHEMA_IMPORT=import
|
|
||||||
# http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables
|
|
||||||
- DBSCHEMA_BACKUP=backup
|
|
||||||
# Install some styles if you are using the default mapping. It can be 'yes' or 'no'
|
|
||||||
- QGIS_STYLE=yes
|
|
||||||
# Use clip in the database
|
|
||||||
- CLIP=no
|
|
||||||
|
|
||||||
|
|
||||||
osmupdate:
|
|
||||||
# image: kartoza/docker-osm:osmupdate-latest
|
|
||||||
build: docker-osmupdate
|
|
||||||
container_name: dockerosm_osmupdate
|
|
||||||
volumes_from:
|
|
||||||
- storage
|
|
||||||
environment:
|
|
||||||
# These are all currently the defaults but listed here for your
|
|
||||||
# convenience if you want to change them
|
|
||||||
# the maximum time range to assemble a cumulated changefile.
|
|
||||||
- MAX_DAYS=100
|
|
||||||
# osmupdate uses a combination of minutely, hourly and daily changefiles. This value can be minute, hour, day or sporadic.
|
|
||||||
- DIFF=sporadic
|
|
||||||
# argument to determine the maximum number of parallely processed changefiles.
|
|
||||||
- MAX_MERGE=7
|
|
||||||
# define level for gzip compression. values between 1 (low compression but fast) and 9 (high compression but slow)
|
|
||||||
- COMPRESSION_LEVEL=1
|
|
||||||
# change the URL to use a custom URL to fetch regional file updates.
|
|
||||||
- BASE_URL=http://planet.openstreetmap.org/replication/
|
|
||||||
# folder for diff which hasn't been imported yet
|
|
||||||
- IMPORT_QUEUE=import_queue
|
|
||||||
# folder for diff which has been imported
|
|
||||||
- IMPORT_DONE=import_done
|
|
||||||
# seconds between 2 executions of the script
|
|
||||||
# if 0, then no update will be done, only the first initial import from the PBF
|
|
||||||
- TIME=120
|
|
||||||
|
|
||||||
qgisserver:
|
qgisserver:
|
||||||
image: kartoza/qgis-server:2.18
|
image: kartoza/qgis-server:2.18
|
||||||
hostname: dockerosm_qgisserver
|
hostname: dockerosm_qgisserver
|
||||||
container_name: dockerosm_qgisserver
|
|
||||||
#volumes_from:
|
|
||||||
# - btsync
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./logs:/var/log/apache2
|
- ./logs:/var/log/apache2
|
||||||
- ./web:/project
|
- ./web:/project
|
||||||
|
@ -109,16 +13,4 @@ qgisserver:
|
||||||
- db:db
|
- db:db
|
||||||
ports:
|
ports:
|
||||||
- 8198:80
|
- 8198:80
|
||||||
restart: on-failure:5
|
restart: unless-stopped
|
||||||
|
|
||||||
#btsync:
|
|
||||||
# image: kartoza/btsync
|
|
||||||
# container_name: dockerosm_btsync
|
|
||||||
# hostname: dockerosm_btsync
|
|
||||||
# volumes:
|
|
||||||
# - /web
|
|
||||||
# environment:
|
|
||||||
# This should be the read only key
|
|
||||||
# - SECRET=BBEBVOOYDPGO3GIIEQUMAIEJQNINOLX7V
|
|
||||||
# - DEVICE=readonly-
|
|
||||||
# restart: on-failure:5
|
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
version: '2.1'
|
version: '2.1'
|
||||||
|
|
||||||
services:
|
|
||||||
storage:
|
|
||||||
image: ubuntu:18.04
|
|
||||||
volumes:
|
volumes:
|
||||||
# These are sharable to other containers
|
osm-postgis-data:
|
||||||
- ./settings:/home/settings
|
import_done:
|
||||||
- /home/import_done
|
import_queue:
|
||||||
- /home/import_queue
|
cache:
|
||||||
- /home/cache
|
|
||||||
|
|
||||||
|
services:
|
||||||
db:
|
db:
|
||||||
# About the postgresql version, it should match in the dockerfile of docker-imposm3
|
# About the postgresql version, it should match in the dockerfile of docker-imposm3
|
||||||
image: kartoza/postgis:9.6-2.4
|
image: kartoza/postgis:9.6-2.4
|
||||||
|
@ -18,19 +15,24 @@ services:
|
||||||
- POSTGRES_USER=docker
|
- POSTGRES_USER=docker
|
||||||
- POSTGRES_PASS=docker
|
- POSTGRES_PASS=docker
|
||||||
- POSTGRES_DBNAME=gis
|
- POSTGRES_DBNAME=gis
|
||||||
volumes_from:
|
volumes:
|
||||||
- storage
|
- 'osm-postgis-data:/var/lib/postgresql'
|
||||||
# Uncomment to use the postgis database from outside the docker network
|
# Uncomment to use the postgis database from outside the docker network
|
||||||
#ports:
|
ports:
|
||||||
#- "35432:5432"
|
- "35432:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "exit 0"
|
test: "exit 0"
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
imposm:
|
imposm:
|
||||||
# image: kartoza/docker-osm:imposm-latest
|
image: kartoza/docker-osm:imposm-latest
|
||||||
build: docker-imposm3
|
#build: docker-imposm3
|
||||||
volumes_from:
|
volumes:
|
||||||
- storage
|
# These are sharable to other containers
|
||||||
|
- ./settings:/home/settings
|
||||||
|
- import_done:/home/import_done
|
||||||
|
- import_queue:/home/import_queue
|
||||||
|
- cache:/home/cache
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
|
@ -65,11 +67,17 @@ services:
|
||||||
- QGIS_STYLE=yes
|
- QGIS_STYLE=yes
|
||||||
# Use clip in the database
|
# Use clip in the database
|
||||||
- CLIP=no
|
- CLIP=no
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
osmupdate:
|
osmupdate:
|
||||||
build: docker-osmupdate
|
#build: docker-osmupdate
|
||||||
volumes_from:
|
image: kartoza/docker-osm:osmupdate-latest
|
||||||
- storage
|
volumes:
|
||||||
|
# These are sharable to other containers
|
||||||
|
- ./settings:/home/settings
|
||||||
|
- import_done:/home/import_done
|
||||||
|
- import_queue:/home/import_queue
|
||||||
|
- cache:/home/cache
|
||||||
environment:
|
environment:
|
||||||
# These are all currently the defaults but listed here for your
|
# These are all currently the defaults but listed here for your
|
||||||
# convenience if you want to change them
|
# convenience if you want to change them
|
||||||
|
@ -90,3 +98,4 @@ services:
|
||||||
# seconds between 2 executions of the script
|
# seconds between 2 executions of the script
|
||||||
# if 0, then no update will be done, only the first initial import from the PBF
|
# if 0, then no update will be done, only the first initial import from the PBF
|
||||||
- TIME=120
|
- TIME=120
|
||||||
|
restart: unless-stopped
|
||||||
|
|
55
readme.md
55
readme.md
|
@ -1,18 +1,21 @@
|
||||||
# Docker-OSM
|
# Docker-OSM
|
||||||
|
|
||||||
A docker compose project to setup an OSM PostGIS database with automatic updates from OSM periodically.
|
A docker compose project to setup an OSM PostGIS database with automatic
|
||||||
|
updates from OSM periodically.
|
||||||
The only file you need is a PBF file and run the docker compose project.
|
The only file you need is a PBF file and run the docker compose project.
|
||||||
|
|
||||||
## Docker cloud
|
## Docker cloud
|
||||||
|
|
||||||
Dockerfiles are executed on https://cloud.docker.com
|
Dockerfiles are executed on https://cloud.docker.com
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker pull kartoza/docker-osm:imposm-latest
|
docker pull kartoza/docker-osm:imposm-latest
|
||||||
docker pull kartoza/docker-osm:osmupdate-latest
|
docker pull kartoza/docker-osm:osmupdate-latest
|
||||||
```
|
```
|
||||||
|
|
||||||
You need to copy/paste the docker-compose project and use the images hosted on the internet.
|
To run you can use the provided docker-compose project and use the images
|
||||||
This is useful if you want to integrate Docker-OSM in your existing docker-compose project.
|
hosted on the internet. This is useful if you want to integrate Docker-OSM in
|
||||||
|
your existing docker-compose project.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -35,16 +38,19 @@ You must put only one PBF file in the settings folder. Only the last one will be
|
||||||
### OSM Features
|
### OSM Features
|
||||||
|
|
||||||
In `settings`, you can edit the `mapping.yml` to customize the PostGIS schema.
|
In `settings`, you can edit the `mapping.yml` to customize the PostGIS schema.
|
||||||
You can find the documentation about the mapping configuration on the imposm website: https://imposm.org/docs/imposm3/latest/mapping.html
|
You can find the documentation about the mapping configuration on the imposm
|
||||||
The default file in Docker-OSM is coming from https://raw.githubusercontent.com/omniscale/imposm3/master/example-mapping.yml
|
website: https://imposm.org/docs/imposm3/latest/mapping.html
|
||||||
|
The default file in Docker-OSM is coming from
|
||||||
|
https://raw.githubusercontent.com/omniscale/imposm3/master/example-mapping.yml
|
||||||
|
|
||||||
### Updates
|
### Updates
|
||||||
|
|
||||||
You can configure the time interval in the docker-compose file. By default, it's two minutes.
|
You can configure the time interval in the docker-compose file. By default,
|
||||||
If you set the TIME variable to 0, no diff files will be imported.
|
it's two minutes. If you set the TIME variable to 0, no diff files will be
|
||||||
|
imported.
|
||||||
|
|
||||||
The default update stream is worldwide.
|
The default update stream is worldwide. So even if you imported a local PBF, if
|
||||||
So even if you imported a local PBF, if you don't set a clipping area, you will end with data from all over the world.
|
you don't set a clipping area, you will end with data from all over the world.
|
||||||
|
|
||||||
### Clipping
|
### Clipping
|
||||||
|
|
||||||
|
@ -58,8 +64,9 @@ You can remove the clip file : `make remove_clip`.
|
||||||
|
|
||||||
### QGIS Styles
|
### QGIS Styles
|
||||||
|
|
||||||
The database is provided with some default styles. These styles will be loaded automatically when loaded in QGIS.
|
The database is provided with some default styles. These styles will be loaded
|
||||||
It's following the default OSM mapping from ImpOSM.
|
automatically when loaded in QGIS. It's following the default OSM mapping from
|
||||||
|
ImpOSM.
|
||||||
|
|
||||||
```
|
```
|
||||||
make import_styles
|
make import_styles
|
||||||
|
@ -87,9 +94,9 @@ docker-compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
You can check the timestamp of your database by reading the file :
|
You can check the timestamp of your database by reading the file :
|
||||||
'settings/timestamp.txt'
|
``settings/timestamp.txt`` or you can use :
|
||||||
or you can use :
|
|
||||||
'make timestamp'
|
``make timestamp``
|
||||||
|
|
||||||
### Display
|
### Display
|
||||||
|
|
||||||
|
@ -110,8 +117,8 @@ Because in the docker-compose file, the link is made with the PostGIS database u
|
||||||
|
|
||||||
### Docker OSM Update
|
### Docker OSM Update
|
||||||
|
|
||||||
This docker image when run will fetch on a regular interval any new diff file
|
This docker image, when run will regularly fetch any new diff file for all the
|
||||||
for all the changes that have happened in the world over the update interval.
|
changes that have happened in the world over the update interval.
|
||||||
|
|
||||||
You can also specify a custom url for fetching the diff if you wish to retrieve
|
You can also specify a custom url for fetching the diff if you wish to retrieve
|
||||||
regional diffs rather than the global one.
|
regional diffs rather than the global one.
|
||||||
|
@ -120,7 +127,7 @@ You can specify a polygonal area for the diff so that it will only apply feature
|
||||||
from the diff that fall within that area. For example providing a polygon of the
|
from the diff that fall within that area. For example providing a polygon of the
|
||||||
borders of Malawi will result in only Malawi features being extracted from the diff.
|
borders of Malawi will result in only Malawi features being extracted from the diff.
|
||||||
|
|
||||||
Note that the diff retrieved and options specified here are not related to the
|
**Note:** the diff retrieved and options specified here are not related to the
|
||||||
initial base map used - so for example if your initial base map is for Malawi and
|
initial base map used - so for example if your initial base map is for Malawi and
|
||||||
you specify a diff area in Botswana, updated features in Botswana will be applied
|
you specify a diff area in Botswana, updated features in Botswana will be applied
|
||||||
to your base map which only includes features from Malawi. For this reason, take
|
to your base map which only includes features from Malawi. For this reason, take
|
||||||
|
@ -140,6 +147,8 @@ http://download.openstreetmap.fr/extracts/africa/south_africa.state.txt
|
||||||
``docker run -v $('pwd')import-queue/:/home/import-queue -v $('pwd')base-pbf/:/home/base-pbf -v $('pwd')import-done/:/home/import-done -d osmupdate``
|
``docker run -v $('pwd')import-queue/:/home/import-queue -v $('pwd')base-pbf/:/home/base-pbf -v $('pwd')import-done/:/home/import-done -d osmupdate``
|
||||||
|
|
||||||
With -e, you can add some settings :
|
With -e, you can add some settings :
|
||||||
|
|
||||||
|
```
|
||||||
- MAX_DAYS = 100, the maximum time range to assemble a cumulated changefile.
|
- MAX_DAYS = 100, the maximum time range to assemble a cumulated changefile.
|
||||||
- DIFF = sporadic, osmupdate uses a combination of minutely, hourly and daily changefiles. This value can be minute, hour, day or sporadic.
|
- DIFF = sporadic, osmupdate uses a combination of minutely, hourly and daily changefiles. This value can be minute, hour, day or sporadic.
|
||||||
- MAX_MERGE = 7, argument to determine the maximum number of parallely processed changefiles.
|
- MAX_MERGE = 7, argument to determine the maximum number of parallely processed changefiles.
|
||||||
|
@ -149,6 +158,7 @@ With -e, you can add some settings :
|
||||||
- IMPORT_DONE = import_done
|
- IMPORT_DONE = import_done
|
||||||
- OSM_PBF = osm_pbf
|
- OSM_PBF = osm_pbf
|
||||||
- TIME = 120, seconds between two executions of the script
|
- TIME = 120, seconds between two executions of the script
|
||||||
|
```
|
||||||
|
|
||||||
If you are using docker-compose, you can use these settings within the
|
If you are using docker-compose, you can use these settings within the
|
||||||
```docker-compose.yml``` file.
|
```docker-compose.yml``` file.
|
||||||
|
@ -165,6 +175,8 @@ The container will look for an OSM file (*.pbf) and its state file
|
||||||
(*.state.txt) in BASE_PBF.
|
(*.state.txt) in BASE_PBF.
|
||||||
|
|
||||||
With -e, you can add some settings :
|
With -e, you can add some settings :
|
||||||
|
|
||||||
|
```
|
||||||
- TIME = 120, seconds between 2 executions of the script
|
- TIME = 120, seconds between 2 executions of the script
|
||||||
- POSTGRES_USER = docker, default user
|
- POSTGRES_USER = docker, default user
|
||||||
- POSTGRES_PASS = docker, default password
|
- POSTGRES_PASS = docker, default password
|
||||||
|
@ -180,10 +192,19 @@ With -e, you can add some settings :
|
||||||
- DBSCHEMA_PRODUCTION = public, check (Imposm)[http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables]
|
- DBSCHEMA_PRODUCTION = public, check (Imposm)[http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables]
|
||||||
- DBSCHEMA_IMPORT = import, check (Imposm)[http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables]
|
- DBSCHEMA_IMPORT = import, check (Imposm)[http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables]
|
||||||
- DBSCHEMA_BACKUP = backup, check (Imposm)[http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables]
|
- DBSCHEMA_BACKUP = backup, check (Imposm)[http://imposm.org/docs/imposm3/latest/tutorial.html#deploy-production-tables]
|
||||||
|
```
|
||||||
|
|
||||||
You can adjust these preferences in the ```docker-compose.yml``` file provided
|
You can adjust these preferences in the ```docker-compose.yml``` file provided
|
||||||
in this repository.
|
in this repository.
|
||||||
|
|
||||||
|
# QGIS Server
|
||||||
|
|
||||||
|
You can run a QGIS Server front end to the OSM mirroir by using the provided
|
||||||
|
docker-compose-web.yml file. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
docker-compose -f docker-compose.yml -f docker-compose-web.yml qgisserver up
|
||||||
|
```
|
||||||
|
|
||||||
# Credits
|
# Credits
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue