[bitnami/postgresql-repmgr] Release 12.14.0-debian-11-r21 (#30948)
Signed-off-by: Bitnami Containers <bitnami-bot@vmware.com>
This commit is contained in:
parent
ede92cb17f
commit
6bd5f3db72
|
|
@ -3,10 +3,10 @@ FROM docker.io/bitnami/minideb:bullseye
|
|||
ARG TARGETARCH
|
||||
|
||||
LABEL org.opencontainers.image.base.name="docker.io/bitnami/minideb:bullseye" \
|
||||
org.opencontainers.image.created="2023-04-16T22:38:07Z" \
|
||||
org.opencontainers.image.created="2023-04-19T20:48:40Z" \
|
||||
org.opencontainers.image.description="Application packaged by VMware, Inc" \
|
||||
org.opencontainers.image.licenses="Apache-2.0" \
|
||||
org.opencontainers.image.ref.name="12.14.0-debian-11-r20" \
|
||||
org.opencontainers.image.ref.name="12.14.0-debian-11-r21" \
|
||||
org.opencontainers.image.title="postgresql-repmgr" \
|
||||
org.opencontainers.image.vendor="VMware, Inc." \
|
||||
org.opencontainers.image.version="12.14.0"
|
||||
|
|
@ -22,8 +22,7 @@ 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 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-12.14.0-6-linux-${OS_ARCH}-debian-11" \
|
||||
"gosu-1.16.0-5-linux-${OS_ARCH}-debian-11" \
|
||||
"postgresql-repmgr-12.14.0-7-linux-${OS_ARCH}-debian-11" \
|
||||
) && \
|
||||
for COMPONENT in "${COMPONENTS[@]}"; do \
|
||||
if [ ! -f "${COMPONENT}.tar.gz" ]; then \
|
||||
|
|
@ -52,7 +51,7 @@ ENV APP_VERSION="12.14.0" \
|
|||
LANG="en_US.UTF-8" \
|
||||
LANGUAGE="en_US:en" \
|
||||
NSS_WRAPPER_LIB="/opt/bitnami/common/lib/libnss_wrapper.so" \
|
||||
PATH="/opt/bitnami/postgresql/bin:/opt/bitnami/repmgr/bin:/opt/bitnami/common/bin:$PATH"
|
||||
PATH="/opt/bitnami/postgresql/bin:/opt/bitnami/repmgr/bin:$PATH"
|
||||
|
||||
EXPOSE 5432
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,8 @@
|
|||
{
|
||||
"gosu": {
|
||||
"arch": "amd64",
|
||||
"distro": "debian-11",
|
||||
"type": "NAMI",
|
||||
"version": "1.16.0-5"
|
||||
},
|
||||
"postgresql-repmgr": {
|
||||
"arch": "amd64",
|
||||
"distro": "debian-11",
|
||||
"type": "NAMI",
|
||||
"version": "12.14.0-6"
|
||||
"version": "12.14.0-7"
|
||||
}
|
||||
}
|
||||
|
|
@ -553,3 +553,98 @@ get_root_disk_device_id() {
|
|||
get_root_disk_size() {
|
||||
fdisk -l "$(get_root_disk_device_id)" | grep 'Disk.*bytes' | sed -E 's/.*, ([0-9]+) bytes,.*/\1/' || true
|
||||
}
|
||||
|
||||
########################
|
||||
# Run command as a specific user and group (optional)
|
||||
# Arguments:
|
||||
# $1 - USER(:GROUP) to switch to
|
||||
# $2..$n - command to execute
|
||||
# Returns:
|
||||
# Exit code of the specified command
|
||||
#########################
|
||||
run_as_user() {
|
||||
run_chroot "$@"
|
||||
}
|
||||
|
||||
########################
|
||||
# Execute command as a specific user and group (optional),
|
||||
# replacing the current process image
|
||||
# Arguments:
|
||||
# $1 - USER(:GROUP) to switch to
|
||||
# $2..$n - command to execute
|
||||
# Returns:
|
||||
# Exit code of the specified command
|
||||
#########################
|
||||
exec_as_user() {
|
||||
run_chroot --replace-process "$@"
|
||||
}
|
||||
|
||||
########################
|
||||
# Run a command using chroot
|
||||
# Arguments:
|
||||
# $1 - USER(:GROUP) to switch to
|
||||
# $2..$n - command to execute
|
||||
# Flags:
|
||||
# -r | --replace-process - Replace the current process image (optional)
|
||||
# Returns:
|
||||
# Exit code of the specified command
|
||||
#########################
|
||||
run_chroot() {
|
||||
local userspec
|
||||
local user
|
||||
local homedir
|
||||
local replace=false
|
||||
local -r cwd="$(pwd)"
|
||||
|
||||
# Parse and validate flags
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case "$1" in
|
||||
-r | --replace-process)
|
||||
replace=true
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*)
|
||||
stderr_print "unrecognized flag $1"
|
||||
return 1
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Parse and validate arguments
|
||||
if [[ "$#" -lt 2 ]]; then
|
||||
echo "expected at least 2 arguments"
|
||||
return 1
|
||||
else
|
||||
userspec=$1
|
||||
shift
|
||||
|
||||
# userspec can optionally include the group, so we parse the user
|
||||
user=$(echo "$userspec" | cut -d':' -f1)
|
||||
fi
|
||||
|
||||
if ! am_i_root; then
|
||||
error "Could not switch to '${userspec}': Operation not permitted"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get the HOME directory for the user to switch, as chroot does
|
||||
# not properly update this env and some scripts rely on it
|
||||
homedir=$(eval echo "~${user}")
|
||||
if [[ ! -d $homedir ]]; then
|
||||
homedir="${HOME:-/}"
|
||||
fi
|
||||
|
||||
# Obtaining value for "$@" indirectly in order to properly support shell parameter expansion
|
||||
if [[ "$replace" = true ]]; then
|
||||
exec chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@"
|
||||
else
|
||||
chroot --userspec="$userspec" / bash -c "cd ${cwd}; export HOME=${homedir}; exec \"\$@\"" -- "$@"
|
||||
fi
|
||||
}
|
||||
|
|
@ -737,7 +737,7 @@ postgresql_stop() {
|
|||
if [[ -f "$POSTGRESQL_PID_FILE" ]]; then
|
||||
info "Stopping PostgreSQL..."
|
||||
if am_i_root; then
|
||||
gosu "$POSTGRESQL_DAEMON_USER" "${cmd[@]}"
|
||||
run_as_user "$POSTGRESQL_DAEMON_USER" "${cmd[@]}"
|
||||
else
|
||||
"${cmd[@]}"
|
||||
fi
|
||||
|
|
@ -762,7 +762,7 @@ postgresql_start_bg() {
|
|||
fi
|
||||
local pg_ctl_cmd=()
|
||||
if am_i_root; then
|
||||
pg_ctl_cmd+=("gosu" "$POSTGRESQL_DAEMON_USER")
|
||||
pg_ctl_cmd+=("run_as_user" "$POSTGRESQL_DAEMON_USER")
|
||||
fi
|
||||
pg_ctl_cmd+=("$POSTGRESQL_BIN_DIR"/pg_ctl)
|
||||
if [[ "${BITNAMI_DEBUG:-false}" = true ]] || [[ $pg_logs = true ]]; then
|
||||
|
|
@ -838,7 +838,7 @@ postgresql_master_init_db() {
|
|||
fi
|
||||
local initdb_cmd=()
|
||||
if am_i_root; then
|
||||
initdb_cmd+=("gosu" "$POSTGRESQL_DAEMON_USER")
|
||||
initdb_cmd+=("run_as_user" "$POSTGRESQL_DAEMON_USER")
|
||||
fi
|
||||
initdb_cmd+=("$POSTGRESQL_BIN_DIR/initdb")
|
||||
if [[ -n "${initdb_args[*]:-}" ]]; then
|
||||
|
|
@ -869,7 +869,7 @@ postgresql_slave_init_db() {
|
|||
local -r check_args=("-U" "$POSTGRESQL_REPLICATION_USER" "-h" "$POSTGRESQL_MASTER_HOST" "-p" "$POSTGRESQL_MASTER_PORT_NUMBER" "-d" "postgres")
|
||||
local check_cmd=()
|
||||
if am_i_root; then
|
||||
check_cmd=("gosu" "$POSTGRESQL_DAEMON_USER")
|
||||
check_cmd=("run_as_user" "$POSTGRESQL_DAEMON_USER")
|
||||
fi
|
||||
check_cmd+=("$POSTGRESQL_BIN_DIR"/pg_isready)
|
||||
local ready_counter=$POSTGRESQL_INIT_MAX_TIMEOUT
|
||||
|
|
@ -887,7 +887,7 @@ postgresql_slave_init_db() {
|
|||
local -r backup_args=("-D" "$POSTGRESQL_DATA_DIR" "-U" "$POSTGRESQL_REPLICATION_USER" "-h" "$POSTGRESQL_MASTER_HOST" "-p" "$POSTGRESQL_MASTER_PORT_NUMBER" "-X" "stream" "-w" "-v" "-P")
|
||||
local backup_cmd=()
|
||||
if am_i_root; then
|
||||
backup_cmd+=("gosu" "$POSTGRESQL_DAEMON_USER")
|
||||
backup_cmd+=("run_as_user" "$POSTGRESQL_DAEMON_USER")
|
||||
fi
|
||||
backup_cmd+=("$POSTGRESQL_BIN_DIR"/pg_basebackup)
|
||||
local replication_counter=$POSTGRESQL_INIT_MAX_TIMEOUT
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ postgresql_start_bg true
|
|||
info "** Starting repmgrd **"
|
||||
# TODO: properly test running the container as root
|
||||
if am_i_root; then
|
||||
exec gosu "$POSTGRESQL_DAEMON_USER" "$repmgr_cmd" "${repmgr_flags[@]}"
|
||||
exec_as_user "$POSTGRESQL_DAEMON_USER" "$repmgr_cmd" "${repmgr_flags[@]}"
|
||||
else
|
||||
exec "$repmgr_cmd" "${repmgr_flags[@]}"
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue