This is an automated email from the ASF dual-hosted git repository.

zfeng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-seata-go-samples.git


The following commit(s) were added to refs/heads/main by this push:
     new 780f095  fix: fix docker health check (#56)
780f095 is described below

commit 780f09518b4828252f5dc3d307e2b91f18780d78
Author: marsevilspirit <marsevilspi...@gmail.com>
AuthorDate: Tue Jun 3 21:58:59 2025 +0800

    fix: fix docker health check (#56)
---
 dockercompose/docker-health-check.sh | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/dockercompose/docker-health-check.sh 
b/dockercompose/docker-health-check.sh
index cdaa88e..4fdbfbf 100755
--- a/dockercompose/docker-health-check.sh
+++ b/dockercompose/docker-health-check.sh
@@ -15,16 +15,34 @@
 # limitations under the License.
 #
 
-curl 127.0.0.1:7091
-res=$?
+#!/bin/bash
+
+echo "Checking Seata server..."
+res=1
 passCode=0
-while [ "$res" != "$passCode" ];do
-  echo "wait seata server"
+while [ "$res" != "$passCode" ]; do
+  echo "Waiting for Seata server..."
   sleep 5
-  curl 127.0.0.1:7091
+  curl -s -o /dev/null 127.0.0.1:7091
   res=$?
 done
 
-sleep 10
+echo "Seata server is up!"
+
+CONTAINER_NAME="mysql"
+MYSQL_USER="root"
+MYSQL_PASS="12345678"
+
+echo "Checking MySQL container..."
+res=1
+while [ "$res" != "0" ]; do
+  if docker exec "$CONTAINER_NAME" mysql -u "$MYSQL_USER" -p"$MYSQL_PASS" -e 
"SELECT 1;" >/dev/null 2>&1; then
+      res=0
+  else
+      echo "Waiting for MySQL container..."
+      sleep 5
+  fi
+done
 
+echo "MySQL container is up!"
 


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to