[Bug]: Unexpected error from database adapter: relation #602

Closed
opened 2026-02-04 20:31:10 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @Julius-Bendt on GitHub (Nov 12, 2024).

Where is the problem occurring?

I encountered the problem while interacting with the server (Backend)

What browsers are you seeing the problem on?

Firefox

Current behaviour

Data is missing

Desired behaviour

Data should not be missing

Steps to reproduce

I honestly don't know. Update the container, I think?

Other information

I've read #218, and the problem seems to be related. I was under the understanding, that this wouldn't happen again though.

I've tried accessing the site from both a browser where I have a cached session, and one where I logged in.

I get the following logs from the backend:
2024-11-12 08:17:56 [E] Sending 500 ("Server Error") response:
planka | Unexpected error from database adapter: relation "public.session" does not exist

planka | 2024-11-12 12:50:01 [E] Sending 500 ("Server Error") response:
planka | Unexpected error from database adapter: relation "public.user_account" does not exist

And from the database:

startup:
planka-postgres | Success. You can now start the database server using:
planka-postgres |
planka-postgres | pg_ctl -D /var/lib/postgresql/data -l logfile start
planka-postgres |
planka-postgres | waiting for server to start....2024-11-12 06:12:23.596 UTC [42] LOG: starting PostgreSQL 14.13 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit
planka-postgres | 2024-11-12 06:12:23.597 UTC [42] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
planka-postgres | 2024-11-12 06:12:23.602 UTC [43] LOG: database system was shut down at 2024-11-12 06:12:23 UTC
planka-postgres | 2024-11-12 06:12:23.607 UTC [42] LOG: database system is ready to accept connections
planka-postgres | done
planka-postgres | server started
planka-postgres | CREATE DATABASE // Bit worried about this one
planka-postgres |
planka-postgres |
planka-postgres | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*
planka-postgres |
planka-postgres | waiting for server to shut down....2024-11-12 06:12:23.786 UTC [42] LOG: received fast shutdown request
planka-postgres | 2024-11-12 06:12:23.787 UTC [42] LOG: aborting any active transactions
planka-postgres | 2024-11-12 06:12:23.789 UTC [42] LOG: background worker "logical replication launcher" (PID 49) exited with exit code 1
planka-postgres | 2024-11-12 06:12:23.790 UTC [44] LOG: shutting down
planka-postgres | 2024-11-12 06:12:23.804 UTC [42] LOG: database system is shut down
planka-postgres | done
planka-postgres | server stopped
planka-postgres |
planka-postgres | PostgreSQL init process complete; ready for start up.

When I tried logging in:

2024-11-12 08:17:56.488 UTC [5557] ERROR: relation "public.session" does not exist at character 138
planka-postgres | 2024-11-12 08:17:56.488 UTC [5557] STATEMENT: select "id", "created_at", "updated_at", "access_token", "http_only_token", "remote_address", "user_agent", "deleted_at", "user_id" from "public"."session" where "access_token" = $1 and "deleted_at" is null limit $2

planka-postgres | 2024-11-12 12:50:01.142 UTC [17466] ERROR: relation "public.user_account" does not exist at character 219
planka-postgres | 2024-11-12 12:50:01.142 UTC [17466] STATEMENT: select "id", "created_at", "updated_at", "email", "password", "is_admin", "is_sso", "name", "username", "avatar", "phone", "organization", "language", "subscribe_to_own_cards", "deleted_at", "password_changed_at" from "public"."user_account" where "username" = $1 and "deleted_at" is null limit $2

Docker compose:


services:
  planka:
    container_name: planka
    image: ghcr.io/plankanban/planka:latest
    restart: on-failure
    user: "1000:1000"
    ports:
      - "${PLANKA_PORT}:1337"
    volumes:
      - ${HOME}/storage/docker/planka_data:/planka_data
    environment:
      - BASE_URL=${PLANKA_BASE_URL}
      - DATABASE_URL=postgresql://postgres@plankaPostgres/planka
      - SECRET_KEY=${PLANKA_SECRET_KEY}
      - DEFAULT_ADMIN_EMAIL=${PLANKA_DEFAULT_ADMIN_EMAIL}
      - DEFAULT_ADMIN_PASSWORD=${PLANKA_DEFAULT_ADMIN_PASSWORD}
      - DEFAULT_ADMIN_NAME=${PLANKA_DEFAULT_ADMIN_NAME}
      - DEFAULT_ADMIN_USERNAME=${PLANKA_DEFAULT_ADMIN_USERNAME}
    depends_on:
      plankaPostgres:
        condition: service_healthy
    networks:
      - planka_net

  plankaPostgres:
    container_name: planka-postgres
    image: postgres:14-alpine
    restart: on-failure
    volumes:
      - ${HOME}/storage/docker/planka_data:/planka_data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - planka_net

networks:
  planka_net:
    name: planka_net

