Migrating Internal Baserow DB to External DB

Please fill in the questionnaire below.

Technical Help Questionnaire

Have you read and followed the instructions at: *READ ME FIRST* Technical Help FAQs - #2 by nigel ?

Answer: Yup

Self-Hosted Installation and Setup Questions

Hostingon VPS through Docker Compose behind Traefik Reverse Proxy

What are the specs of the service or server you are using to host Baserow.

8GB RAM, plenty of resources for everything else.

Which version of Baserow are you using.

1.17.0

How have you configured your self-hosted installation?

# docker-compose.yaml
version: "3.8"

networks:
  public:
    name: ${COMPOSE_PROJECT_NAME}-public
  postgres:
    name: postgres-public
    external: true

services:
  baserow:
    container_name: ${COMPOSE_PROJECT_NAME}
    image: baserow/baserow:${VERSION}
    restart: unless-stopped
    networks:
      - public
      - postgres
    expose:
      - 80
    labels:
      - traefik.enable=true
      - traefik.docker.network=${COMPOSE_PROJECT_NAME}-public
      
      ### Entrypoints ###
      - traefik.http.routers.router->${COMPOSE_PROJECT_NAME}.entrypoints=http,https

      ### Routers ###
      - traefik.http.routers.router->${COMPOSE_PROJECT_NAME}.rule=Host(`${SUBDOMAIN}.${HOSTNAME}`)

      ### Middlewares ###
      - traefik.http.routers.router->${COMPOSE_PROJECT_NAME}.middlewares=redirect->https@file

      ### TLS ###
      - traefik.http.routers.router->${COMPOSE_PROJECT_NAME}.tls=true
      - traefik.http.routers.router->${COMPOSE_PROJECT_NAME}.tls.certresolver=letsencrypt

      ### Service ###
      - traefik.http.routers.router->${COMPOSE_PROJECT_NAME}.service=${COMPOSE_PROJECT_NAME}
      - traefik.http.services.${COMPOSE_PROJECT_NAME}.loadbalancer.server.port=80
    volumes:
      - ./data:/baserow/data
    environment:
      BASEROW_PUBLIC_URL: https://${SUBDOMAIN}.${HOSTNAME}
      # DATABASE_HOST: postgres # Commented out for reference - wasn't used in initial setup.

volumes:
  baserow:
    name: ${COMPOSE_PROJECT_NAME}
COMPOSE_PROJECT_NAME=baserow
HOSTNAME=***.***.com

SUBDOMAIN=tables
VERSION=1.17.0

DB_HOST=postgres

What commands if any did you use to start your Baserow server?

docker compose up -d

Describe the problem

Issues moving the internal PG baserow database housing our data to an external pg database. Our goal is to have this separate database available through docker networking to a metabase docker container. The external pg database is also hosted through a docker container.

When I originally created the Baserow container, we didn’t use an external DB using the DATABASE_HOST env var. Now, I would like to switch to an external database, so other containers (like Metabase) can access it.

I have copied the /baserow/data/postgres folder in its entirety into the separate postgres docker container volume. I have set up that container with credentials POSTGRES_USER=postgres, and POSTGRES_PASSWORD=${THE_SECRET_CONTAINED_IN_/baserow/data/.pgpass}. I’m not sure what database name to use.

When I do this and try to spin up the separate PG container, it fails with an error code 2. I guess, this is more an issue of migrating the Baserow DB out, rather than a hosting setup issue with Baserow specifically. The Baserow hosting setup is working perfectly.

Any ideas why the new Postgres Container wouldn’t be able to spin up using the copy-pasted postgres folder as it’s database folder?

Hey Carson,
thanks for reaching out.
Error code 2 on PG is “usually” connected to either OOM killed process or DB Health.
PG container logs would be valuable for further debugging of the issue.
Regards,
Bruno