File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ version: "3.9"
33services :
44 db :
55 image : postgres:18
6+ entrypoint : ["/usr/local/bin/custom-entrypoint.sh"]
67 environment :
78 POSTGRES_USER : ${POSTGRES_USER:-postgres}
89 POSTGRES_PASSWORD : ${POSTGRES_PASSWORD:-postgres}
@@ -13,6 +14,7 @@ services:
1314 - pgwal:/var/lib/postgresql/wal-archive
1415 - pgbackups:/backups
1516 - ./postgres/postgresql.conf:/etc/postgresql/postgresql.conf:ro # copy from postgresql.conf.example
17+ - ./postgres/entrypoint.sh:/usr/local/bin/custom-entrypoint.sh:ro
1618 command :
1719 [
1820 " postgres" ,
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # Ensure WAL archive directory exists and is owned by postgres so archive_command can write.
5+ mkdir -p /var/lib/postgresql/wal-archive
6+ chown -R postgres:postgres /var/lib/postgresql/wal-archive
7+
8+ exec /usr/local/bin/docker-entrypoint.sh " $@ "
Original file line number Diff line number Diff line change 1+ listen_addresses = '*'
2+
3+ # Memory and planner
14shared_buffers = 4GB
25effective_cache_size = 12GB
36work_mem = 32MB
47maintenance_work_mem = 1GB
58
9+ # WAL and archiving
610wal_level = replica
711wal_compression = on
812archive_mode = on
913archive_timeout = 60s
10- archive_command = 'test ! -f /var/lib/postgresql/wal-archive/%f && cp %p /var/lib/postgresql/wal-archive/%f' # keep && unescaped so the shell runs both commands
14+ archive_command = 'test ! -f /var/lib/postgresql/wal-archive/%f && cp %p /var/lib/postgresql/wal-archive/%f'
1115max_wal_size = 8GB
1216min_wal_size = 2GB
You can’t perform that action at this time.
0 commit comments