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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 7c9d64d79ab [opt](iceberg docker)Add health check for iceberg rest 
container (#46767) (#47422)
7c9d64d79ab is described below

commit 7c9d64d79ab9b7c9fede380f85499fa740bbe448
Author: Thearas <gaozif...@selectdb.com>
AuthorDate: Sat Jan 25 10:04:27 2025 +0900

    [opt](iceberg docker)Add health check for iceberg rest container (#46767) 
(#47422)
---
 .../docker-compose/hive/scripts/hive-metastore.sh  |  4 +--
 .../docker-compose/iceberg/entrypoint.sh.tpl       |  7 ++++
 .../docker-compose/iceberg/iceberg.yaml.tpl        | 38 +++++++++++++++-------
 docker/thirdparties/run-thirdparties-docker.sh     |  2 +-
 4 files changed, 35 insertions(+), 16 deletions(-)

diff --git a/docker/thirdparties/docker-compose/hive/scripts/hive-metastore.sh 
b/docker/thirdparties/docker-compose/hive/scripts/hive-metastore.sh
index 6681a513066..842af6b78b2 100755
--- a/docker/thirdparties/docker-compose/hive/scripts/hive-metastore.sh
+++ b/docker/thirdparties/docker-compose/hive/scripts/hive-metastore.sh
@@ -163,6 +163,4 @@ echo "Script: create_view.hql executed in ${EXECUTION_TIME} 
seconds"
 touch /mnt/SUCCESS
 
 # Avoid container exit
-while true; do
-    sleep 1
-done
+tail -f /dev/null
diff --git a/docker/thirdparties/docker-compose/iceberg/entrypoint.sh.tpl 
b/docker/thirdparties/docker-compose/iceberg/entrypoint.sh.tpl
index 45d9bbf3592..4ccdf54b030 100644
--- a/docker/thirdparties/docker-compose/iceberg/entrypoint.sh.tpl
+++ b/docker/thirdparties/docker-compose/iceberg/entrypoint.sh.tpl
@@ -18,6 +18,13 @@
 
 export SPARK_MASTER_HOST=doris--spark-iceberg
 
+# wait iceberg-rest start
+while [[ ! $(curl -s --fail http://rest:8181/v1/config) ]]; do
+    sleep 1
+done
+
+set -ex
+
 start-master.sh -p 7077
 start-worker.sh spark://doris--spark-iceberg:7077
 start-history-server.sh
diff --git a/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl 
b/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl
index 1715d9aa1d7..43e786e4e48 100644
--- a/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl
+++ b/docker/thirdparties/docker-compose/iceberg/iceberg.yaml.tpl
@@ -25,9 +25,10 @@ services:
     hostname: doris--spark-iceberg
     build: spark/
     depends_on:
-      - rest
-      - minio
-      - mc
+      rest:
+        condition: service_started
+      mc:
+        condition: service_completed_successfully
     volumes:
       - ./data/output/spark-warehouse:/home/iceberg/warehouse
       - ./data/output/spark-notebooks:/home/iceberg/notebooks/notebooks
@@ -40,11 +41,11 @@ services:
       - AWS_ACCESS_KEY_ID=admin
       - AWS_SECRET_ACCESS_KEY=password
       - AWS_REGION=us-east-1
-    entrypoint: /bin/sh /mnt/scripts/entrypoint.sh 
+    entrypoint: /bin/sh /mnt/scripts/entrypoint.sh
     networks:
       - doris--iceberg
     healthcheck:
-      test: ["CMD", "ls", "/mnt/SUCCESS"]
+      test: ls /mnt/SUCCESS
       interval: 5s
       timeout: 120s
       retries: 120
@@ -56,20 +57,28 @@ services:
       POSTGRES_PASSWORD: 123456
       POSTGRES_USER: root
       POSTGRES_DB: iceberg
+    healthcheck:
+      test: [ "CMD-SHELL", "pg_isready -U root" ]
+      interval: 5s
+      timeout: 60s
+      retries: 120
     volumes:
       - ./data/input/pgdata:/var/lib/postgresql/data
     networks:
       - doris--iceberg
 
   rest:
-    image: tabulario/iceberg-rest
+    image: tabulario/iceberg-rest:1.6.0
     container_name: doris--iceberg-rest
     ports:
       - ${REST_CATALOG_PORT}:8181
     volumes:
       - ./data:/mnt/data
     depends_on:
-      - postgres
+      postgres:
+        condition: service_healthy
+      minio:
+        condition: service_healthy
     environment:
       - AWS_ACCESS_KEY_ID=admin
       - AWS_SECRET_ACCESS_KEY=password
@@ -85,10 +94,15 @@ services:
     entrypoint: /bin/bash /mnt/data/input/script/rest_init.sh
 
   minio:
-    image: minio/minio
+    image: minio/minio:RELEASE.2025-01-20T14-49-07Z
     container_name: doris--minio
     ports:
       - ${MINIO_API_PORT}:9000
+    healthcheck:
+      test: [ "CMD", "mc", "ready", "local" ]
+      interval: 10s
+      timeout: 60s
+      retries: 120
     environment:
       - MINIO_ROOT_USER=admin
       - MINIO_ROOT_PASSWORD=password
@@ -101,8 +115,9 @@ services:
 
   mc:
     depends_on:
-      - minio
-    image: minio/mc
+      minio:
+        condition: service_healthy
+    image: minio/mc:RELEASE.2025-01-17T23-25-50Z
     container_name: doris--mc
     environment:
       - AWS_ACCESS_KEY_ID=admin
@@ -120,7 +135,6 @@ services:
       /usr/bin/mc policy set public minio/warehouse;
       echo 'copy data';
       mc cp -r /mnt/data/input/minio/warehouse/* minio/warehouse/;
-      tail -f /dev/null
       "
 
 networks:
@@ -128,4 +142,4 @@ networks:
     ipam:
       driver: default
       config:
-        - subnet: 168.38.0.0/24
\ No newline at end of file
+        - subnet: 168.38.0.0/24
diff --git a/docker/thirdparties/run-thirdparties-docker.sh 
b/docker/thirdparties/run-thirdparties-docker.sh
index d1dbd7decfc..251288c2c56 100755
--- a/docker/thirdparties/run-thirdparties-docker.sh
+++ b/docker/thirdparties/run-thirdparties-docker.sh
@@ -733,7 +733,7 @@ for compose in "${!pids[@]}"; do
     if [ $status -ne 0 ] && [ $compose != "db2" ]; then
         echo "docker $compose started failed with status $status"
         echo "print start_${compose}.log"
-        cat start_${compose}.log
+        cat start_${compose}.log || true
 
         echo ""
         echo "print last 100 logs of the latest unhealthy container"


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

Reply via email to