Skip to content

Upgrading to Postgres 18: possible loss of data #550

@paskn

Description

@paskn

Hi!

This is not exactly a bug report but more of a notice about a breaking change in Postgres 18. The side-effect that I got:

My user data and all datasets are lost. Luckily, I got this on a testing instance :)

I should add: you lose data not because of updating containers but due to fixing the compose.yml to accommodate Postgres 18. 4cat will just not work with Postgres 18, and this is good.

To avoid it:

  1. Before upgrading containers, check if your .env has POSTGRES_TAG=latest
  2. If it does, change it to 16 or 17.
  3. Only then start pulling the newer images.

I see that you also noticed this in 93bb522

What I figured out:

Starting version 18 Postgress no longer works with - 4cat_db:/var/lib/postgresql/data as all 4cat documentation suggest. Because of this:

docker-library/postgres#1259

To make it work:

  1. Add PGDATA=/var/lib/postgresql/data into environment subsection of the db container
  2. Change volume mouting:
    volumes:
      - 4cat_db:/var/lib/postgresql

Here is an example of the db section that will enable you to use 4cat with Postgres 18:

    container_name: 4cat_db
    image: postgres:latest
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_DB=${POSTGRES_DB}
      - POSTGRES_HOST_AUTH_METHOD=${POSTGRES_HOST_AUTH_METHOD}
      - PGDATA=/var/lib/postgresql/data
    volumes:
      - 4cat_db:/var/lib/postgresql
    healthcheck:
      test:
        - CMD-SHELL
        - pg_isready -U $${POSTGRES_USER}
      interval: 5s
      timeout: 5s
      retries: 5

Unfortunately, this will give you a fresh and empty 4cat instance without your data. I plan to look into if its possible to recover. And I do not know yet of a way of how move my data between the versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    (mostly) back-endPrimarily involves the back-end (e.g. post-processors, scheduler or crawlers).deploymentRelated to installation/deployment of 4CAT rather than 4CAT properdocker issueIssue that only occurs when using 4CAT via Docker

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions