Skip to content

Where agent teams gather. Cross-platform team chat where AI agents are first-class teammates — with cloud or bring-your-own (Claude Code / Codex) brains.

TypeScript
5.5 KB
Raw Blame
# cumora-server — OrbStack / local-dev manifest.
#
# For production GKE, use `cumora-server.gke.yaml` instead; that one
# has the Cloud SQL Proxy sidecar, Workload Identity annotation,
# imagePullSecrets, and PodDisruptionBudget that prod needs.
#
# Apply order (Secret first, manifests next):
#
#   kubectl create secret generic cumora \
#     --from-literal=DATABASE_URL='postgres://USER:[email protected]:5432/cumora' \
#     --from-literal=REDIS_URL='redis://host.docker.internal:6379' \
#     --from-literal=OPENAI_API_KEY='sk-...' \
#     --from-literal=AGENT_RUNTIME_SECRET="$(openssl rand -hex 32)"
#
#   kubectl apply -f server/k8s/cumora-server.orbstack.yaml
#
# OrbStack-isms baked in here:
#   - PG/Redis URLs in the Secret use host.docker.internal
#   - No imagePullSecrets (OrbStack auto-loads images from local docker)
#   - No Cloud SQL Proxy sidecar
#   - No Workload Identity annotation
---
# ServiceAccount + Role + RoleBinding — the orchestrator shells out
# to `kubectl get / apply / delete pod`. Inside the pod, kubectl
# uses the projected SA token automatically; we just have to grant
# the SA those verbs on `pods` (and `pods/log` so the orchestrator
# can fetch pod output during diagnostics).
apiVersion: v1
kind: ServiceAccount
metadata:
  name: cumora-server
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: cumora-server-agent-pods
rules:
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: [""]
  resources: ["pods/log"]
  verbs: ["get", "list"]
# Per-agent Chromium profile PVCs outlive Pods so cookies/login state survive
# an idle restart. Keep this namespace-local; never delete or recreate the
# existing PVC as part of a Pod security upgrade.
- apiGroups: [""]
  resources: ["persistentvolumeclaims"]
  verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
# The orchestrator reads the pre-deployed agent NetworkPolicies before it
# creates or reuses a Pod. It never grants itself policy mutation rights.
- apiGroups: ["networking.k8s.io"]
  resources: ["networkpolicies"]
  verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: cumora-server-agent-pods
subjects:
- kind: ServiceAccount
  name: cumora-server
roleRef:
  kind: Role
  name: cumora-server-agent-pods
  apiGroup: rbac.authorization.k8s.io
---
# Deployment — run `npm run migrate` once before applying this manifest.
# Application replicas only verify the immutable migration ledger and never
# execute DDL while starting.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cumora-server
  labels: { app: cumora-server }
spec:
  replicas: 1
  selector:
    matchLabels: { app: cumora-server }
  template:
    metadata:
      labels: { app: cumora-server }
    spec:
      terminationGracePeriodSeconds: 60
      serviceAccountName: cumora-server
      containers:
      - name: server
        image: quay.io/yetoneful/cumora-server:dev
        imagePullPolicy: IfNotPresent
        lifecycle:
          preStop:
            exec:
              command: ["sleep", "15"]
        ports:
        - { name: http, containerPort: 5181 }
        envFrom:
        - secretRef: { name: cumora }
        env:
        # The agent-computer pod reaches the server via this URL.
        # When server runs IN the cluster, use the service DNS;
        # when server runs on the host, agents reach it via
        # host.docker.internal (orchestrator's default).
        - name: AGENT_RUNTIME_SERVER_URL
          value: "http://cumora-server.default.svc.cluster.local:5181/runtime"
        - name: CUMORA_AGENT_NAMESPACE
          value: "default"
        # Namespace containing the trusted server Pods selected by the agent
        # NetworkPolicy. Keep explicit when agents move to a dedicated ns.
        - name: CUMORA_AGENT_SERVER_NAMESPACE
          value: "default"
        # Pre-deploy server/k8s/cumora-agent-network-policy.yaml in this
        # namespace. The orchestrator checks its v1 objects and fails closed;
        # it does not apply policies or infer URL-specific exceptions.
        - name: WORKSPACE_RUNTIME_CLEANUP_ENABLED
          value: "true"
        # In-cluster PG is also reachable via the service URL above
        # for the agent FUSE driver's HTTP traffic; PG itself lives
        # on the host in dev (host.docker.internal:5432, set in the
        # Secret's DATABASE_URL).
        # Startup waits for the schema gate's bounded DB retry budget. Liveness
        # only checks the process; readiness checks DB reachability and keeps a
        # booting or degraded pod out of service without killing it.
        startupProbe:
          httpGet: { path: /api/livez, port: http }
          periodSeconds: 5
          timeoutSeconds: 2
          failureThreshold: 60
        readinessProbe:
          httpGet: { path: /api/health, port: http }
          periodSeconds: 5
          timeoutSeconds: 2
          # Same contract as cumora-server.gke.yaml / deploy/recovery.ts: a
          # DB under load fails a fraction of probes; only 60s of consecutive
          # failures should pull a pod.
          failureThreshold: 12
        livenessProbe:
          httpGet: { path: /api/livez, port: http }
          periodSeconds: 30
          timeoutSeconds: 3
        resources:
          requests: { cpu: "100m", memory: "256Mi" }
          limits:   { cpu: "1000m", memory: "1Gi" }
---
apiVersion: v1
kind: Service
metadata:
  name: cumora-server
  labels: { app: cumora-server }
spec:
  selector: { app: cumora-server }
  ports:
  - { name: http, port: 5181, targetPort: http }