merlinnot / nominatim-docker

Fully-featured container for geocoding, reverse geocoding and address lookup based on Nominatim and Open Street Map data.
MIT License
54 stars 35 forks source link

Simple question about postgre access #8

Closed toregua closed 5 years ago

toregua commented 5 years ago

First thank you for sharing this very nice docker project ! I have just a little question : is it possible to connecte to the postgre nominatim schema from outside the container ? (for port it is ok we can map it but for user and password do you have an idea ?)

I need to specify a connection string to photon that's why.

Thank you very much in advance

merlinnot commented 5 years ago

Hi, to connect to it from outside of the container you'd have to do two things:

The best place to do it: https://github.com/merlinnot/nominatim-docker/blob/cfe073f82e2e33da9f4409f1972003e00c2688c7/Dockerfile#L123

I have a plan to separate this image into services so it's more flexible, but it won't happen soon.

toregua commented 5 years ago

Thanks for you answer.

In fact i have modify your DockerFile by adding :

# Allow host to connect to docker container
RUN echo "host all  all    0.0.0.0/0  trust" >> /etc/postgresql/9.6/main/pg_hba.conf && \
    echo "listen_addresses='*'" >> /etc/postgresql/9.6/main/postgresql.conf

After that it is possible to connect to my postgresql database like this :

sudo psql -h MY_HOST_IP -p 5432 -U postgres

Thanks again