[go-kit] minio — launcher component, Checkable interface, bucket init hook #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Create the
miniogo-kit micro-lib module — a MinIO client as alauncher.Componentwith alauncher.Checkableinterface and aBeforeStartbucket-init hook. This module follows the same pattern aspostgresandvalkeyand will be imported byiron-dough-apito back product image storage.Context
Iron Dough's product management feature (Feature 2) requires object storage for product images. MinIO is the chosen backend — S3-compatible, self-hosted via Docker Compose, deployed on the
devtools-network. The module must be a reusable go-kit component so any future service can import it without re-implementing the wiring.MinIO devtools instance:
http://minio:9000(container DNS — neverlocalhost)http://minio:9001minioadmin/minioadminminio-go/v7)GET /minio/health/live → 200Reference ADR:
iron-dough-docs/docs/adr/adr-015-minio-object-storage.mdTasks
code.nochebuena.dev/go/miniogithub.com/minio/minio-go/v7ConfigstructClientstruct wrapping*minio.Client— satisfieslauncher.Componentandlauncher.CheckableStart(ctx context.Context) error— initialize the minio-go client; verify connectivity viaBucketExistsor equivalentStop(ctx context.Context) error— no-op (stateless client)Ping(ctx context.Context) error— used by the health check aggregator; callBucketExistson the configured bucketNew(cfg Config) *Client— returns the unstarted component;Startperforms actual initializationBeforeStartbucket-init option: if the configured bucket does not exist, create it with private ACL duringStart; log the creationfunc (c *Client) Native() *minio.Client— returns the underlying SDK client for callers that need direct access (e.g.PutObject,RemoveObject,PresignedGetObject)package minioStartcalls bucket check; verifyPingreturns error when unreachableREADME.mdwith usage example showing wiring into alauncherapplicationSuccess Criteria
go build ./...passes with no errorsgo vet ./...passesgofmt -l .returns no filesNew→Start→Native()→PutObjectsequence works against the devtools MinIO instancePingreturns nil when MinIO is healthy; returns a descriptive error when the endpoint is unreachableStartif it does not existReference
code.nochebuena.dev/go/valkey(launcher component + Checkable)iron-dough-docs/docs/adr/adr-015-minio-object-storage.md