mediagis / nominatim-docker

100% working container for Nominatim
Creative Commons Zero v1.0 Universal
1.1k stars 446 forks source link

Connection to an external database #406

Open devopsnot opened 1 year ago

devopsnot commented 1 year ago

I need to be using an external database for my nomimatim, I need help with what I need to be added to my docker-compose to be connecting to a database;

docker-compose

nominatim: container_name: nominatim image: mediagis/nominatim:4.2 restart: always networks: nominatim: aliases:

leonardehrenfried commented 1 year ago

I would like to point out that this is not a big so I remove the label.

A user has documented how to use an external db here: https://github.com/mediagis/nominatim-docker/issues/245#issuecomment-1072205751

Once you've figured out how to convert this to docker-compose syntax, please post it here so it will be documentation for others.

dsperling commented 1 year ago

@devopsnot - There is a Docker Nominatim project we have started that might be of interest. n7m is a Numeronym for Nominatim. The project supports connecting the Nominatin App to a Postgres database running in a different container. Take a look at the docker-compose.yml at the root.

In the app & feed service of the compose file above, you can reference a different database using PGHOST like this:

...
  app:
    build: app
    image: smithmicro/n7m-app
    environment:
      - PGHOST=<hostname or ip adddress>
      - PGUSER=postgres
      - PGPASSWORD=n7m-geocoding
    depends_on:
      - gis
    mem_limit: 200m
  feed:
    image: smithmicro/n7m-app
    depends_on:
      - gis
    environment:
      - PGHOST=<hostname or ip adddress>
      - PGUSER=postgres
      - PGPASSWORD=n7m-geocoding
      - OSM_FILENAME=brazil-latest.osm.pbf
    command: setup
    volumes:
      - ${PWD}/data:/data/
...

Note: expect significantly slower imports if the Postgres container is running on a different host.