From fe67f5d495a42a91144a2c47b7ff205e2423accd Mon Sep 17 00:00:00 2001 From: Phoevos Kalemkeris Date: Thu, 27 Feb 2025 12:10:25 +0000 Subject: [PATCH 1/2] fix: Wait for MinIO Server before creating bucket Wait for the MinIO Server to be healthy before attempting to create a bucket as part of the 'model-bucket-init' service. This is necessary because the MinIO Server may not be ready to accept requests when the service starts, resulting in errors like the following: ``` Unable to initialize new alias from the provided credentials. Server not initialized, please try again. ``` Signed-off-by: Phoevos Kalemkeris --- docker-compose-mlflow.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker-compose-mlflow.yml b/docker-compose-mlflow.yml index 62736c9..3f4b39b 100644 --- a/docker-compose-mlflow.yml +++ b/docker-compose-mlflow.yml @@ -61,7 +61,8 @@ services: fi " depends_on: - - minio + minio: + condition: "service_healthy" mlflow-ui: image: cogstacksystems/cogstack-mlflow-ui:dev From 433a32e93390df0e5a1d69d2f006fbfeef8c28f0 Mon Sep 17 00:00:00 2001 From: Phoevos Kalemkeris Date: Tue, 4 Mar 2025 13:39:45 +0000 Subject: [PATCH 2/2] fix: Chain bucket init commands to catch errors Chain the commands involved in creating a MinIO bucket run as part of the 'model-bucket-init' service in the 'docker-compose-mlflow.yml' file to correctly catch errors and trigger service restarts. Previously, if the first command (i.e. adding a MinIO host) failed, the second one would still run, overwriting the error code and preventing the service from restarting. Using the '&&' operator to chain the commands ensures that the second command will only run if the first one is successful and that the error code is correctly propagated, allowing Docker to retry in the event of a failure. Note that the MinIO client commands can fail due to a variety of reasons, such as network issues (some of which might be transient), the MinIO Server not being ready, or incorrect credentials. Signed-off-by: Phoevos Kalemkeris --- docker-compose-mlflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose-mlflow.yml b/docker-compose-mlflow.yml index 3f4b39b..411feff 100644 --- a/docker-compose-mlflow.yml +++ b/docker-compose-mlflow.yml @@ -55,8 +55,8 @@ services: - MINIO_PASSWORD=$AWS_SECRET_ACCESS_KEY entrypoint: > /bin/sh -c " - /usr/bin/mc config host add cms_minio http://minio:9000 $${MINIO_USERNAME} $${MINIO_PASSWORD}; - if ! /usr/bin/mc ls cms_minio/cms-model-bucket 2>/dev/null; then + /usr/bin/mc config host add cms_minio http://minio:9000 $${MINIO_USERNAME} $${MINIO_PASSWORD} + && if ! /usr/bin/mc ls cms_minio/cms-model-bucket 2>/dev/null; then /usr/bin/mc mb cms_minio/cms-model-bucket; fi "