Hi, I am getting this error while setting up the P...
# pact-broker
h
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
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
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
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
okay
👍 1
y
@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
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
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
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
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
just to be clear the 9292 is the application port.