Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection to an external database #406

Open
devopsnot opened this issue Dec 15, 2022 · 2 comments
Open

Connection to an external database #406

devopsnot opened this issue Dec 15, 2022 · 2 comments

Comments

@devopsnot
Copy link

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:
- nominatim.localhost
environment:
- PBF_PATH=/var/lib/geofabrik/brazil-latest.osm.pbf
- REPLICATION_URL=https://download.geofabrik.de/south-america/brazil-updates/
- NOMINATIM_PASSWORD=nominatim123
volumes:
- /var/lib/geofabrik:/var/lib/geofabrik:ro
- /var/lib/nominatim:/nominatim/flatnode
- /var/lib/pgsql-nominatim:/var/lib/postgresql/14/main
shm_size: 16gb

@leonardehrenfried
Copy link
Collaborator

leonardehrenfried commented Dec 15, 2022

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:
#245 (comment)

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
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants