Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
patch postgresql conf before postgres starts
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Oct 12, 2024
1 parent 6245501 commit 497e5b4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,16 @@ echo "Cron job created for pgBackRest full backups with schedule: $PG_BACKREST_C

service cron start

if [ -f $PGDATA/postgresql.conf ]; then
sed -i "s/#archive_mode = off/archive_mode = on/" $PGDATA/postgresql.conf
sed -i "s/#archive_command = ''/archive_command = 'pgbackrest --stanza=my-pg-pgbackrest-stanza archive-push %p'/" $PGDATA/postgresql.conf
sed -i "s/#archive_timeout = 0/archive_timeout = 60/" $PGDATA/postgresql.conf

echo "postgresql.conf patched for WAL archiving before the server starts."
else
echo "postgresql.conf not found, can not be patched for WAL archiving before the server starts."
fi

# see https://github.com/docker-library/postgres/blob/c9906f922daaacdfc425b3b918e7644a8722290d/16/bookworm/Dockerfile#L192
exec docker-entrypoint.sh postgres

Expand Down

0 comments on commit 497e5b4

Please sign in to comment.