Skip to content

Commit 9255535

Browse files
committed
feat(postgres): opt-in compose services for a standby and a real installation's log permissions
1 parent d54554a commit 9255535

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

compose.pg.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,63 @@ services:
139139
volumes:
140140
- ./internal/capture/postgres/testdata/pg_matrix_init.sql:/docker-entrypoint-initdb.d/10-yc-matrix.sql:ro
141141
- /tmp/yc-pglogs/pg18:/tmp/yc-pglogs/pg18
142+
143+
# Opt-in services for manual-tests/16-replica.sh and 17-log-permissions.sh,
144+
# started with --profile replica / --profile perms. Not part of the Go matrix.
145+
146+
# Physical standby of pg17, base-backed-up under a slot on first start. The
147+
# scenario adds the replication role and pg_hba line to pg17.
148+
pg17-replica:
149+
<<: *pg-common
150+
image: postgres:17
151+
profiles: ["replica"]
152+
ports: ["15427:5432"]
153+
depends_on:
154+
pg17:
155+
condition: service_healthy
156+
command:
157+
- bash
158+
- -c
159+
- |
160+
if [ ! -s "$$PGDATA/PG_VERSION" ]; then
161+
gosu postgres pg_basebackup \
162+
-d 'host=pg17 port=5432 user=yc_replicator password=yc-replicator-pw application_name=yc-replica' \
163+
-D "$$PGDATA" -R -X stream -C -S yc_replica_slot
164+
fi
165+
exec docker-entrypoint.sh postgres
166+
167+
# pg17 with a real installation's log permissions: 0700 data directory, 0600
168+
# log files, no bind mount.
169+
pg17-perms:
170+
<<: *pg-common
171+
image: postgres:17
172+
profiles: ["perms"]
173+
ports: ["15437:5432"]
174+
command:
175+
- postgres
176+
- -c
177+
- shared_preload_libraries=pg_stat_statements
178+
- -c
179+
- logging_collector=on
180+
volumes:
181+
- ./internal/capture/postgres/testdata/pg_matrix_init.sql:/docker-entrypoint-initdb.d/10-yc-matrix.sql:ro
182+
183+
# The same, initialised with --allow-group-access (0750 / 0640).
184+
pg17-group:
185+
<<: *pg-common
186+
image: postgres:17
187+
profiles: ["perms"]
188+
ports: ["15447:5432"]
189+
environment:
190+
POSTGRES_PASSWORD: yc-superuser-pw
191+
POSTGRES_INITDB_ARGS: --allow-group-access
192+
command:
193+
- postgres
194+
- -c
195+
- shared_preload_libraries=pg_stat_statements
196+
- -c
197+
- logging_collector=on
198+
- -c
199+
- log_file_mode=0640
200+
volumes:
201+
- ./internal/capture/postgres/testdata/pg_matrix_init.sql:/docker-entrypoint-initdb.d/10-yc-matrix.sql:ro

0 commit comments

Comments
 (0)