I am not able to connect to baserow db using pgAdmin

Are you using our SaaS platform (Baserow.io) or self-hosting Baserow?

Self-hosted

What do you need help with?

I just installed baserow using docker desktop. baserow app is running in browser, i can see database & table in browser. However when i see docker desktop i see only one container running and can also see volume showing baserow_data. But when i try to connect with pgAdmin to see the database and tables. It does not connect. Can you help to understand where is my db running and it is postgresSQL?

Please attach screenshots or videos if they help illustrate your question.

Hi!

Do you have 5432 port exposed by the docker for the Baserow container?

Yes in docker-compose.yaml file it has been done

-ports
-5432:5432

But when i see the process list, it do not show exposed.

Hi!

So, for a single container deployment, with built-in PostgreSQL, the database is configured for local, in-container connections only. It is possible to expose it to external connections, but this requires a bit of work:

  • first, the database must listen on interfaces that are accessible from outside. You can do that by adding EXTRA_POSTGRES_ARGS=' -c listen_addresses=*' env variable to the startup configuration for the container you’re running.

  • second thing is to enable external clients in host-based authentication configuration (pg_hba.conf file). Default contents of this file allow local connections only. The file is placed in /etc/postgresql/15/main/pg_hba.conf path in the container. You can add volume configuration for the container and inject host path with customized pg_hba.conf. The contents should contain
    host all all 0.0.0.0/0 scram-sha-256 line.

Example with a whole file:

# Database administrative login by Unix domain socket
local   all             postgres                                peer

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32            scram-sha-256
# IPv6 local connections:
host    all             all             ::1/128                 scram-sha-256
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256

# allow external connections:
host    all             all             0.0.0.0/0              scram-sha-256

Create a file on your computer with contents from above, and add a volume to the container:

/full/path/to/your/pg_hba.conf:/etc/postgresql/15/main/pg_hba.conf