Other information:
I have Watchtower configured, to keep my containers up to date

Originally created by @Julius-Bendt on GitHub (Nov 12, 2024). ### Where is the problem occurring? I encountered the problem while interacting with the server (Backend) ### What browsers are you seeing the problem on? Firefox ### Current behaviour Data is missing ### Desired behaviour Data should not be missing ### Steps to reproduce I honestly don't know. Update the container, I think? ### Other information I've read #218, and the problem seems to be related. I was under the understanding, that this wouldn't happen again though. I've tried accessing the site from both a browser where I have a cached session, and one where I logged in. I get the following logs from the backend: 2024-11-12 08:17:56 [E] Sending 500 ("Server Error") response: planka | Unexpected error from database adapter: relation "public.session" does not exist planka | 2024-11-12 12:50:01 [E] Sending 500 ("Server Error") response: planka | Unexpected error from database adapter: relation "public.user_account" does not exist And from the database: startup: planka-postgres | Success. You can now start the database server using: planka-postgres | planka-postgres | pg_ctl -D /var/lib/postgresql/data -l logfile start planka-postgres | planka-postgres | waiting for server to start....2024-11-12 06:12:23.596 UTC [42] LOG: starting PostgreSQL 14.13 on x86_64-pc-linux-musl, compiled by gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, 64-bit planka-postgres | 2024-11-12 06:12:23.597 UTC [42] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432" planka-postgres | 2024-11-12 06:12:23.602 UTC [43] LOG: database system was shut down at 2024-11-12 06:12:23 UTC planka-postgres | 2024-11-12 06:12:23.607 UTC [42] LOG: database system is ready to accept connections planka-postgres | done planka-postgres | server started planka-postgres | CREATE DATABASE **// Bit worried about this one** planka-postgres | planka-postgres | planka-postgres | /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/* planka-postgres | planka-postgres | waiting for server to shut down....2024-11-12 06:12:23.786 UTC [42] LOG: received fast shutdown request planka-postgres | 2024-11-12 06:12:23.787 UTC [42] LOG: aborting any active transactions planka-postgres | 2024-11-12 06:12:23.789 UTC [42] LOG: background worker "logical replication launcher" (PID 49) exited with exit code 1 planka-postgres | 2024-11-12 06:12:23.790 UTC [44] LOG: shutting down planka-postgres | 2024-11-12 06:12:23.804 UTC [42] LOG: database system is shut down planka-postgres | done planka-postgres | server stopped planka-postgres | planka-postgres | PostgreSQL init process complete; ready for start up. When I tried logging in: 2024-11-12 08:17:56.488 UTC [5557] ERROR: relation "public.session" does not exist at character 138 planka-postgres | 2024-11-12 08:17:56.488 UTC [5557] STATEMENT: select "id", "created_at", "updated_at", "access_token", "http_only_token", "remote_address", "user_agent", "deleted_at", "user_id" from "public"."session" where "access_token" = $1 and "deleted_at" is null limit $2 planka-postgres | 2024-11-12 12:50:01.142 UTC [17466] ERROR: relation "public.user_account" does not exist at character 219 planka-postgres | 2024-11-12 12:50:01.142 UTC [17466] STATEMENT: select "id", "created_at", "updated_at", "email", "password", "is_admin", "is_sso", "name", "username", "avatar", "phone", "organization", "language", "subscribe_to_own_cards", "deleted_at", "password_changed_at" from "public"."user_account" where "username" = $1 and "deleted_at" is null limit $2 Docker compose: ```yaml services: planka: container_name: planka image: ghcr.io/plankanban/planka:latest restart: on-failure user: "1000:1000" ports: - "${PLANKA_PORT}:1337" volumes: - ${HOME}/storage/docker/planka_data:/planka_data environment: - BASE_URL=${PLANKA_BASE_URL} - DATABASE_URL=postgresql://postgres@plankaPostgres/planka - SECRET_KEY=${PLANKA_SECRET_KEY} - DEFAULT_ADMIN_EMAIL=${PLANKA_DEFAULT_ADMIN_EMAIL} - DEFAULT_ADMIN_PASSWORD=${PLANKA_DEFAULT_ADMIN_PASSWORD} - DEFAULT_ADMIN_NAME=${PLANKA_DEFAULT_ADMIN_NAME} - DEFAULT_ADMIN_USERNAME=${PLANKA_DEFAULT_ADMIN_USERNAME} depends_on: plankaPostgres: condition: service_healthy networks: - planka_net plankaPostgres: container_name: planka-postgres image: postgres:14-alpine restart: on-failure volumes: - ${HOME}/storage/docker/planka_data:/planka_data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d planka"] interval: 10s timeout: 5s retries: 5 networks: - planka_net networks: planka_net: name: planka_net ``` Other information: I have Watchtower configured, to keep my containers up to date
Author
Owner

