4.0.3-debian-9-r18 release

This commit is contained in:
Bitnami Bot 2019-09-16 16:00:24 +00:00
parent ee203e91cf
commit e61af62401
4 changed files with 29 additions and 30 deletions

View File

@ -16,7 +16,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="4.0.3-debian-9-r17" \
BITNAMI_IMAGE_VERSION="4.0.3-debian-9-r18" \
LANG="en_US.UTF-8" \
LANGUAGE="en_US:en" \
NAMI_PREFIX="/.nami" \

View File

@ -178,58 +178,54 @@ EOF
#########################
postgresql_validate() {
postgresql_info "Validating settings in POSTGRESQL_* env vars.."
local error_code=0
# Auxiliary functions
print_validation_error() {
postgresql_error "$1"
error_code=1
}
empty_password_enabled_warn() {
postgresql_warn "You set the environment variable ALLOW_EMPTY_PASSWORD=${ALLOW_EMPTY_PASSWORD}. For safety reasons, do not use this flag in a production environment."
}
empty_password_error() {
postgresql_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
exit 1
print_validation_error "The $1 environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development."
}
if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then
empty_password_enabled_warn
else
if [[ -z "$POSTGRESQL_PASSWORD" ]]; then
empty_password_error "POSTGRESQL_PASSWORD"
exit 1
fi
if (( ${#POSTGRESQL_PASSWORD} > 100 )); then
postgresql_error "The password cannot be longer than 100 characters. Set the environment variable POSTGRESQL_PASSWORD with a shorter value"
exit 1
print_validation_error "The password cannot be longer than 100 characters. Set the environment variable POSTGRESQL_PASSWORD with a shorter value"
fi
if [[ -n "$POSTGRESQL_USERNAME" ]] && [[ -z "$POSTGRESQL_PASSWORD" ]]; then
empty_password_error "POSTGRESQL_PASSWORD"
exit 1
fi
if [[ -n "$POSTGRESQL_USERNAME" ]] && [[ "$POSTGRESQL_USERNAME" != "postgres" ]] && [[ -n "$POSTGRESQL_PASSWORD" ]] && [[ -z "$POSTGRESQL_DATABASE" ]]; then
postgresql_error "In order to use a custom PostgreSQL user you need to set the environment variable POSTGRESQL_DATABASE as well"
exit 1
print_validation_error "In order to use a custom PostgreSQL user you need to set the environment variable POSTGRESQL_DATABASE as well"
fi
fi
if [[ -n "$POSTGRESQL_REPLICATION_MODE" ]]; then
if [[ "$POSTGRESQL_REPLICATION_MODE" = "master" ]]; then
if (( POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS < 0 )); then
postgresql_error "The number of synchronous replicas cannot be less than 0. Set the environment variable POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS"
exit 1
print_validation_error "The number of synchronous replicas cannot be less than 0. Set the environment variable POSTGRESQL_NUM_SYNCHRONOUS_REPLICAS"
fi
elif [[ "$POSTGRESQL_REPLICATION_MODE" = "slave" ]]; then
if [[ -z "$POSTGRESQL_MASTER_HOST" ]]; then
postgresql_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_MASTER_HOST. Use it to indicate where the Master node is running"
exit 1
print_validation_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_MASTER_HOST. Use it to indicate where the Master node is running"
fi
if [[ -z "$POSTGRESQL_REPLICATION_USER" ]]; then
postgresql_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_REPLICATION_USER. Make sure that the master also has this parameter set"
exit 1
print_validation_error "Slave replication mode chosen without setting the environment variable POSTGRESQL_REPLICATION_USER. Make sure that the master also has this parameter set"
fi
else
postgresql_error "Invalid replication mode. Available options are 'master/slave'"
exit 1
print_validation_error "Invalid replication mode. Available options are 'master/slave'"
fi
# Common replication checks
if [[ -n "$POSTGRESQL_REPLICATION_USER" ]] && [[ -z "$POSTGRESQL_REPLICATION_PASSWORD" ]]; then
empty_password_error "POSTGRESQL_REPLICATION_PASSWORD"
exit 1
fi
else
if is_boolean_yes "$ALLOW_EMPTY_PASSWORD"; then
@ -237,14 +233,14 @@ postgresql_validate() {
else
if [[ -z "$POSTGRESQL_PASSWORD" ]]; then
empty_password_error "POSTGRESQL_PASSWORD"
exit 1
fi
if [[ -n "$POSTGRESQL_USERNAME" ]] && [[ -z "$POSTGRESQL_PASSWORD" ]]; then
empty_password_error "POSTGRESQL_PASSWORD"
exit 1
fi
fi
fi
[[ "$error_code" -eq 0 ]] || exit "$error_code"
}
########################

View File

@ -129,34 +129,37 @@ repmgr_get_node_id() {
#########################
repmgr_validate() {
repmgr_info "Validating settings in REPMGR_* env vars..."
local error_code=0
# Auxiliary functions
print_error_exit() {
print_validation_error() {
repmgr_error "$1"
exit 1
error_code=1
}
if [[ -z "$REPMGR_PARTNER_NODES" ]]; then
print_error_exit "The list of partner nodes cannot be empty. Set the environment variable REPMGR_PARTNER_NODES with a comma separated list of partner nodes."
print_validation_error "The list of partner nodes cannot be empty. Set the environment variable REPMGR_PARTNER_NODES with a comma separated list of partner nodes."
fi
if [[ -z "$REPMGR_PRIMARY_HOST" ]]; then
print_error_exit "The initial primary host is required. Set the environment variable REPMGR_PRIMARY_HOST with the initial primary host."
print_validation_error "The initial primary host is required. Set the environment variable REPMGR_PRIMARY_HOST with the initial primary host."
fi
if [[ -z "$REPMGR_NODE_NAME" ]]; then
print_error_exit "The node name is required. Set the environment variable REPMGR_NODE_NAME with the node name."
print_validation_error "The node name is required. Set the environment variable REPMGR_NODE_NAME with the node name."
elif [[ ! "$REPMGR_NODE_NAME" =~ ^.*+-[0-9]+$ ]]; then
print_error_exit "The node name does not follow the required format. Valid format: ^.*+-[0-9]+$"
print_validation_error "The node name does not follow the required format. Valid format: ^.*+-[0-9]+$"
fi
if [[ -z "$(repmgr_get_node_id)" ]]; then
print_error_exit "The node id is required. Set the environment variable REPMGR_NODE_ID with the node id."
print_validation_error "The node id is required. Set the environment variable REPMGR_NODE_ID with the node id."
fi
if [[ -z "$REPMGR_NODE_NETWORK_NAME" ]]; then
print_error_exit "The node network name is required. Set the environment variable REPMGR_NODE_NETWORK_NAME with the node network name."
print_validation_error "The node network name is required. Set the environment variable REPMGR_NODE_NETWORK_NAME with the node network name."
fi
# Credentials validations
if [[ -z "$REPMGR_USERNAME" ]] || [[ -z "$REPMGR_PASSWORD" ]]; then
print_error_exit "The repmgr credentials are mandatory. Set the environment variables REPMGR_USERNAME and REPMGR_PASSWORD with the repmgr credentials."
print_validation_error "The repmgr credentials are mandatory. Set the environment variables REPMGR_USERNAME and REPMGR_PASSWORD with the repmgr credentials."
fi
[[ "$error_code" -eq 0 ]] || exit "$error_code"
}
########################

View File

@ -44,7 +44,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t
* [`4-ol-7`, `4.0.3-ol-7-r16` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-ol-7-r16/4/ol-7/Dockerfile)
* [`4-debian-9`, `4.0.3-debian-9-r17`, `4`, `4.0.3`, `4.0.3-r17`, `latest` (4/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-debian-9-r17/4/debian-9/Dockerfile)
* [`4-debian-9`, `4.0.3-debian-9-r18`, `4`, `4.0.3`, `4.0.3-r18`, `latest` (4/debian-9/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-debian-9-r18/4/debian-9/Dockerfile)
* [`4-centos-7`, `4.0.3-centos-7-r18` (4/centos-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-postgresql-repmgr/blob/4.0.3-centos-7-r18/4/centos-7/Dockerfile)
Subscribe to project updates by watching the [bitnami/postgresql-repmgr GitHub repo](https://github.com/bitnami/bitnami-docker-postgresql-repmgr).