Skip to content

Deploying a MinIO App

Introduction

MinIO is an open-source, S3-compatible object storage server. Deploying MinIO with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage for buckets and artifacts—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample API usage, and production tips.


Prerequisites

  • A Klutch.sh account (sign up)
  • A GitHub repository containing your MinIO Dockerfile (GitHub is the only supported git source)
  • Access and secret keys for MinIO (set as environment variables)
  • Storage sizing plan for your buckets

For onboarding, see the Quick Start.


Architecture and ports

  • MinIO serves S3 API over internal port 9000 and the console over 9001; choose HTTP traffic and set the internal port to 9000.
  • Persistent storage is required for bucket data.

Repository layout

minio/
├── Dockerfile # Must be at repo root for auto-detection
└── README.md

Keep secrets out of Git; store them in Klutch.sh environment variables.


Installation (local) and starter commands

Validate locally before pushing to GitHub:

Terminal window
docker build -t minio-local .
docker run -p 9000:9000 -p 9001:9001 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
minio-local

Dockerfile for MinIO (production-ready)

Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):

FROM minio/minio:RELEASE.2024-07-13T03-12-02Z
ENV MINIO_ROOT_USER=minioadmin \
MINIO_ROOT_PASSWORD=minioadmin
EXPOSE 9000 9001
CMD ["server", "/data", "--console-address", ":9001", "--address", ":9000"]

Notes:

  • Pin the image tag for stability; update intentionally.
  • Use strong credentials in production via environment variables.

Environment variables (Klutch.sh)

Set these in Klutch.sh before deploying:

  • MINIO_ROOT_USER=<secure-access-key>
  • MINIO_ROOT_PASSWORD=<secure-secret-key>
  • Optional: MINIO_BROWSER_REDIRECT_URL=https://example-app.klutch.sh:9001 (if exposing the console), MINIO_REGION, MINIO_SERVER_URL=https://example-app.klutch.sh:9000

If you deploy without the Dockerfile and need Nixpacks overrides:

  • NIXPACKS_START_CMD=minio server /data --console-address :9001 --address :9000

Attach persistent volumes

In Klutch.sh storage settings, add mount paths and sizes (no names required):

  • /data — object storage buckets and metadata.

Ensure this path is writable inside the container.


Deploy MinIO on Klutch.sh (Dockerfile workflow)

  1. Push your repository—with the Dockerfile at the root—to GitHub.
  2. Open klutch.sh/app, create a project, and add an app.
  3. Select HTTP traffic and set the internal port to 9000.
  4. Add the environment variables above, including secure access/secret keys.
  5. Attach a persistent volume for /data sized for your buckets.
  6. Deploy. Reach the S3 API at https://example-app.klutch.sh (port 9000) and the console at https://example-app.klutch.sh:9001 if exposed.

Sample API usage (AWS SDK for JavaScript v3)

import { S3Client, CreateBucketCommand, PutObjectCommand } from "@aws-sdk/client-s3";
const client = new S3Client({
endpoint: "https://example-app.klutch.sh:9000",
region: "us-east-1",
forcePathStyle: true,
credentials: {
accessKeyId: process.env.MINIO_ROOT_USER,
secretAccessKey: process.env.MINIO_ROOT_PASSWORD,
},
});
await client.send(new CreateBucketCommand({ Bucket: "demo-bucket" }));
await client.send(new PutObjectCommand({
Bucket: "demo-bucket",
Key: "hello.txt",
Body: "Hello from MinIO on Klutch.sh!",
}));

Health checks and production tips

  • Add an HTTP probe to /minio/health/ready on port 9000.
  • Enforce HTTPS at the edge; forward internally to ports 9000/9001.
  • Use strong credentials and rotate them in Klutch.sh secrets.
  • Monitor /data usage and resize before it fills; back up critical buckets regularly.
  • Pin image versions; test upgrades in staging before production.

MinIO on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, ports 9000/9001 configured, and /data persisted, you can run S3-compatible storage without extra YAML or workflow overhead.