From 24e0966a78b5274205f03e2adbfe1b82d31f418b Mon Sep 17 00:00:00 2001 From: Johan Wassberg Date: Wed, 21 Aug 2024 14:16:26 +0200 Subject: [PATCH] Test if mysql respondes --- .../sunet-machine-healthy/health-checks.d/db.check | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 common-db/overlay/etc/sunet-machine-healthy/health-checks.d/db.check diff --git a/common-db/overlay/etc/sunet-machine-healthy/health-checks.d/db.check b/common-db/overlay/etc/sunet-machine-healthy/health-checks.d/db.check new file mode 100755 index 0000000..3f84c45 --- /dev/null +++ b/common-db/overlay/etc/sunet-machine-healthy/health-checks.d/db.check @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + + +while true; do + if /usr/bin/docker exec -it mariadb-db-1 mysql -p"$(puppet lookup --render-as s mariadb_root_password 2>/dev/null)" -e "show status like 'wsrep_cluster_status';" | grep -q Primary; then + exit 0 + fi + + sleep 3 +done