Giter Site home page Giter Site logo

whitepages / docker-nominatim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fkoester/docker-nominatim

1.0 15.0 4.0 48 KB

Nominatim Docker setup with separate containers for Nominatim and PostgreSQL/PostGIS database

License: GNU Affero General Public License v3.0

Shell 95.48% PHP 4.52%

docker-nominatim's Introduction

docker-nominatim

A docker setup for running a custom instance of the Nominatim geocoding service providing a nominatim-only image for use together with the plain mdillon/postgis image.

In contrast to other nominatim docker setups I have seen so far (see Alternatives) this setup has two main advantages:

  1. Two separate containers instead of one for all services:
  • Apache containing the Nominatim instance
  • PostgreSQL + PostGIS (using plain mdillon/postgis image)

This better complies with Docker's key principal: one container per service. The two docker containers are orchestrated using docker-compose.

  1. The import does not happen at buildtime of the image but rather at runtime.

This property is a consequence of 1.) because Nominatim of course needs the Database to import into. It also avoids nasty problems happening when trying to coordinate multiple processes from a Dockerfile.

This design of course means you cannot just prebuilt the ready-to-use Nominatim image on one host and copy it over to another (e.g. production) machine. But you can still copy the prebuilt database data, as described in section Transferring prebuilt instance to other host.

Supported tags and respective Dockerfile links

Getting started

  1. Make sure you have current versions of Docker (>= 1.12) and docker-compose (>= 1.9).
  2. Clone this repository
  3. Create a docker volume named nominatim-database:
$ docker volume create --name nominatim-database
  1. Create and start the docker containers using docker-compose:
$ docker-compose up

This will command will:

  • Fetch the necessary docker images
  • Start the OSM data import process, by default for Monaco (see following section for how to change)
  • Create all the necessary database indexes for nominatim
  • Startup an Apache instance at port 8080 (configurable)

After completion (should take only a few minutes for Monaco), you should be able to access the Nominatim instance at http://localhost:8080.

The initial import will only happen on first startup, because the entrypoint script will check if a database named nominatim already exists. In order to repeat the initial import, just remove the data volume nominatim-database:

$ docker volume rm nominatim-database

Configuration

Create a file .env in the working directory with any of the following variables:

  • PLANET_DATA_URL: The PBF planet file to download and import (default http://download.geofabrik.de/europe/monaco-latest.osm.pbf)
  • OSM2PGSQL_CACHE: The cache size (in MB) passed to nominatim via the --osm2pgsql-cache argument. More info here and here (default 14000)
  • EXTERNAL_PORT: The external port (and ip address) to bind to (default 127.0.0.1:8080)
  • IMPORT_DATA_DIR: The directory where the planet file data.osm.pbf is stored or downloaded to (default ./volumes/importdata)

Transferring prebuilt instance to another host

Transferring the prebuilt instance basically means copying the contents of the PostgreSQL database, which in this setup are stored in the named docker volume nominatim-database.

On the machine with the prebuilt nominatim instance, run the following steps:

  1. Get the ssh-copy-docker-volume.sh script.
  2. Make sure the Docker containers are stopped:
docker-compose stop
  1. Transfer the nominatim-database docker volume to the target host:
$ ./ssh-copy-docker-volume.sh nominatim-database example.com

Then on the target machine, follow the steps from the Getting Started section but skip step 3, the creation of the volume.

Alternatives

docker-nominatim's People

Contributors

csgero avatar fkoester avatar kmate avatar saabeilin avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.