This project is assumed to be a replacement for current OpenStreetMap Carto's docker facilities.
Docker is available for Linux, macOS and Windows. Apart from Docker Engine itself there is a set of automation tools commonly used to manage containers. To get OpenStreetMap Carto running you will need Docker Compose and Dobi.
Download openstreetmap-carto release or just grab the latest sources and switch to the fetched directory:
$ git clone https://github.com/gravitystorm/openstreetmap-carto.git
$ cd openstreetmap-carto
Clone this project into docker
subdirectory:
$ git clone https://github.com/OnkelTem/osmcarto-docker.git docker
Download OSM data of your interest in osm.pbf format to a file data.osm.pbf
and place it within your openstreetmap-carto
directory.
@Todo: Automate getting and updating OSM data.
To pull and build all required Docker images, download fonts, shapefiles, initialize the database and import OSM data into it run:
$ dobi init
This step is really time consuming so you can do something else in the meantime.
When it's ready you can now run both Kosmtik and tiles server with:
dobi start
To stop them anytime just type:
$ dobi stop
Or you can run Kosmtik and Tiles server separately:
- Kosmtik
- start:
dobi kosmtik-start
- stop:
dobi kosmtik-stop
- start:
- Tiles server
- start:
dobi tiles-start
- stop:
dobi tiles-stop
- start:
Browse to http://localhost:6789 to view the Kosmtik output. The tiles server receives requests on http://localhost:8097 which you can use as a base uri for QGis or other software. Also, opening this URL in browser will load simple page for viewing OSM map.
Docker configuration is comprised with few docker-compose.*.yml
files and one dobi.yaml
file.
This setup uses three Docker Compose files:
docker-compose.db.yml
- declares PostGIS database containerdocker-compose.kosmtik.yml
- declares Kosmtik containerdocker-compose.tiles.yml
- declares Tiles container
NOTE: You don't need to run docker-compose
tool manually as its files are used internally by Dobi.
Dobi reads its configuration from dobi.yaml
file which defines image, mounts, jobs and "services" for Dobi automation tool.
You run Dobi tasks as simple as:
$ dobi <task>
where task
is the name of a resource which is usually a job or an alias. To learn more about Dobi check out its documentation.
Here is the list of all jobs and aliases defined in this project:
- Jobs
shapefiles
- downloads and indexes shapefiles of world boundariesfonts
- downloads fonts populatingosmcarto_fonts
volumeimport
- imports OSM data fromdata.osm.pbf
into PostGIS database using osm2pgsql toolcompile
- compilesproject.mml
tostyle.xml
- Aliases
build
- builds all docker imagesinit
- runsshapefiles
,fonts
andimport
jobskosmtik-start
- runs Kosmtikkosmtik-stop
- stops Kosmtiktiles-start
- Runs tiles servertiles-stop
- Stops tiles serverstart
- Runs both Kosmtik and tiles server (this is also the default Dobi action which executes when you rundobi
without parameters)stop
- Stops both Kosmtik and tiles server
Docker Volumes are pieces of data which are mounted into containers as directories. They are used to make data persistent i.e. to not get it disappeared across container runs. Usually they're used either for big or variable data like databases, caches and etc, so that one can manage them independently.
This project uses the next volumes:
osmcarto_db
- a volume with PostGIS database.osmcarto_fonts
- a volume with fonts used by OSM carto.osmcarto_tiles
- a volume with the tiles server cached tiles.
You can list them with docker volume ls
. If you don't need some data anymore, first stop the corresponding containers if they're running (i.e. stop dobi tasks)
and then remove the volume with docker volume rm <volume_name>
.