Deploying a Milvus App
Introduction
Milvus is an open-source vector database optimized for similarity search. Deploying Milvus with a Dockerfile on Klutch.sh provides reproducible builds, managed secrets, and persistent storage for indexes and logs—all configured from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample client usage, and production tips.
Prerequisites
- A Klutch.sh account (sign up)
- A GitHub repository containing your Dockerfile (GitHub is the only supported git source)
- Understanding that Milvus requires TCP access for gRPC clients
- Optional: external object storage for bulk backups
For onboarding, see the Quick Start.
Architecture and ports
- Milvus (standalone) exposes gRPC on internal port
19530(and HTTP REST on9091if enabled). Choose TCP traffic and set the internal port to19530. - Clients connect to the TCP endpoint; on Klutch.sh you can reach it via
example-app.klutch.sh:8000(external TCP port) mapped to internal19530. - Persistent storage is required for vector indexes, metadata, and logs.
Repository layout
milvus/├── Dockerfile # Must be at repo root for auto-detection└── README.mdKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Validate locally before pushing to GitHub:
docker build -t milvus-local .docker run -p 19530:19530 milvus-localDockerfile for Milvus (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM milvusdb/milvus:v2.4.2
ENV ETCD_USE_EMBED=true \ MINIO_USE_EMBED=true \ STANDALONE_DEPLOY_MODE=standalone \ MILVUS_LOG_LEVEL=info \ MILVUS_ENABLE_METRICS=true \ MILVUS_LISTEN_PORT=19530
EXPOSE 19530CMD ["milvus", "run", "standalone"]Notes:
- This uses the standalone image with embedded Etcd and MinIO. For larger workloads, externalize Etcd/MinIO and adjust environment variables accordingly.
- Pin the version (e.g.,
v2.4.x) for stability and upgrade intentionally.
Environment variables (Klutch.sh)
Set these in Klutch.sh before deploying:
ETCD_USE_EMBED=trueandMINIO_USE_EMBED=true(or provide external endpoints if you manage them separately)MILVUS_LOG_LEVEL=infoMILVUS_LISTEN_PORT=19530- Optional auth/tuning:
MILVUS_ENABLE_TLS=false,MILVUS_MAX_CONCURRENCY,MILVUS_DDL_TIMEOUT
If you deploy without the Dockerfile and need Nixpacks overrides (not typical for Milvus):
NIXPACKS_START_CMD=milvus run standalone
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/var/lib/milvus— main data directory for indexes and metadata./var/lib/milvus/logs— optional log storage if you persist logs.
Ensure these directories are writable.
Deploy Milvus on Klutch.sh (Dockerfile workflow)
- Push your repository—with the Dockerfile at the root—to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Select TCP traffic and set the internal port to
19530. - Add the environment variables above, adjusting embed/external services as needed.
- Attach persistent volumes for
/var/lib/milvus(and/var/lib/milvus/logsif desired) sized for your vectors and logs. - Deploy. Connect your clients to
example-app.klutch.sh:8000(mapped to internal19530) using the Milvus SDK.
Sample client usage (Python)
from pymilvus import connections, FieldSchema, CollectionSchema, DataType, Collection
connections.connect(alias="default", host="example-app.klutch.sh", port="8000")
fields = [ FieldSchema(name="id", dtype=DataType.INT64, is_primary=True, auto_id=True), FieldSchema(name="embedding", dtype=DataType.FLOAT_VECTOR, dim=128),]schema = CollectionSchema(fields, description="demo collection")collection = Collection("demo_vectors", schema=schema)
collection.insert([[1.0]*128])collection.flush()
results = collection.search( data=[[1.0]*128], anns_field="embedding", param={"metric_type": "L2", "params": {"nprobe": 8}}, limit=3,)print(results)Health checks and production tips
- Add a TCP probe on port
19530; for HTTP, use REST on9091if enabled. - Enforce TLS at the edge if you proxy traffic; consider enabling TLS in Milvus for sensitive data.
- Monitor disk usage on
/var/lib/milvusand resize before it fills. - Pin image versions and test upgrades in staging; back up data before upgrades.
- For higher durability, externalize Etcd and MinIO and set corresponding environment variables.
Milvus on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage, and flexible HTTP/TCP routing. With the Dockerfile at the repo root, TCP port 19530 configured, and data directories persisted, you can run scalable vector search without extra YAML or workflow overhead.