Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Issue with PostgreSQL Version Compatibility in Latest Kaizoku Setup #165

Open
ricardopeters-dev opened this issue Sep 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ricardopeters-dev
Copy link

Describe the bug

Hi there,

I’ve encountered an issue with the latest Kaizoku setup using the recommended docker-compose.yml. The db service is using postgres:alpine, which pulls the latest version (currently PostgreSQL 17). However, this causes compatibility issues if the data directory was initialized with PostgreSQL 16, leading to errors like:

FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 16, which is not compatible with this version 17.0.

To resolve the issue, I reverted to postgres:16-alpine in the docker-compose.yml file. It might be helpful to update the documentation to specify a PostgreSQL version to avoid similar issues for other users.

Thanks for your work on Kaizoku!

Best regards,

Reproduction steps

No response

Expected behavior

No response

Additional context

No response

@ricardopeters-dev ricardopeters-dev added the bug Something isn't working label Sep 28, 2024
@GabriellCosta
Copy link

My temporary solution for this was just using PostgreSQL 16 instead of the latest image

kaizoku-db:
    container_name: kaizoku-db
    image: postgres:16.4
    restart: unless-stopped

As this project is in the process of rewrite (#160) I think that for me is enough

@pinheirolucas
Copy link

pinheirolucas commented Jan 18, 2025

This is not a kaizoku thing. It's a Postgres thing.

Any setup depending on Postgres might lead to the same issue if the major version is NOT pinned.

That's because Postgres doesn't maintain compatibility for the data directory between major versions, only minor and patch will be compatible.

So, considering you don't have any specific dependency on new features from PG 17, pinning the container image to 16.x will do the job.

Now, if you really want to migrate your data dir, it's just a matter of pg_dumping and pg_restoreing the Kavita DB from version 16 to version 17.

It goes like this:

  1. Spin up a PG 16 container pointing to your data dir
  2. pg_dump the Kavita DB
  3. Take the PG 16 container down
  4. Spin up a PG 17 container pointing to a new data dir
  5. pg_restore the Kavita DB dump you just created
  6. Remove the old data dir

The TL;DR is that: waiting for the Kavita rewrite won't fix this issue because it's not a Kavita issue 😅

On my setup Kavita is working with no issues with PG 17.x

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants