4.1.0-ol-7-r89 release

This commit is contained in:
Bitnami Bot 2020-02-01 10:42:25 +00:00
parent 009eb54e6b
commit 94dc224a81
5 changed files with 62 additions and 16 deletions

View File

@ -22,7 +22,7 @@ RUN curl --silent -L https://github.com/bitnami/wait-for-port/releases/download/
COPY rootfs /
RUN /postunpack.sh
ENV BITNAMI_APP_NAME="pgpool" \
BITNAMI_IMAGE_VERSION="4.1.0-ol-7-r88" \
BITNAMI_IMAGE_VERSION="4.1.0-ol-7-r89" \
PATH="/opt/bitnami/postgresql/bin:/opt/bitnami/pgpool/bin:$PATH"
EXPOSE 5432

View File

@ -1,4 +1,4 @@
version: '2'
version: '2.1'
services:
pg-0:
image: bitnami/postgresql-repmgr:11-ol-7
@ -46,6 +46,11 @@ services:
- PGPOOL_ADMIN_USERNAME=admin
- PGPOOL_ADMIN_PASSWORD=adminpassword
- PGPOOL_ENABLE_LOAD_BALANCING=yes
healthcheck:
test: ["CMD", "/healthcheck.sh"]
interval: 10s
timeout: 5s
retries: 5
volumes:
pg_0_data:
driver: local

View File

@ -0,0 +1,18 @@
#!/bin/bash
#
# Bitnami Pgpool healthcheck
set -o errexit
set -o nounset
set -o pipefail
# set -o xtrace # Uncomment this line for debugging purpose
# shellcheck disable=SC1091
# Load libraries
. /libpgpool.sh
# Load Pgpool env. variables
eval "$(pgpool_env)"
pgpool_healthcheck

View File

@ -150,6 +150,40 @@ pgpool_validate() {
[[ "$error_code" -eq 0 ]] || exit "$error_code"
}
pgpool_attach_node() {
local -r node_id=${1:?node id is missing}
info "Attaching backend node..."
export PCPPASSFILE=$(mktemp /tmp/pcppass-XXXXX)
echo "localhost:9898:${PGPOOL_ADMIN_USERNAME}:${PGPOOL_ADMIN_PASSWORD}" > "${PCPPASSFILE}"
pcp_attach_node -h localhost -U "${PGPOOL_ADMIN_USERNAME}" -p 9898 -n "${node_id}" -w
rm -rf "${PCPPASSFILE}"
}
########################
# Check pgpool health and attached offline backends when they are online
# Globals:
# PGPOOL_*
# Arguments:
# None
# Returns:
# 0 when healthy
# 1 when unhealthy
#########################
pgpool_healthcheck() {
info "Checking pgpool health..."
# look up backends that are marked offline
for node in $(PGPASSWORD="${PGPOOL_POSTGRES_PASSWORD}" psql -U "${PGPOOL_POSTGRES_USERNAME}" -h localhost -tA -c "SHOW pool_nodes;" | grep "down")
do
node_id=$(echo ${node} | cut -d'|' -f1)
node_host=$(echo ${node} | cut -d'|' -f2)
if PGPASSWORD="${PGPOOL_POSTGRES_PASSWORD}" psql -U "${PGPOOL_POSTGRES_USERNAME}" -h "${node_host}" -tA -c "SELECT 1" >/dev/null; then
# attach backend if it has come back online
pgpool_attach_node "${node_id}"
fi
done
}
########################
# Start nslcd in background
# Arguments:
@ -227,25 +261,14 @@ pgpool_create_backend_config() {
local -r dir="${fields[4]:-$PGPOOL_DATA_DIR}"
local -r flag="${fields[5]:-ALLOW_TO_FAILOVER}"
#check if it is possible to connect to the node
debug "Waiting for backend '$host' ..."
if ! retry_while "is_hostname_resolved $host" "$retries" "$sleep_time"; then
error "$host is not a resolved hostname"
exit 1
fi
if wait-for-port --host "$host" --timeout "$PGPOOL_TIMEOUT" "$port"; then
debug "Backend '$host' is ready. Adding its information to the configuration..."
cat >> "$PGPOOL_CONF_FILE" << EOF
debug "Adding '$host' information to the configuration..."
cat >> "$PGPOOL_CONF_FILE" << EOF
backend_hostname$num = '$host'
backend_port$num = $port
backend_weight$num = $weight
backend_data_directory$num = '$dir'
backend_flag$num = '$flag'
EOF
else
error "Backend $host did not respond after $PGPOOL_TIMEOUT seconds!"
exit 1
fi
}
########################

View File

@ -39,7 +39,7 @@ Bitnami containers can be used with [Kubeapps](https://kubeapps.com/) for deploy
Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/).
* [`4-ol-7`, `4.1.0-ol-7-r88` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-pgpool/blob/4.1.0-ol-7-r88/4/ol-7/Dockerfile)
* [`4-ol-7`, `4.1.0-ol-7-r89` (4/ol-7/Dockerfile)](https://github.com/bitnami/bitnami-docker-pgpool/blob/4.1.0-ol-7-r89/4/ol-7/Dockerfile)
* [`4-debian-10`, `4.1.0-debian-10-r7`, `4`, `4.1.0`, `latest` (4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-pgpool/blob/4.1.0-debian-10-r7/4/debian-10/Dockerfile)
Subscribe to project updates by watching the [bitnami/pgpool GitHub repo](https://github.com/bitnami/bitnami-docker-pgpool).