From f4b89d058a8a28ad1426cac1802ad0465bd8ff5d Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Fri, 17 Oct 2025 12:16:38 +0200 Subject: [PATCH] [bitnami/postgresql-repmgr] Release 18.0.0-debian-12-r12 (#87770) Signed-off-by: Bitnami Bot --- .../postgresql-repmgr/18/debian-12/Dockerfile | 4 +-- .../rootfs/opt/bitnami/scripts/librepmgr.sh | 18 +--------- .../opt/bitnami/scripts/postgresql-env.sh | 2 ++ .../scripts/postgresql-repmgr/postunpack.sh | 2 -- .../bitnami/scripts/postgresql-repmgr/run.sh | 1 - .../scripts/postgresql-repmgr/setup.sh | 33 +++++++++++++++---- bitnami/postgresql-repmgr/README.md | 1 + 7 files changed, 32 insertions(+), 29 deletions(-) diff --git a/bitnami/postgresql-repmgr/18/debian-12/Dockerfile b/bitnami/postgresql-repmgr/18/debian-12/Dockerfile index e6b0e7caecb1..e35f6badf400 100644 --- a/bitnami/postgresql-repmgr/18/debian-12/Dockerfile +++ b/bitnami/postgresql-repmgr/18/debian-12/Dockerfile @@ -7,7 +7,7 @@ ARG DOWNLOADS_URL="downloads.bitnami.com/files/stacksmith" ARG TARGETARCH LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bookworm" \ - org.opencontainers.image.created="2025-10-13T16:55:11Z" \ + org.opencontainers.image.created="2025-10-17T10:05:17Z" \ org.opencontainers.image.description="Application packaged by Broadcom, Inc." \ org.opencontainers.image.documentation="https://github.com/bitnami/containers/tree/main/bitnami/postgresql-repmgr/README.md" \ org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/postgresql-repmgr" \ @@ -55,7 +55,7 @@ COPY rootfs / RUN /opt/bitnami/scripts/postgresql-repmgr/postunpack.sh ENV APP_VERSION="18.0.0" \ BITNAMI_APP_NAME="postgresql-repmgr" \ - IMAGE_REVISION="11" \ + IMAGE_REVISION="12" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US:en" \ NSS_WRAPPER_LIB="/opt/bitnami/common/lib/libnss_wrapper.so" \ diff --git a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh index 094db15489f6..dae971d51ce0 100644 --- a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh +++ b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/librepmgr.sh @@ -146,14 +146,6 @@ repmgr_validate() { print_validation_error "The repmgr credentials are mandatory. Set the environment variables REPMGR_USERNAME and REPMGR_PASSWORD with the repmgr credentials." fi - if [[ "$REPMGR_USE_PASSFILE" = "true" ]]; then - local -r psql_major_version="$(postgresql_get_major_version)" - if [[ "$psql_major_version" -le "9" ]]; then - warn "Variable REPMGR_USE_PASSFILE is not compatible with PostgreSQL ${psql_major_version}. It will be disabled." - export REPMGR_USE_PASSFILE="false" - fi - fi - if [[ -z "$REPMGR_NODE_TYPE" ]] || ! [[ "$REPMGR_NODE_TYPE" =~ ^(data|witness)$ ]]; then print_validation_error "Set the environment variable REPMGR_NODE_TYPE to 'data' or 'witness'." fi @@ -878,6 +870,7 @@ repmgr_initialize() { repmgr_wait_primary_node || exit 1 repmgr_rewind fi + # Run postgresql initialization skipping replication config postgresql_initialize true if ! repmgr_is_file_external "postgresql.conf"; then @@ -915,23 +908,14 @@ repmgr_initialize() { debug "Skipping repmgr configuration..." fi elif [[ "$REPMGR_ROLE" = "standby" ]]; then - local -r psql_major_version="$(postgresql_get_major_version)" - POSTGRESQL_MASTER_PORT_NUMBER="$REPMGR_CURRENT_PRIMARY_PORT" export POSTGRESQL_MASTER_PORT_NUMBER POSTGRESQL_MASTER_HOST="$REPMGR_CURRENT_PRIMARY_HOST" export POSTGRESQL_MASTER_HOST - postgresql_configure_recovery postgresql_start_bg repmgr_unregister_standby repmgr_register_standby - - if [[ "$psql_major_version" -lt "12" ]]; then - info "Check if primary running..." - repmgr_wait_primary_node - repmgr_standby_follow - fi elif [[ "$REPMGR_ROLE" = "witness" ]]; then postgresql_start_bg repmgr_create_repmgr_user diff --git a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh index 7825c08fcdb8..9b662d6c0cdf 100644 --- a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh +++ b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-env.sh @@ -106,6 +106,7 @@ postgresql_env_vars=( POSTGRESQL_AUTOCTL_MONITOR_HOST POSTGRESQL_AUTOCTL_HOSTNAME REPMGR_DATA_DIR + REPMGR_SKIP_SETUP REPMGR_NODE_ID REPMGR_NODE_ID_START_SEED REPMGR_NODE_NAME @@ -431,6 +432,7 @@ export REPMGR_DATA_DIR="${REPMGR_DATA_DIR:-${REPMGR_VOLUME_DIR}/repmgr/data}" export REPMGR_PID_FILE="${REPMGR_TMP_DIR}/repmgr.pid" # Settings (Replication Manager) +export REPMGR_SKIP_SETUP="${REPMGR_SKIP_SETUP:-no}" export REPMGR_NODE_ID="${REPMGR_NODE_ID:-}" export REPMGR_NODE_ID_START_SEED="${REPMGR_NODE_ID_START_SEED:-1000}" export REPMGR_NODE_NAME="${REPMGR_NODE_NAME:-$(hostname)}" diff --git a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh index 803fa1f0d8ae..4aafd65c4da4 100755 --- a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh +++ b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/postunpack.sh @@ -18,7 +18,6 @@ for dir in "$POSTGRESQL_INITSCRIPTS_DIR" "$POSTGRESQL_TMP_DIR" "$POSTGRESQL_LOG_ chmod -R g+rwX "$dir" done - # Copying events handlers mv /events "$REPMGR_EVENTS_DIR" chmod +x "$REPMGR_EVENTS_DIR"/router.sh "$REPMGR_EVENTS_DIR"/execs/*sh "$REPMGR_EVENTS_DIR"/execs/includes/*sh @@ -29,4 +28,3 @@ ln -sf /dev/stdout "$POSTGRESQL_LOG_FILE" # Copy all initially generated configuration files to the default directory # (this is to avoid breaking when entrypoint is being overridden) cp -r "${POSTGRESQL_CONF_DIR}/"* "$POSTGRESQL_DEFAULT_CONF_DIR" - diff --git a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh index cd59350147b5..efad93fd8896 100755 --- a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh +++ b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/run.sh @@ -23,7 +23,6 @@ readonly repmgr_cmd=$(command -v repmgrd) postgresql_start_bg true info "** Starting repmgrd **" -# TODO: properly test running the container as root if am_i_root; then exec_as_user "$POSTGRESQL_DAEMON_USER" "$repmgr_cmd" "${repmgr_flags[@]}" else diff --git a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh index 15fa398c31ef..82d0713ca77a 100755 --- a/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh +++ b/bitnami/postgresql-repmgr/18/debian-12/rootfs/opt/bitnami/scripts/postgresql-repmgr/setup.sh @@ -29,10 +29,29 @@ eval "$(repmgr_set_role)" trap "postgresql_stop" EXIT # Ensure 'daemon' user exists when running as 'root' am_i_root && ensure_user_exists "$POSTGRESQL_DAEMON_USER" --group "$POSTGRESQL_DAEMON_GROUP" -# Prepare PostgreSQL default configuration -repmgr_postgresql_configuration -# Prepare repmgr configuration -repmgr_generate_repmgr_config -# Initialize PostgreSQL & repmgr -export POSTGRESQL_USE_CUSTOM_PGHBA_INITIALIZATION="yes" -repmgr_initialize + +if is_boolean_yes "$REPMGR_SKIP_SETUP"; then + info "Skipping preparing configuration files..." + if [[ "$REPMGR_ROLE" = "standby" ]]; then + repmgr_wait_primary_node || exit 1 + repmgr_rewind + POSTGRESQL_MASTER_PORT_NUMBER="$REPMGR_CURRENT_PRIMARY_PORT" + export POSTGRESQL_MASTER_PORT_NUMBER + POSTGRESQL_MASTER_HOST="$REPMGR_CURRENT_PRIMARY_HOST" + export POSTGRESQL_MASTER_HOST + postgresql_configure_recovery + postgresql_start_bg + repmgr_unregister_standby + repmgr_register_standby + fi + # This fixes an issue if a PID was left over during the setup + rm -f "$REPMGR_PID_FILE" +else + # Prepare PostgreSQL default configuration + repmgr_postgresql_configuration + # Prepare repmgr configuration + repmgr_generate_repmgr_config + # Initialize PostgreSQL & repmgr + export POSTGRESQL_USE_CUSTOM_PGHBA_INITIALIZATION="yes" + repmgr_initialize +fi diff --git a/bitnami/postgresql-repmgr/README.md b/bitnami/postgresql-repmgr/README.md index ecde59c12e6a..c57c6bc57dc0 100644 --- a/bitnami/postgresql-repmgr/README.md +++ b/bitnami/postgresql-repmgr/README.md @@ -635,6 +635,7 @@ Refer to [issues/27124](https://github.com/bitnami/containers/issues/27124) for | `POSTGRESQL_AUTOCTL_MONITOR_HOST` | Hostname for the monitor component | `monitor` | | `POSTGRESQL_AUTOCTL_HOSTNAME` | Hostname by which postgres is reachable | `$(hostname --fqdn)` | | `REPMGR_DATA_DIR` | Replication Manager data directory | `${REPMGR_VOLUME_DIR}/repmgr/data` | +| `REPMGR_SKIP_SETUP` | Skip Replication manager (and PostgreSQL) setup. | `no` | | `REPMGR_NODE_ID` | Replication Manager node identifier | `nil` | | `REPMGR_NODE_ID_START_SEED` | Replication Manager node identifier start seed | `1000` | | `REPMGR_NODE_NAME` | Replication Manager node name | `$(hostname)` |