diff --git a/bitnami/postgresql/14/debian-12/Dockerfile b/bitnami/postgresql/14/debian-12/Dockerfile index eeea50ab92d0a..810a2ba8defc4 100644 --- a/bitnami/postgresql/14/debian-12/Dockerfile +++ b/bitnami/postgresql/14/debian-12/Dockerfile @@ -10,11 +10,10 @@ ARG WITH_ALL_LOCALES="no" LABEL com.vmware.cp.artifact.flavor="sha256:c50c90cfd9d12b445b011e6ad529f1ad3daea45c26d20b00732fae3cd71f6a83" \ org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2025-03-03T21:37:33Z" \ + org.opencontainers.image.created="2025-03-15T20:48:36Z" \ org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/postgresql/README.md" \ - org.opencontainers.image.licenses="Apache-2.0" \ - org.opencontainers.image.ref.name="14.17.0-debian-12-r3" \ + org.opencontainers.image.ref.name="14.17.0-debian-12-r4" \ org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/postgresql" \ org.opencontainers.image.title="postgresql" \ org.opencontainers.image.vendor="Broadcom, Inc." \ diff --git a/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh b/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh index d381fe6074c98..7180138d5dd98 100644 --- a/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh +++ b/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/libpostgresql.sh @@ -572,9 +572,13 @@ postgresql_clean_from_restart() { local -r -a files=( "$POSTGRESQL_DATA_DIR"/postmaster.pid "$POSTGRESQL_DATA_DIR"/standby.signal - "$POSTGRESQL_DATA_DIR"/recovery.signal ) + # Enable recovery only when POSTGRESQL_PERFORM_RESTORE feature flag is set + if ! is_boolean_yes "$POSTGRESQL_PERFORM_RESTORE" ; then + files+=("$POSTGRESQL_DATA_DIR"/recovery.signal) + fi + for file in "${files[@]}"; do if [[ -f "$file" ]]; then info "Cleaning stale $file file" diff --git a/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh b/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh index 3a6cf2804f99d..afa1d535573c6 100644 --- a/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh +++ b/bitnami/postgresql/14/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh @@ -95,6 +95,7 @@ postgresql_env_vars=( POSTGRESQL_DEFAULT_TOAST_COMPRESSION POSTGRESQL_PASSWORD_ENCRYPTION POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION + POSTGRESQL_PERFORM_RESTORE POSTGRESQL_AUTOCTL_CONF_DIR POSTGRESQL_AUTOCTL_MODE POSTGRESQL_AUTOCTL_MONITOR_HOST @@ -336,6 +337,9 @@ export POSTGRESQL_PASSWORD_ENCRYPTION="${POSTGRESQL_PASSWORD_ENCRYPTION:-}" export POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION="${POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION:-}" export POSTGRESQL_USE_CUSTOM_PGHBA_INITIALIZATION="no" +# Native recovery settings +export POSTGRESQL_PERFORM_RESTORE="${POSTGRESQL_PERFORM_RESTORE:-no}" + # pgAutoFailover settings export POSTGRESQL_AUTOCTL_VOLUME_DIR="${POSTGRESQL_VOLUME_DIR}/pgautoctl" export POSTGRESQL_AUTOCTL_CONF_DIR="${POSTGRESQL_AUTOCTL_CONF_DIR:-${POSTGRESQL_AUTOCTL_VOLUME_DIR}/.config}" diff --git a/bitnami/postgresql/README.md b/bitnami/postgresql/README.md index ba7446eb18bd6..209a50f990308 100644 --- a/bitnami/postgresql/README.md +++ b/bitnami/postgresql/README.md @@ -173,7 +173,7 @@ docker-compose up -d #### Customizable environment variables | Name | Description | Default Value | -| ------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------ | +|--------------------------------------------|--------------------------------------------------------------------------------------------------|--------------------------------------------| | `POSTGRESQL_VOLUME_DIR` | Persistence base directory | `/bitnami/postgresql` | | `POSTGRESQL_DATA_DIR` | PostgreSQL data directory | `${POSTGRESQL_VOLUME_DIR}/data` | | `POSTGRESQL_EXTRA_FLAGS` | Extra flags for PostgreSQL initialization | `nil` | @@ -245,16 +245,16 @@ docker-compose up -d | `POSTGRESQL_DEFAULT_TOAST_COMPRESSION` | Set the postgres default compression | `nil` | | `POSTGRESQL_PASSWORD_ENCRYPTION` | Set the passwords encryption method | `nil` | | `POSTGRESQL_DEFAULT_TRANSACTION_ISOLATION` | Set transaction isolation | `nil` | +| `POSTGRESQL_PERFORM_RESTORE` | Flag to skip deletion of `recovery.signal` file to enable native recovery. e.g by using `wal-g` | `no` | | `POSTGRESQL_AUTOCTL_CONF_DIR` | Path to the configuration dir for the pg_autoctl command | `${POSTGRESQL_AUTOCTL_VOLUME_DIR}/.config` | | `POSTGRESQL_AUTOCTL_MODE` | pgAutoFailover node type, valid values [monitor, postgres] | `postgres` | | `POSTGRESQL_AUTOCTL_MONITOR_HOST` | Hostname for the monitor component | `monitor` | | `POSTGRESQL_AUTOCTL_HOSTNAME` | Hostname by which postgres is reachable | `$(hostname --fqdn)` | -| `POSTGRESQL_PERFORM_RESTORE` | Flag to skip deletion of `recovery.signal` file to enable native recovery. e.g by using `wal-g` | `false` | #### Read-only environment variables | Name | Description | Value | -| -------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------- | +|----------------------------------------------|-----------------------------------------------------------------|-----------------------------------------------| | `POSTGRESQL_BASE_DIR` | PostgreSQL installation directory | `/opt/bitnami/postgresql` | | `POSTGRESQL_DEFAULT_CONF_DIR` | PostgreSQL configuration directory | `$POSTGRESQL_BASE_DIR/conf.default` | | `POSTGRESQL_CONF_DIR` | PostgreSQL configuration directory | `$POSTGRESQL_BASE_DIR/conf` | @@ -576,7 +576,7 @@ postgres=# select application_name as server, state, postgres-# sync_priority as priority, sync_state postgres-# from pg_stat_replication; | server | state | priority | sync_state | -| ----------- | --------- | -------- | ---------- | +|-------------|-----------|----------|------------| | walreceiver | streaming | 0 | sync | | walreceiver | streaming | 0 | async | ``` @@ -804,7 +804,7 @@ docker build --build-arg EXTRA_LOCALES="es_ES.UTF-8 UTF-8" ... The Bitnami PostgreSQL container allows two different sets of environment variables. Please see the list of environment variable aliases in the next table: | Environment Variable | Alias | -| :----------------------------------- | :--------------------------------- | +|:-------------------------------------|:-----------------------------------| | POSTGRESQL_USERNAME | POSTGRES_USER | | POSTGRESQL_DATABASE | POSTGRES_DB | | POSTGRESQL_PASSWORD | POSTGRES_PASSWORD | @@ -835,7 +835,7 @@ alter database POSTGRES_DATABASE owner to POSTGRES_USER; It is possible to change the user that PostgreSQL will use to execute the init scripts. To do so, use the following environment variables: | Environment variable | Description | -| ------------------------------- | ----------------------------------------------------------------- | +|---------------------------------|-------------------------------------------------------------------| | POSTGRESQL_INITSCRIPTS_USERNAME | User that will be used to execute the init scripts | | POSTGRESQL_INITSCRIPTS_PASSWORD | Password for the user specified in POSTGRESQL_INITSCRIPT_USERNAME |