@meltyshev commented on GitHub (Nov 12, 2024):

Hi!

The volumes in your docker-compose.yml file look a bit unusual. In the plankaPostgres service, the volume should be mounted to /var/lib/postgresql/data instead of /planka_data. Additionally, the planka service should have three separate volumes mounted to /app/public/user-avatars, /app/public/project-background-images, and /app/private/attachments.

The problem is most likely that instead of saving all the data to the host via mounted folders, the data was saved inside the container itself (due to the volumes was mounted to the incorrect path). As a result, all the data was deleted when the container was updated and recreated.

The updated docker-compose.yml in your case should look something like this:

services:
  planka:
    container_name: planka
    image: ghcr.io/plankanban/planka:latest
    restart: on-failure
    user: "1000:1000"
    ports:
      - "${PLANKA_PORT}:1337"
    volumes:
      - ${HOME}/storage/docker/planka_data/user-avatars:/app/public/user-avatars
      - ${HOME}/storage/docker/planka_data/project-background-images:/app/public/project-background-images
      - ${HOME}/storage/docker/planka_data/attachments:/app/private/attachments
    environment:
      - BASE_URL=${PLANKA_BASE_URL}
      - DATABASE_URL=postgresql://postgres@plankaPostgres/planka
      - SECRET_KEY=${PLANKA_SECRET_KEY}
      - DEFAULT_ADMIN_EMAIL=${PLANKA_DEFAULT_ADMIN_EMAIL}
      - DEFAULT_ADMIN_PASSWORD=${PLANKA_DEFAULT_ADMIN_PASSWORD}
      - DEFAULT_ADMIN_NAME=${PLANKA_DEFAULT_ADMIN_NAME}
      - DEFAULT_ADMIN_USERNAME=${PLANKA_DEFAULT_ADMIN_USERNAME}
    depends_on:
      plankaPostgres:
        condition: service_healthy
    networks:
      - planka_net

  plankaPostgres:
    container_name: planka-postgres
    image: postgres:14-alpine
    restart: on-failure
    volumes:
      - ${HOME}/storage/docker/planka_data/db-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_DB=planka
      - POSTGRES_HOST_AUTH_METHOD=trust
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d planka"]
      interval: 10s
      timeout: 5s
      retries: 5
    networks:
      - planka_net

networks:
  planka_net:
    name: planka_net
@meltyshev commented on GitHub (Nov 12, 2024): Hi! The `volumes` in your `docker-compose.yml` file look a bit unusual. In the `plankaPostgres` service, the volume should be mounted to `/var/lib/postgresql/data` instead of `/planka_data`. Additionally, the `planka` service should have three separate volumes mounted to `/app/public/user-avatars`, `/app/public/project-background-images`, and `/app/private/attachments`. The problem is most likely that instead of saving all the data to the host via mounted folders, the data was saved inside the container itself (due to the volumes was mounted to the incorrect path). As a result, all the data was deleted when the container was updated and recreated. The updated `docker-compose.yml` in your case should look something like this: ``` services: planka: container_name: planka image: ghcr.io/plankanban/planka:latest restart: on-failure user: "1000:1000" ports: - "${PLANKA_PORT}:1337" volumes: - ${HOME}/storage/docker/planka_data/user-avatars:/app/public/user-avatars - ${HOME}/storage/docker/planka_data/project-background-images:/app/public/project-background-images - ${HOME}/storage/docker/planka_data/attachments:/app/private/attachments environment: - BASE_URL=${PLANKA_BASE_URL} - DATABASE_URL=postgresql://postgres@plankaPostgres/planka - SECRET_KEY=${PLANKA_SECRET_KEY} - DEFAULT_ADMIN_EMAIL=${PLANKA_DEFAULT_ADMIN_EMAIL} - DEFAULT_ADMIN_PASSWORD=${PLANKA_DEFAULT_ADMIN_PASSWORD} - DEFAULT_ADMIN_NAME=${PLANKA_DEFAULT_ADMIN_NAME} - DEFAULT_ADMIN_USERNAME=${PLANKA_DEFAULT_ADMIN_USERNAME} depends_on: plankaPostgres: condition: service_healthy networks: - planka_net plankaPostgres: container_name: planka-postgres image: postgres:14-alpine restart: on-failure volumes: - ${HOME}/storage/docker/planka_data/db-data:/var/lib/postgresql/data environment: - POSTGRES_DB=planka - POSTGRES_HOST_AUTH_METHOD=trust healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres -d planka"] interval: 10s timeout: 5s retries: 5 networks: - planka_net networks: planka_net: name: planka_net ```
Author
Owner

@Julius-Bendt commented on GitHub (Nov 12, 2024):

That would explain a lot, yes.
Thanks for the quick response and help!

@Julius-Bendt commented on GitHub (Nov 12, 2024): That would explain a lot, yes. Thanks for the quick response and help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/planka#602