mirror of
https://github.com/zabbix/zabbix-docker.git
synced 2025-08-10 17:13:53 +02:00
Fixed PostgreSQL availability check
This commit is contained in:
@ -57,11 +57,19 @@ RUN set -eux && \
|
||||
postgresql-client \
|
||||
snmp-mibs-downloader \
|
||||
unixodbc && \
|
||||
curl -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini -o /sbin/tini && \
|
||||
curl -L https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc -o /tini.asc && \
|
||||
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && \
|
||||
gpg --batch --verify /tini.asc /sbin/tini && \
|
||||
rm -rf /root/.gnupg && \
|
||||
curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini" -o /sbin/tini && \
|
||||
curl -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc" -o /tmp/tini.asc && \
|
||||
export GNUPGHOME="$(mktemp -d)" && \
|
||||
for server in $(shuf -e ha.pool.sks-keyservers.net \
|
||||
hkp://p80.pool.sks-keyservers.net:80 \
|
||||
ipv4.pool.sks-keyservers.net \
|
||||
keyserver.ubuntu.com \
|
||||
keyserver.pgp.com \
|
||||
pgp.mit.edu) ; do \
|
||||
gpg --keyserver "$server" --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 && break || : ; \
|
||||
done && \
|
||||
gpg --batch --verify /tmp/tini.asc /sbin/tini && \
|
||||
rm -r "$GNUPGHOME" /tmp/tini.asc && \
|
||||
chmod +x /sbin/tini && \
|
||||
apt-get -y purge curl gpg dirmngr gpg-agent && \
|
||||
apt-get -y autoremove && \
|
||||
|
@ -196,7 +196,7 @@ check_db_connect_postgresql() {
|
||||
export PGSSLKEY=${ZBX_DBTLSKEYFILE}
|
||||
fi
|
||||
|
||||
while [ ! "$(psql --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --list --quiet 2>/dev/null)" ]; do
|
||||
while [ ! "$(pg_isready --host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} --username ${DB_SERVER_ROOT_USER} --dbname ${DB_SERVER_DBNAME} --quiet 2>/dev/null && echo $?)" ]; do
|
||||
echo "**** PostgreSQL server is not available. Waiting $WAIT_TIMEOUT seconds..."
|
||||
sleep $WAIT_TIMEOUT
|
||||
done
|
||||
@ -305,12 +305,12 @@ create_db_schema_postgresql() {
|
||||
|
||||
zcat /usr/share/doc/zabbix-server-postgresql/create.sql.gz | psql --quiet \
|
||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||
|
||||
if [ "${ENABLE_TIMESCALEDB}" == "true" ]; then
|
||||
cat /usr/share/doc/zabbix-server-postgresql/timescaledb.sql | psql --quiet \
|
||||
--host ${DB_SERVER_HOST} --port ${DB_SERVER_PORT} \
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null
|
||||
--username ${DB_SERVER_ZBX_USER} --dbname ${DB_SERVER_DBNAME} 1>/dev/null || exit 1
|
||||
fi
|
||||
|
||||
unset PGPASSWORD
|
||||
|
Reference in New Issue
Block a user