Closed DewangS closed 2 years ago
ok, figured it out. please ignore though still can't connect remotely
If you want to access the database outside of docker, you will need to map to port in the docker-compose file.
I did map it though still it won't work.. see below. My Numbas setup (Docker containers) are on a RedHat server. When I try to use DBevar from my Mac and use the Redhat host name and 5432 as a port it fails to connect. e.g. say xyz.mno.com.au is my RHEL host, I try to add that in DBevar as a host name for Postgres with the port 5432
postgres: env_file:
Are you sure that the postgres port is exposed on the redhat server? If not, you will need to setup an ssh tunnel in your client program. Or you can expose the postgres port of your server, but that is less secure.
yes, it is exposed and I've just figured it out on how to connect to the DB. Basically I had to use SSH tunnel setting in the DBeaver to ensure that the connection is made to the RHEL host first and in the Db connection (Main tab in DBevar) I used localhost as a DB host and now it work. Thanks for your tip.
I tried to SSH in to the Postgres container but when I try to run the below command from the command line, I get an error that 'root' role doesn't exist. The web app seem to have connected to the DB without any issues as I can't see any errors when I docker-compose up. any idea?
root@5741800ebab2:/# psql -h localhost -U root psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: role "root" does not exist