Option A — Kubernetes single-file manifest (k8s/infra/chroma/chroma.yaml)
Purpose: spin up a Chroma service in your dev cluster without navigating the multi-file base.
This manifest bundles Service + PVC + StatefulSet with basic health probes.
# k8s/infra/chroma/chroma.yaml
apiVersion: v1
kind: Namespace
metadata:
name: dev
---
apiVersion: v1
kind: Service
metadata:
name: chroma
namespace: dev
spec:
selector:
app: chroma
ports:
- name: http
port: 8000
targetPort: 8000
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: chroma-data
namespace: dev
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 5Gi
# If your cluster needs a specific storageClass:
# storageClassName: standard
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: chroma
namespace: dev
spec:
serviceName: chroma
replicas: 1
selector:
matchLabels:
app: chroma
template:
metadata:
labels:
app: chroma
spec:
containers:
- name: chroma
image: ghcr.io/chroma-core/chroma:0.5
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8000
name: http
volumeMounts:
- name: data
mountPath: /chroma
readinessProbe:
httpGet:
path: /api/v1/heartbeat
port: http
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /api/v1/heartbeat
port: http
initialDelaySeconds: 10
periodSeconds: 20
resources:
requests:
cpu: "100m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "1Gi"
volumes:
- name: data
persistentVolumeClaim:
claimName: chroma-data
How to run
kubectl apply -f k8s/infra/chroma/chroma.yaml
kubectl -n dev get pods
# (optional) port-forward for local check
kubectl -n dev port-forward svc/chroma 8000:8000
# then open http://localhost:8000/api/v1/docs or curl /api/v1/heartbeat
API configuration to match
CHROMA_URL=http://chroma.dev.svc.cluster.local:8000(inside the cluster), orhttp://chroma:8000if same namespace + DNS shortcut.- In local port-forwarding, use
CHROMA_URL=http://localhost:8000.
Option B — Docker Compose for local dev (compose/chroma.yaml)
Purpose: simplest way to bring up Chroma on a laptop.
# compose/chroma.yaml
services:
chroma:
image: ghcr.io/chroma-core/chroma:0.5
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- ./.data/chroma:/chroma
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8000/api/v1/heartbeat || exit 1"]
interval: 15s
timeout: 3s
retries: 5
How to run
docker compose -f compose/chroma.yaml up -d
# verify
curl http://localhost:8000/api/v1/heartbeat
# open docs
open http://localhost:8000/api/v1/docs
API configuration to match
CHROMA_URL=http://localhost:8000
Environment variables (for embeddings/API)
Make sure the API has these (Phase J/K assumptions):
CHROMA_URL=http://chroma:8000 # or http://localhost:8000 if running via compose/port-forward
EMBED_PROVIDER=openai # or 'local'
EMBED_MODEL=text-embedding-3-small
EMBED_DIMENSIONS=1536 # align with the chosen model
OPENAI_API_KEY=... # if EMBED_PROVIDER=openai
If you’re using the dev Kustomize overlay, you can inject these via
k8s/overlays/dev/patch-api-env.yaml(already present in the repo). For local compose, export them into your shell or a.envfile.
Where this will live in the repo
- We’ll place the K8s single-file at:
k8s/infra/chroma/chroma.yaml - And the Compose file at:
compose/chroma.yaml
This should let you bring up a complete local/dev stack and unblock review & testing immediately.
If anything in your cluster environment (namespace, storageClass, image tag) differs, feel free to tweak the values above.
Thanks, and please let me know if you prefer only Kustomize (no single-file) — I can provide an overlay patch instead.
コメントを残す