Connecting to Baserow PostgreSQL database using GUI

I am trying to use PSequel 2 on my mac to connect to the Docker-powered database container. I must be doing something silly as I am used to using MySQL. Does this have anything to do with envelope var “DISABLE_ANONYMOUS_PUBLIC_VIEW_WS_CONNECTIONS” … if I were to redeploy this container do I just set this to false?

Connection details I am using are included below where password is also “baserow” …

Any assistance is greatly appreciated.

Hey @bfranklin , by default when running

docker-compose up -d the postgres database is not available to connect to. To make it available you will need to edit the docker-compose.yml file found in your baserow folder so the database service at the top of the file looks like this:

  db:
    # Please ensure the postgres-client's major version in the backend image is kept in
    # sync with this major version so pg_dump remains compatible.
    ports:
      - "${HOST_PUBLISH_IP:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432"
    image: postgres:11.3
    environment:
      - POSTGRES_USER=${DATABASE_USER:-baserow}
      - POSTGRES_PASSWORD=${DATABASE_PASSWORD:-baserow}
      - POSTGRES_DB=${DATABASE_NAME:-baserow}
    networks:
      local:
    volumes:
      - pgdata:/var/lib/postgresql/data

Where the two new lines are

    ports:
      - "${HOST_PUBLISH_IP:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432"

After doing this you will then need to run
docker-compose restart for it to pickup the changes, afterwhich you should be able to connect to the baserow postgres.

Does this info still apply to the current docker-compose.yml? I’m trying to connect to the database via Adminer and it’s failing to work with the error:
SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?

My configuration below:

.env

SECRET_KEY=huH5kXq7bf6qSmh3
DATABASE_PASSWORD=zLEUtJKhvUM7Pt6
REDIS_PASSWORD=oMhHr8hX29Hja6dxE
BASEROW_PUBLIC_URL=http://localhost:5147
BASEROW_CADDY_ADDRESSES=:80
WEB_FRONTEND_PORT=5147
HOST_PUBLISH_IP=0.0.0.0

docker-compose.yml

  db:
    # Please ensure the postgres-client's major version in the backend image is kept in
    # sync with this major version so pg_dump remains compatible.
    ports:
      - "${HOST_PUBLISH_IP:-127.0.0.1}:${POSTGRES_PORT:-5432}:5432"
    image: postgres:11.3
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${DATABASE_USER:-baserow}
      - POSTGRES_PASSWORD=${DATABASE_PASSWORD:?}
      - POSTGRES_DB=${DATABASE_NAME:-baserow}
    healthcheck:
      test: [ "CMD-SHELL", "su postgres -c \"pg_isready -U ${DATABASE_USER:-baserow}\"" ]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      local:
    volumes:
      - pgdata:/var/lib/postgresql/data

@Teferi is Adminer running on the same machine as baserow? Is it running in its own docker container perhaps? Also if those are you real secret keys and passwords I recommend you change them immediately as this is a public forum.

Yes and yes, here is the Adminer part of docker-compose.yml:

  adminer:
    image: adminer
    restart: unless-stopped
    ports:
      - 8069:8080 

They’re not and I’m also only testing Baserow locally at the moment.

If that is in the same docker-compose.yml as the db service then you should be able to make the following changes:

  1. No need to expose a port in the db service
  2. Add the adminer service to the local network that the db is also in
    networks:
      local:
  1. In the adminer gui put db as the server . This is because when using docker-compose containers in the same network can be accessed using their service name as defined in the docker-compose. This means the adminer container should be able to connect to the hostname db which will be the db container. Additionally this means you don’t need to expose the port for the db container as if containers are on the same network then they can access all of the other containers ports (unless you also want to access the postgres db from some other non-docker host on the server or externally).
1 Like

That got it working :slight_smile: thanks for the help!