Open SumeetMoray opened 4 years ago
If your Postgres is on localhost, then hostname
in your connection string should point to the docker bridge, typically 172.17.0.1
(might differ based on OS) : https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach
I am able to run it in windows ... but not on ubuntu linux version 20.04 ... its really aweful ... something that docker developers must take a note !
Yeah, it's broken for me as well. I can run hasura just fine on macos but, when I go to run it on ubuntu, hasura cannot connect to postgres. Not sure how to fix this yet.
If you are using the docker instance of Hasura, you will need to open the ports for it to work on Ubuntu. In the docker-compose.yml where it says 'ports' under the postgres container add : and repeat the numbers. It should look like this for the postgres section.
postgres: image: postgres:12 restart: always ports:
Note that GitHub may mess up the yaml formatting. Then for PG_DATABASE_URL make it connect to localhost instead of a postgres host. It looks like this PG_DATABASE_URL: postgres://postgres:postgrespassword@localhost:5432/postgres
Hope this helps and know that this is not a production ready setup.
@SumeetMoray , to answer your question about connecting to a local Postgres database, you will have to configure your Postgres database with a user and database for Hasura, and then allow connections from the docker container that runs the Hasura console in the Postgres config. Linode has a very good tutorial about how to configure postgres. View the Linode tutorial here
Hope this help.
i am trying to follow this tutorial https://hasura.io/docs/1.0/graphql/manual/deployment/docker/index.html
on Ubuntu 20.04 to connect hasura with exisitng database
I tried this command but it does not work
docker run -d --net=host \ -e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \ -e HASURA_GRAPHQL_ENABLE_CONSOLE=true \ hasura/graphql-engine:latest
Can anyone throw some light on how to connect Hasura with Local Postgres Database ...