Skip to content

Commit 97488df

Browse files
Don't use wait for host port instead use pg_isready
1 parent 84e742c commit 97488df

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

openvoxdb/Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LABEL org.label-schema.maintainer="Voxpupuli Release Team <voxpupuli@groups.io>"
1616
org.label-schema.build-date="$build_date"
1717

1818
# Use netcat-openbsd to support IPv6 connectivity checks (netcat-traditional is IPv4 only)
19-
ARG PACKAGES="ca-certificates curl dnsutils netcat-openbsd dumb-init"
19+
ARG PACKAGES="ca-certificates curl dnsutils netcat-openbsd dumb-init postgresql-client-16 postgresql-client-common"
2020

2121
ARG LOGDIR
2222
ENV LOGDIR=${LOGDIR:-/opt/puppetlabs/server/data/puppetdb/logs}

openvoxdb/container-entrypoint.d/10-wait-for-hosts.sh

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ set -e
1616
# OPENVOXDB_POSTGRES_HOSTNAME Specified in Dockerfile, defaults to postgres
1717
# OPENVOXSERVER_HOSTNAME DNS name of puppetserver to wait on, defaults to puppet
1818

19-
2019
msg() {
2120
echo "($0) $1"
2221
}
@@ -57,12 +56,11 @@ OPENVOXDB_POSTGRES_HOSTNAME="${OPENVOXDB_POSTGRES_HOSTNAME:-postgres}"
5756
OPENVOXSERVER_HOSTNAME="${OPENVOXSERVER_HOSTNAME:-puppet}"
5857
OPENVOXSERVER_PORT="${OPENVOXSERVER_PORT:-8140}"
5958

60-
# wait for postgres DNS
61-
wait_for_host_name_resolution $OPENVOXDB_POSTGRES_HOSTNAME $OPENVOXDB_WAITFORHOST_SECONDS
59+
# wait for postgres is ready
60+
/wtfc.sh --timeout="${OPENVOXDB_WAITFORHOST_SECONDS}" --interval=1 --progress "pg_isready -h ${OPENVOXDB_POSTGRES_HOSTNAME} --port '${OPENVOXDB_POSTGRES_PORT:-5432}'"
6261

6362
# wait for puppetserver DNS, then healthcheck
6463
if [ "$USE_OPENVOXSERVER" = true ]; then
65-
wait_for_host_name_resolution $OPENVOXSERVER_HOSTNAME $OPENVOXDB_WAITFORHOST_SECONDS
6664
HEALTH_COMMAND="curl --silent --fail --insecure 'https://${OPENVOXSERVER_HOSTNAME}:"${OPENVOXSERVER_PORT}"/status/v1/simple' | grep -q '^running$'"
6765
fi
6866

@@ -72,6 +70,3 @@ if [ -n "$HEALTH_COMMAND" ]; then
7270
error "Required health check failed"
7371
fi
7472
fi
75-
76-
# wait for postgres
77-
wait_for_host_port $OPENVOXDB_POSTGRES_HOSTNAME "${OPENVOXDB_POSTGRES_PORT:-5432}" $OPENVOXDB_WAITFORPOSTGRES_SECONDS

0 commit comments

Comments
 (0)