From 8a3ab871e979623145b6b04b164cd79f7fb67cff Mon Sep 17 00:00:00 2001 From: Jonathan Katzman Date: Wed, 2 Sep 2026 12:52:54 -0400 Subject: [PATCH] Make MinIO bucket creation wait for readiness and fail loudly sublime_create_buckets raced MinIO startup with a blind `sleep 15` and swallowed all errors via an unconditional `exit 0`. When MinIO was slow to accept connections, mc alias set / mc mb would fail, but the container still exited 0, so `docker compose up --wait` was satisfied and the stack came up with no buckets. Consumers then hit a confusing PutObject -> 404 (NoSuchBucket) far from the real cause. Replace the fixed sleep with a bounded readiness retry loop (60 attempts x 2s) against `mc alias set`, which performs a real authenticated round-trip. Use `mc mb --ignore-existing` so re-runs against a populated s3_data volume stay idempotent, and drop the unconditional exit 0 so genuine failures propagate and --wait gates on success. Pin minio/minio and minio/mc to explicit tags instead of `latest` so startup timing and CLI behavior don't drift. Co-Authored-By: Claude Sonnet 5 --- docker-compose.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a476022..4325851 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -153,7 +153,7 @@ services: # Keep this name as sublimes3 because underscores don't play nice with certain endpoint validation sublimes3: container_name: sublimes3 - image: minio/minio + image: minio/minio:RELEASE.2025-09-07T16-13-09Z restart: unless-stopped networks: - net @@ -169,7 +169,7 @@ services: minio server --address 0.0.0.0:8110 --console-address 0.0.0.0:8111 /data; " sublime_create_buckets: - image: minio/mc + image: minio/mc:RELEASE.2025-08-13T08-35-41Z depends_on: - sublimes3 networks: @@ -177,15 +177,22 @@ services: env_file: sublime.env entrypoint: > /bin/sh -c " - sleep 15; - /usr/bin/mc alias set myminio http://sublimes3:8110 $$AWS_ACCESS_KEY_ID $$AWS_SECRET_ACCESS_KEY; - /usr/bin/mc mb myminio/email-screenshots; - /usr/bin/mc mb myminio/events; - /usr/bin/mc mb myminio/message-storage; - /usr/bin/mc mb myminio/message-export; - /usr/bin/mc mb myminio/nipper-artifacts; + attempt=1; + max_attempts=60; + until /usr/bin/mc alias set myminio http://sublimes3:8110 $$AWS_ACCESS_KEY_ID $$AWS_SECRET_ACCESS_KEY; do + attempt=$$((attempt + 1)); + if [ $$attempt -gt $$max_attempts ]; then + echo 'sublime_create_buckets: MinIO did not become ready in time' >&2; + exit 1; + fi; + sleep 2; + done; + /usr/bin/mc mb --ignore-existing myminio/email-screenshots && + /usr/bin/mc mb --ignore-existing myminio/events && + /usr/bin/mc mb --ignore-existing myminio/message-storage && + /usr/bin/mc mb --ignore-existing myminio/message-export && + /usr/bin/mc mb --ignore-existing myminio/nipper-artifacts && /usr/bin/mc ls myminio; - exit 0; " sublime_hydra: image: sublimesec/hydra-cpu:dev