Skip to content

[FEATURE] - Migrate PostgreSQL 16 to 18 with a data migration path #203

Description

@koydas

Problem to solve

#194 bumps databases/postgre from postgres:16 to postgres:18 and fails CI:

  • smoke: since 18 the official image keeps data in /var/lib/postgresql/18/docker and refuses to start when anything is mounted at /var/lib/postgresql/data (our compose mount);
  • db-upgrade-tests (postgres): a PostgreSQL 16 data directory cannot be opened by 18 without pg_upgrade or dump/restore, so existing postgres-data volumes would break.

Impact

Medium

Proposed solution

  • Move to the 18+ layout: postgres:18, a single mount at /var/lib/postgresql, a new compose volume (postgres18-data) so the old 16 volume is left untouched.
  • Add databases/postgre/upgrade-major.sh: pg_dumpall from the old volume with the old image, then restore into the new volume with the new image. The source volume is read only, so the operation can be rolled back.
  • The db-upgrade harness runs this script when the PostgreSQL major changes, so CI proves the documented migration keeps data. The 16 → 17 self-test (same volume, must fail) is unchanged.
  • Document the procedure (databases/postgre/README.md, RUNBOOK).

Constraints or notes

Assumption: PostgreSQL only runs through Docker Compose (local and CI); the repository has no Kubernetes/ArgoCD manifests for it. A deployed instance elsewhere would need its own procedure.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions