From 2505e2aaeea70c1c4054a4e13e4cb0f633737491 Mon Sep 17 00:00:00 2001 From: Matt Gallagher Date: Mon, 24 Nov 2025 16:45:09 +0000 Subject: [PATCH 1/2] Mount postgres volumes at /var/lib/postgresql This is to resolve errors like the following, now that postgres:latest resolves to the v18 image by default. ```quote in 18+, these Docker images are configured to store database data in a format which is compatible with "pg_ctlcluster" (specifically, using major-version-specific directory names). This better reflects how PostgreSQL itself works, and how upgrades are to be performed. See also https://github.com/docker-library/postgres/pull/1259 Counter to that, there appears to be PostgreSQL data in: /var/lib/postgresql/data (unused mount/volume) This is usually the result of upgrading the Docker image without upgrading the underlying database using "pg_upgrade" (which requires both versions). The suggested container configuration for 18+ is to place a single mount at /var/lib/postgresql which will then place PostgreSQL data in a subdirectory, allowing usage of "pg_upgrade --link" without mount point boundary issues. See https://github.com/docker-library/postgres/issues/37 for a (long) discussion around this process, and suggestions for how to do so. ``` --- demos/nodejs-postgres-bucket-storage/docker-compose.yaml | 2 +- services/postgres.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index 5218fdc..f0435ba 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -35,7 +35,7 @@ services: - POSTGRES_PASSWORD=${PG_STORAGE_DATABASE_PASSWORD} - PGPORT=${PG_STORAGE_DATABASE_PORT} volumes: - - pg_storage_data:/var/lib/postgresql/data + - pg_storage_data:/var/lib/postgresql ports: - "${PG_STORAGE_DATABASE_PORT}:${PG_STORAGE_DATABASE_PORT}" healthcheck: diff --git a/services/postgres.yaml b/services/postgres.yaml index e272c0e..8ace49f 100644 --- a/services/postgres.yaml +++ b/services/postgres.yaml @@ -8,7 +8,7 @@ services: - POSTGRES_PASSWORD=${PG_DATABASE_PASSWORD} - PGPORT=${PG_DATABASE_PORT} volumes: - - pg_data:/var/lib/postgresql/data + - pg_data:/var/lib/postgresql ports: - "${PG_DATABASE_PORT}:${PG_DATABASE_PORT}" command: ["postgres", "-c", "wal_level=logical"] From e8b84abd285040c8eb294fd74ace49e008535d96 Mon Sep 17 00:00:00 2001 From: stevensJourney Date: Tue, 25 Nov 2025 10:00:16 +0200 Subject: [PATCH 2/2] Limit version to Postgres 18. Add Changelog entry. --- CHANGELOG.md | 24 +++++++++++++++++++ .../docker-compose.yaml | 8 +++++-- services/postgres.yaml | 2 +- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 974bf8d..bf9d2b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,29 @@ # PowerSync Self Hosted Example +## 2025-11-25 + +### Postgres 18 Upgrade + +Updated Postgres demos for Postgres 18 compatibility. Postgres 18 contains breaking changes for Docker volume mount points. First time demo runners should be able to start the demo using the standard `docker compose up` commands. + +Users with existing configurations should either: + +#### Start from a clean slate + +With the relevant demo directory as the current working directory, run: + +```bash +# Clear previous data (this deletes Docker volumes) +docker compose down --volumes + +# Run the demo +docker compose up +``` + +#### Migrate existing data + +See https://github.com/docker-library/postgres/issues/37 for options. + ## 2025-05-13 - Updated YAML config files to use published schema diff --git a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml index f0435ba..57c3491 100644 --- a/demos/nodejs-postgres-bucket-storage/docker-compose.yaml +++ b/demos/nodejs-postgres-bucket-storage/docker-compose.yaml @@ -27,7 +27,7 @@ services: - ../nodejs/init-scripts:/docker-entrypoint-initdb.d pg-storage: - image: postgres:latest + image: postgres:18 restart: always environment: - POSTGRES_USER=${PG_STORAGE_DATABASE_USER} @@ -39,7 +39,11 @@ services: ports: - "${PG_STORAGE_DATABASE_PORT}:${PG_STORAGE_DATABASE_PORT}" healthcheck: - test: ["CMD-SHELL", "pg_isready -U ${PG_STORAGE_DATABASE_USER} -d ${PG_STORAGE_DATABASE_NAME}"] + test: + [ + "CMD-SHELL", + "pg_isready -U ${PG_STORAGE_DATABASE_USER} -d ${PG_STORAGE_DATABASE_NAME}", + ] interval: 5s timeout: 5s retries: 5 diff --git a/services/postgres.yaml b/services/postgres.yaml index 8ace49f..060d6d7 100644 --- a/services/postgres.yaml +++ b/services/postgres.yaml @@ -1,6 +1,6 @@ services: pg-db: - image: postgres:latest + image: postgres:18 restart: always environment: - POSTGRES_USER=${PG_DATABASE_USER}