https://pact.io logo
#pact-broker
Title
# pact-broker
h

Harry

05/12/2022, 2:56 PM
Hi, I am getting this error while setting up the PACT broker, please assist.
Copy code
Error: Database is uninitialized and superuser password is not specified.
        You must specify POSTGRES_PASSWORD to a non-empty value for the
        superuser. For example, "-e POSTGRES_PASSWORD=password" on "docker run".

        You may also use "POSTGRES_HOST_AUTH_METHOD=trust" to allow all
        connections without a password. This is *not* recommended.

        See PostgreSQL documentation about "trust":
        <https://www.postgresql.org/docs/current/auth-trust.html>
m

Matt (pactflow.io / pact-js / pact-go)

05/12/2022, 9:07 PM
This looks like a postgres issue
perhaps you can describe a bit more about what you’re done so far, and what you have tried to fix it, and when that error has occurred?
h

Harry

05/13/2022, 6:28 AM
Hi Matt, we ran this command
docker logs <container id> --details.
on the following container to see what error has it logged !
Copy code
d88204f1f9d8   postgres                     "docker-entrypoint.s…"   21 seconds ago      Exited (1) 20 seconds ago               peaceful_mendel
we are checking all of this on AWS box.
Any help on this would be great, since we are unable to access the hosted pact-broker.
m

Matt (pactflow.io / pact-js / pact-go)

05/13/2022, 6:46 AM
OK thanks. This is not a Pact question though, this is a question about how to run Postgres on Docker. Best to consult the postgres and/or docker logs.
the error above is pretty clear - my guess is you haven’t set the environment variable
h

Harry

05/13/2022, 6:47 AM
okay
👍 1
y

Yousaf Nabi (pactflow.io)

05/13/2022, 9:17 AM
@Harry with the greatest respect, this is not a very good bug report. The error is quite verbose, and is clearly giving you a pointer Have you set a password and what instructions/steps have you followed.
h

Harry

05/13/2022, 2:45 PM
Just an update , we are trying to run the following command :-
sudo docker run -d pactfoundation/pact-broker
with the latest pact-broker version
2.98.0
and now encountering this issue
2022-05-13 14:35:52.560039 I [9:4600] pact-broker -- Connecting to database: -- "{:adapter=>\"postgres\", :encoding=>\"utf8\", :sql_log_level=>:debug, :enable_caller_logging=>false, :log_warn_duration=>5.0, :pool_timeout=>5, :driver_options=>{:options=>\"-c statement_timeout=15s\"}, :connect_max_retries=>0, :password=>\"*****\"}"
! Unable to load application: Sequel::DatabaseConnectionError: PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
y

Yousaf Nabi (pactflow.io)

05/13/2022, 2:57 PM
you aren't passing in an env vars, so it doesn't know where your database is
This is all in the docs btw https://github.com/pact-foundation/pact-broker-docker#configure-the-connection-details
Copy code
docker run --rm \
    -e PACT_BROKER_DATABASE_URL=<url> \
    pactfoundation/pact-broker
h

Harry

05/13/2022, 3:02 PM
looks like we previously were using Pact broker version 2.78.0 and it had default credentials
Thanks for the help, will check the environment variables.
👍 1
y

Yousaf Nabi (pactflow.io)

05/13/2022, 3:33 PM
fyi the exposed port is
9292
Copy code
docker run --rm \                                                                                                        ─╯
    -e PACT_BROKER_DATABASE_URL=$PACT_BROKER_DATABASE_URL \
    -p 9292:9292 \
    pactfoundation/pact-broker
b

Beth (pactflow.io/Pact Broker/pact-ruby)

05/17/2022, 12:29 AM
just to be clear the 9292 is the application port.