diff --git a/Dockerfile b/Dockerfile index 1dbd805..90ae983 100644 --- a/Dockerfile +++ b/Dockerfile @@ -152,6 +152,7 @@ RUN ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh RUN touch /etc/repmgr.conf && chmod 666 /etc/repmgr.conf +COPY bashrc /var/lib/postgresql/.bashrc COPY docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/bashrc b/bashrc new file mode 100644 index 0000000..144512f --- /dev/null +++ b/bashrc @@ -0,0 +1 @@ +export PATH="${PATH}:/usr/lib/postgresql/15/bin" \ No newline at end of file diff --git a/docker-entrypoint-initdb.d/00-main.sh b/docker-entrypoint-initdb.d/00-main.sh index 8d77587..c88edcf 100755 --- a/docker-entrypoint-initdb.d/00-main.sh +++ b/docker-entrypoint-initdb.d/00-main.sh @@ -14,6 +14,27 @@ if [[ -z $UPSTREAM ]]; then echo "max_wal_senders = 10" >> /var/lib/postgresql/data/postgresql.conf echo "max_replication_slots = 10" >> /var/lib/postgresql/data/postgresql.conf # ensure required entries in hba +local all all trust +# IPv4 local connections: +host all all 127.0.0.1/32 trust +# IPv6 local connections: +host all all ::1/128 trust +# Allow replication connections from localhost, by a user with the +# replication privilege. +local replication all trust +host replication all 127.0.0.1/32 trust +host replication all ::1/128 trust + +local replication repmgr trust +host replication repmgr 127.0.0.1/32 trust +host replication repmgr 100.64.0.0/10 trust +local repmgr repmgr trust +host repmgr repmgr 127.0.0.1/32 trust +host repmgr repmgr 100.64.0.0/10 trust +host all all all scram-sha-256 + + + echo "local replication repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf echo "host replication repmgr ${NETWORK:-100.64.0.0/10} trust" >> /var/lib/postgresql/data/pg_hba.conf echo "local repmgr repmgr trust" >> /var/lib/postgresql/data/pg_hba.conf