0

setting up a default chainlink node with docker containers. I decided to spin up my postgresql on another docker container and I am trying to use it as my default db for the node, currently I'm trying to figure out why my postgresql db seems to be refusing my connections I'm getting this error below, I've confirmed that my postgresql container is running correctly on localhost 5432 but the error seems to want me to edit some config file somewhere to allow access to make the connection but I'm not sure where that is or if that's the case? sorry I'm new to docker at the moment

[ERROR] failed to initialize database, got error failed to 
connect to `host=192.168.1.198 user=postgres database=postgres`:
server error (FATAL: no pg_hba.conf entry for host "192.168.1.198",
 user "postgres", database "postgres", SSL off (SQLSTATE 28000))

here is my docker run command which I'm following per -> https://docs.chain.link/docs/running-a-chainlink-node/

docker run -p 6688:6688 -v -it --env-file=.env smartcontract/chainlink:0.10.11 local n

here is my actual .env file being accessed when the nodes container is being created by the above command, for reference I am running the command from the same directory as the .env file


ROOT=/chainlink
LOG_LEVEL=debug
MIN_OUTGOING_CONFIRMATIONS=2
ETH_CHAIN_ID=4
LINK_CONTRACT_ADDRESS=xxxxxxxxxxxxxxxxxxxxxxx
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
GAS_UPDATER_ENABLED=true
FEATURE_FLUX_MONITOR=true
ALLOW_ORIGINS=*
DATABASE_URL=postgresql://postgres:somePassword@192.168.1.198:5432/postgres?sslmode=disable
ETH_URL=wss://ropsten.infura.io/ws/v3/xxxxxxxxxxxxxxxxxxxxxxx
DATABASE_TIMEOUT=0

luther wardle
  • 439
  • 5
  • 17

1 Answers1

0

the error seems to want me to edit some config file somewhere to allow access to make the connection but I'm not sure where that is or if that's the case

Yes pg_hba.conf is a file that postgres use for controlling client authentication. You must edit it for allowing remote clients to talk to it.

For a dev environment you must be good allowing all.

Although, I will try first to run both containers in the same docker network keeping pg_hba.conf as is. My guess is that the official postgres image allow traffic originating from the same network.

More resources here and here (see POSTGRES_HOST_AUTH_METHOD)

aiqency
  • 1,015
  • 1
  • 8
  • 22