Преглед изворни кода

Set PGDATA explicitly in the Molecule Postgres container, like the role does

The scenarios worked around Postgres 18's data layout change by mounting the
tmpfs at /var/lib/postgresql. The postgres role solved the same problem
differently and better, when it bit us there: it sets PGDATA explicitly, and to
/data rather than anywhere beneath /var/lib/postgresql, because that path is a
VOLUME in the official image and nothing can be mounted under it.

Doing the same here means the scenarios exercise the layout the role actually
deploys, and that a future image changing its own default cannot move the data
directory out from under them.

Ref: https://github.com/docker-library/postgres/pull/1259

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEH3vxYSQ5SV4N5z61eyGT
pull/5575/head
Slavi Pantaleev пре 1 дан
родитељ
комит
db4eb94058
1 измењених фајлова са 10 додато и 5 уклоњено
  1. +10
    -5
      molecule-shared/tasks/postgres.yml

+ 10
- 5
molecule-shared/tasks/postgres.yml Прегледај датотеку

@@ -45,11 +45,16 @@
- --env=POSTGRES_DB={{ molecule_shared_postgres_database }}
- --env=POSTGRES_USER={{ molecule_shared_postgres_username }}
- --env=POSTGRES_PASSWORD={{ molecule_shared_postgres_password }}
# A tmpfs, because the database is thrown away with the container and not writing it
# to the overlay filesystem is faster. Mounted at /var/lib/postgresql rather than at
# .../data: since 18 the image puts PGDATA in a versioned subdirectory and refuses to
# start if it finds a mount at the old path.
- --tmpfs=/var/lib/postgresql
# PGDATA is set explicitly, and to /data rather than anywhere under
# /var/lib/postgresql, for the same reasons the postgres role does it: v18 changed the
# default to a versioned subdirectory, and /var/lib/postgresql is a VOLUME in the image,
# so nothing can be mounted beneath it. Setting it explicitly also means a future image
# changing its own default cannot move the data out from under this.
#
# A tmpfs, because the database is thrown away with the container and not writing it to
# the overlay filesystem is faster.
- --env=PGDATA=/data
- --tmpfs=/data
- "{{ molecule_shared_image_postgres }}"
register: molecule_shared_postgres_start
changed_when: molecule_shared_postgres_start.rc == 0


Loading…
Откажи
Сачувај