From 70fd1eb4be4aaa87e897a20955cc2db7415f3a81 Mon Sep 17 00:00:00 2001 From: "Marcelo M. Maciel" <4993482+marcelo-maciel@users.noreply.github.com> Date: Fri, 25 Sep 2026 11:38:17 -0300 Subject: [PATCH] fix(deploy): mount the Postgres 18 volume where the image expects it postgres:18 keeps PGDATA under /var/lib/postgresql/18/docker and refuses a mount at /var/lib/postgresql/data even on an empty volume, so docker compose up restart-looped Postgres and never started the migrator or the API on a fresh machine. --- deploy/docker/docker-compose.yml | 4 +++- deploy/docker/postgres-init/01-create-databases.sql | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml index 17eef14de0..0d5e575432 100644 --- a/deploy/docker/docker-compose.yml +++ b/deploy/docker/docker-compose.yml @@ -19,7 +19,9 @@ services: POSTGRES_USER: fsh POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} volumes: - - pg_data:/var/lib/postgresql/data + # The 18+ images keep PGDATA in a versioned subdirectory (/var/lib/postgresql/18/docker) and + # refuse to start with a mount at the old /var/lib/postgresql/data, even on an empty volume. + - pg_data:/var/lib/postgresql - ./postgres-init:/docker-entrypoint-initdb.d:ro healthcheck: test: ["CMD-SHELL", "pg_isready -U fsh -d fsh"] diff --git a/deploy/docker/postgres-init/01-create-databases.sql b/deploy/docker/postgres-init/01-create-databases.sql index 429622701e..5aadc12a50 100644 --- a/deploy/docker/postgres-init/01-create-databases.sql +++ b/deploy/docker/postgres-init/01-create-databases.sql @@ -1,5 +1,5 @@ -- Postgres init for fullstackhero --- This file runs only on first boot (when /var/lib/postgresql/data is empty). +-- This file runs only on first boot (when the data directory under /var/lib/postgresql is empty). -- The `fsh` database itself is created by POSTGRES_DB= in the compose env; -- we just add the extensions the framework relies on.