OHDSI / Perseus

[under development] Tools for ETL into OMOP CDM and deployment of OHDSI toolstack
Apache License 2.0
32 stars 8 forks source link

[BUG] Unable to Connect to Postgres Database #13

Closed TheCedarPrince closed 1 year ago

TheCedarPrince commented 1 year ago

Hi Perseus Team,

I am seemingly unable to scan a postgresql database instance from within Perseus and I am not sure why this is failing. Attached is a video of me attempting a connection but it fails:

https://user-images.githubusercontent.com/29561456/197873059-7cb46384-e2c2-4b1f-ba2a-a5925f7eb647.mp4

I followed the wiki and am unsure as to what happened -- this feels like a bug.

Thanks!

bradanton commented 1 year ago

@TheCedarPrince Try to add application IP ranges in pg_hba.conf file and restarted the Postgres instance.

chMatvey commented 1 year ago

@TheCedarPrince You tried connect from one container (White-Rabbit) to another (Shared-db). So in this case localhost would be host inside of container, and there are no any databases. To connect to shareddb container you should change localhost to shareddb.

TheCedarPrince commented 1 year ago

Hey @bradanton and @chMatvey , the solution of changing localhost to shareddb worked! However, this doesn't feel like a great solution. What would be a better solution to test or interact with Perseus?

Delvish commented 1 year ago

Hey @bradanton and @chMatvey , the solution of changing localhost to shareddb worked! However, this doesn't feel like a great solution. What would be a better solution to test or interact with Perseus?

as @chMatvey said, when using 'localhost', a container with White-Rabbit try to access 'inside itself', but there is no PostgreSQL running in this container at 127.0.0.1:5432. thus, in order to get into the PostgreSQL container from the White-Rabbit container, you need to call container by name (shareddb), or use the IP-address of your CRI (for example, Docker). it is not difficult to find out the address for Docker (on Linux, run "ifconfig |grep -A 7 docker0 |grep inet |tr -s ' ' |cut -d ' ' -f 3" or "ip a |grep docker0 |grep inet |tr -s ' ' |cut -d ' ' -f 3" in your terminal and you will see something like 172.17.0.1) or find docker-compose network address (docker network inspect perseus_default |grep -i gateway). in addition, you can use the IP-address of your Ethernet or WiFi connection (if it has not dynamic addressing, otherwise it will be less convenient), since PostgreSQL occupies a port at the address 0.0.0.0 on your host system.

ssamus commented 1 year ago

@TheCedarPrince I hope that the issue is fixed. If you have concerns related to this item or encounter any issues, you can raise another item or reopen it.