From 2f814a6b8e9df905def3efe17d1faf2d0b597d7b Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Thu, 12 Mar 2020 18:44:21 +0000 Subject: [PATCH] 10.12.0-debian-10-r33 release --- .../postgresql-repmgr/10/debian-10/Dockerfile | 4 +- .../10/debian-10/prebuildfs/libbitnami.sh | 3 +- .../10/debian-10/prebuildfs/libfs.sh | 3 +- .../10/debian-10/prebuildfs/liblog.sh | 8 ++- .../10/debian-10/prebuildfs/libos.sh | 72 +++++++++++++++++++ .../10/debian-10/prebuildfs/libservice.sh | 60 +++++++++++++++- .../10/debian-10/prebuildfs/libvalidations.sh | 3 +- .../10/debian-10/prebuildfs/libversion.sh | 3 +- bitnami/postgresql-repmgr/README.md | 2 +- 9 files changed, 149 insertions(+), 9 deletions(-) diff --git a/bitnami/postgresql-repmgr/10/debian-10/Dockerfile b/bitnami/postgresql-repmgr/10/debian-10/Dockerfile index 75389a35cf65..9b605471569b 100644 --- a/bitnami/postgresql-repmgr/10/debian-10/Dockerfile +++ b/bitnami/postgresql-repmgr/10/debian-10/Dockerfile @@ -10,7 +10,7 @@ ENV BITNAMI_PKG_CHMOD="-R g+rwX" \ COPY prebuildfs / # Install required system packages and dependencies RUN install_packages ca-certificates curl libbsd0 libc6 libedit2 libffi6 libgcc1 libgmp10 libgnutls30 libhogweed4 libicu63 libidn2-0 libldap-2.4-2 liblzma5 libnettle6 libp11-kit0 libsasl2-2 libsqlite3-0 libssl1.1 libstdc++6 libtasn1-6 libtinfo6 libunistring2 libuuid1 libxml2 libxslt1.1 locales procps sudo unzip zlib1g -RUN . ./libcomponent.sh && component_unpack "postgresql-repmgr" "10.12.0-0" --checksum 526cb67108f775fa1c2158589c97febcbd229446e7b9ddf3cc1d6c113239bcee +RUN . ./libcomponent.sh && component_unpack "postgresql-repmgr" "10.12.0-1" --checksum a4d5d4155559dc178f31fe8189f717c3e4b01dee8a81c687decdb4df5b50c863 RUN . ./libcomponent.sh && component_unpack "gosu" "1.11.0-3" --checksum c18bb8bcc95aa2494793ed5a506c4d03acc82c8c60ad061d5702e0b4048f0cb1 RUN apt-get update && apt-get upgrade -y && \ rm -r /var/lib/apt/lists /var/cache/apt/archives @@ -23,7 +23,7 @@ RUN echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen COPY rootfs / RUN /postunpack.sh ENV BITNAMI_APP_NAME="postgresql-repmgr" \ - BITNAMI_IMAGE_VERSION="10.12.0-debian-10-r29" \ + BITNAMI_IMAGE_VERSION="10.12.0-debian-10-r33" \ LANG="en_US.UTF-8" \ LANGUAGE="en_US:en" \ NAMI_PREFIX="/.nami" \ diff --git a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libbitnami.sh b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libbitnami.sh index 529c3fd4a3e2..ec789d8227eb 100644 --- a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libbitnami.sh +++ b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libbitnami.sh @@ -1,9 +1,10 @@ #!/bin/bash +# shellcheck disable=SC1090 # # Bitnami custom library # Load Generic Libraries -. /liblog.sh +. "${BITNAMI_SCRIPTS_DIR:-}"/liblog.sh # Constants BOLD='\033[1m' diff --git a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libfs.sh b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libfs.sh index 10a24735c096..1a1fc5522dec 100644 --- a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libfs.sh +++ b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libfs.sh @@ -1,9 +1,10 @@ #!/bin/bash +# shellcheck disable=SC1090 # # Library for file system actions # Load Generic Libraries -. /liblog.sh +. "${BITNAMI_SCRIPTS_DIR:-}"/liblog.sh # Functions diff --git a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/liblog.sh b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/liblog.sh index 04118273394a..1285b05ba344 100644 --- a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/liblog.sh +++ b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/liblog.sh @@ -20,7 +20,13 @@ CYAN='\033[38;5;6m' # None ######################### stderr_print() { - printf "%b\\n" "${*}" >&2 + # 'is_boolean_yes' is defined in libvalidations.sh, but depends on this file so we cannot source it + local -r bool="${BITNAMI_QUIET:-false}" + # comparison is performed without regard to the case of alphabetic characters + shopt -s nocasematch + if ! [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then + printf "%b\\n" "${*}" >&2 + fi } ######################## diff --git a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libos.sh b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libos.sh index 1a5ba3bb2a64..10022fb21d8d 100644 --- a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libos.sh +++ b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libos.sh @@ -1,7 +1,11 @@ #!/bin/bash +# shellcheck disable=SC1090 # # Library for operating system actions +# Load Generic Libraries +. "${BITNAMI_SCRIPTS_DIR:-}"/liblog.sh + # Functions ######################## @@ -91,6 +95,74 @@ get_total_memory() { echo $(($(grep MemTotal /proc/meminfo | awk '{print $2}') / 1024)) } +######################## +# Get machine size depending on specified memory +# Globals: +# None +# Arguments: +# $1 - memory size (optional) +# Returns: +# Detected instance size +######################### +get_machine_size() { + local memory="${1:-}" + if [[ -z "$memory" ]]; then + debug "Memory was not specified, detecting available memory automatically" + memory="$(get_total_memory)" + fi + sanitized_memory=$(convert_to_mb "$memory") + if [[ "$sanitized_memory" -gt 26000 ]]; then + echo 2xlarge + elif [[ "$sanitized_memory" -gt 13000 ]]; then + echo xlarge + elif [[ "$sanitized_memory" -gt 6000 ]]; then + echo large + elif [[ "$sanitized_memory" -gt 3000 ]]; then + echo medium + elif [[ "$sanitized_memory" -gt 1500 ]]; then + echo small + else + echo micro + fi +} + +######################## +# Get machine size depending on specified memory +# Globals: +# None +# Arguments: +# $1 - memory size (optional) +# Returns: +# Detected instance size +######################### +get_supported_machine_sizes() { + echo micro small medium large xlarge 2xlarge +} + +######################## +# Convert memory size from string to amount of megabytes (i.e. 2G -> 2048) +# Globals: +# None +# Arguments: +# $1 - memory size +# Returns: +# Result of the conversion +######################### +convert_to_mb() { + local amount="${1:-}" + if [[ $amount =~ ^([0-9]+)(M|G) ]]; then + size="${BASH_REMATCH[1]}" + unit="${BASH_REMATCH[2]}" + if [[ "$unit" = "G" ]]; then + amount="$((size * 1024))" + else + amount="$size" + fi + fi + echo "$amount" +} + + ######################### # Redirects output to /dev/null if debug mode is disabled # Globals: diff --git a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libservice.sh b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libservice.sh index 0a83cd3d927f..35c0163a9ef1 100644 --- a/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libservice.sh +++ b/bitnami/postgresql-repmgr/10/debian-10/prebuildfs/libservice.sh @@ -17,7 +17,7 @@ get_pid_from_file() { if [[ -f "$pid_file" ]]; then if [[ -n "$(< "$pid_file")" ]] && [[ "$(< "$pid_file")" -gt 0 ]]; then echo "$(< "$pid_file")" - fi + fi fi } @@ -55,3 +55,61 @@ stop_service_using_pid() { counter=$((counter - 1)) done } + +######################## +# Generate a monit configuration file for a given service +# Arguments: +# $1 - Service name +# $2 - Pid file +# $3 - Start command +# $4 - Stop command +# Returns: +# None +######################### +generate_monit_conf() { + local -r service_name="${1:?service name is missing}" + local -r pid_file="${2:?pid file is missing}" + local -r start_command="${3:?start command is missing}" + local -r stop_command="${4:?stop command is missing}" + local -r monit_conf_dir="/etc/monit/conf.d" + + mkdir -p "$monit_conf_dir" + cat >"${monit_conf_dir}/${service_name}.conf" <"${logrotate_conf_dir}/${service_name}" <