[bitnami/postgresql-repmgr] Release 15.1.0-debian-11-r25 (#20770)

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>

Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
Bitnami Bot 2023-01-18 00:30:18 +01:00 committed by GitHub
parent 146d700513
commit 1cfd7668b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 72 additions and 9 deletions

View File

@ -5,7 +5,7 @@ ARG TARGETARCH
LABEL org.opencontainers.image.authors="https://bitnami.com/contact" \
org.opencontainers.image.description="Application packaged by Bitnami" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.ref.name="15.1.0-debian-11-r24" \
org.opencontainers.image.ref.name="15.1.0-debian-11-r25" \
org.opencontainers.image.source="https://github.com/bitnami/containers/tree/main/bitnami/postgresql-repmgr" \
org.opencontainers.image.title="postgresql-repmgr" \
org.opencontainers.image.vendor="VMware, Inc." \
@ -22,8 +22,8 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN install_packages ca-certificates curl libbsd0 libedit2 libffi7 libgcc-s1 libgmp10 libgnutls30 libhogweed6 libicu67 libidn2-0 libldap-2.4-2 liblz4-1 liblzma5 libmd0 libnettle8 libp11-kit0 libpcre3 libreadline8 libsasl2-2 libsqlite3-0 libssl1.1 libstdc++6 libtasn1-6 libtinfo6 libunistring2 libuuid1 libxml2 libxslt1.1 locales procps zlib1g
RUN mkdir -p /tmp/bitnami/pkg/cache/ && cd /tmp/bitnami/pkg/cache/ && \
COMPONENTS=( \
"postgresql-repmgr-15.1.0-4-linux-${OS_ARCH}-debian-11" \
"gosu-1.16.0-0-linux-${OS_ARCH}-debian-11" \
"postgresql-repmgr-15.1.0-5-linux-${OS_ARCH}-debian-11" \
"gosu-1.16.0-1-linux-${OS_ARCH}-debian-11" \
) && \
for COMPONENT in "${COMPONENTS[@]}"; do \
if [ ! -f "${COMPONENT}.tar.gz" ]; then \

View File

@ -1,16 +1,16 @@
{
"gosu": {
"arch": "amd64",
"digest": "c42abbc5d57ba4c33c89e4daf46c33b0173565fbf533ef7a60281cf3283f611f",
"digest": "9ab9654690d90d3c49ff66fb1eb286487e318adc899d036bc45922f6b176865b",
"distro": "debian-11",
"type": "NAMI",
"version": "1.16.0-0"
"version": "1.16.0-1"
},
"postgresql-repmgr": {
"arch": "amd64",
"digest": "3813fdad7f7058106cd18d2532d81c8e0caa6abf1acddbbf1d39950c93b62abd",
"digest": "16d7dcf152a1d83bc40c3ef46637d67cce437214ebebf5a263b624de9e10b9dc",
"distro": "debian-11",
"type": "NAMI",
"version": "15.1.0-4"
"version": "15.1.0-5"
}
}

View File

@ -117,6 +117,10 @@ repmgr_validate() {
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
if ! is_yes_no_value "$REPMGR_PGHBA_TRUST_ALL"; then
print_validation_error "The allowed values for REPMGR_PGHBA_TRUST_ALL are: yes or no."
fi
@ -260,9 +264,17 @@ repmgr_set_role() {
primary_host=${primary_node[0]}
primary_port=${primary_node[1]:-$REPMGR_PRIMARY_PORT}
if [[ -z "$primary_host" ]]; then
if [[ "$REPMGR_NODE_TYPE" = "data" ]]; then
if [[ -z "$primary_host" ]]; then
info "There are no nodes with primary role. Assuming the primary role..."
role="primary"
else
info "Node configured as standby"
role="standby"
fi
else
info "Node configured as witness"
role="witness"
fi
cat <<EOF
@ -694,6 +706,49 @@ repmgr_unregister_standby() {
debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}" || true
}
########################
# Unregister witness
# Globals:
# REPMGR_*
# Arguments:
# None
# Returns:
# None
#########################
repmgr_unregister_witness() {
info "Unregistering witness node..."
local -r flags=("-f" "$REPMGR_CONF_FILE" "witness" "unregister" "-h" "$REPMGR_CURRENT_PRIMARY_HOST" "--verbose")
# The command below can fail when the node doesn't exist yet
if [[ "$REPMGR_USE_PASSFILE" = "true" ]]; then
PGPASSFILE="$REPMGR_PASSFILE_PATH" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}" || true
else
PGPASSWORD="$REPMGR_PASSWORD" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}" || true
fi
}
########################
# Register witness
# Globals:
# REPMGR_*
# Arguments:
# None
# Returns:
# None
#########################
repmgr_register_witness() {
info "Registering witness node..."
local -r flags=("-f" "$REPMGR_CONF_FILE" "witness" "register" "-h" "$REPMGR_CURRENT_PRIMARY_HOST" "--force" "--verbose")
repmgr_wait_primary_node
if [[ "$REPMGR_USE_PASSFILE" = "true" ]]; then
PGPASSFILE="$REPMGR_PASSFILE_PATH" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}"
else
PGPASSWORD="$REPMGR_PASSWORD" debug_execute "${REPMGR_BIN_DIR}/repmgr" "${flags[@]}"
fi
}
########################
# Standby follow.
# Globals:
@ -801,7 +856,7 @@ repmgr_initialize() {
else
debug "Skipping repmgr configuration..."
fi
else
elif [[ "$REPMGR_ROLE" = "standby" ]]; then
local -r psql_major_version="$(postgresql_get_major_version)"
POSTGRESQL_MASTER_PORT_NUMBER="$REPMGR_CURRENT_PRIMARY_PORT"
@ -819,5 +874,11 @@ repmgr_initialize() {
repmgr_wait_primary_node
repmgr_standby_follow
fi
elif [[ "$REPMGR_ROLE" = "witness" ]]; then
postgresql_start_bg
repmgr_create_repmgr_user
repmgr_create_repmgr_db
repmgr_unregister_witness
repmgr_register_witness
fi
}

View File

@ -99,6 +99,7 @@ postgresql_env_vars=(
REPMGR_NODE_NETWORK_NAME
REPMGR_NODE_PRIORITY
REPMGR_NODE_LOCATION
REPMGR_NODE_TYPE
REPMGR_PORT_NUMBER
REPMGR_LOG_LEVEL
REPMGR_USE_PGREWIND
@ -395,6 +396,7 @@ export REPMGR_NODE_NAME="${REPMGR_NODE_NAME:-$(hostname)}"
export REPMGR_NODE_NETWORK_NAME="${REPMGR_NODE_NETWORK_NAME:-}"
export REPMGR_NODE_PRIORITY="${REPMGR_NODE_PRIORITY:-100}"
export REPMGR_NODE_LOCATION="${REPMGR_NODE_LOCATION:-default}"
export REPMGR_NODE_TYPE="${REPMGR_NODE_TYPE:-data}"
export REPMGR_PORT_NUMBER="${REPMGR_PORT_NUMBER:-5432}"
export REPMGR_LOG_LEVEL="${REPMGR_LOG_LEVEL:-NOTICE}"
export REPMGR_USE_PGREWIND="${REPMGR_USE_PGREWIND:-no}"