Production Deployment
This guide covers deploying KubeOrch in a production environment.
Prerequisites
Section titled “Prerequisites”- Docker and Docker Compose v2+
- A domain name (optional but recommended)
- TLS certificate (Let’s Encrypt or similar)
- MongoDB 6.0+ instance (or use the bundled container)
Option 1: Docker Compose (Recommended for Small Teams)
Section titled “Option 1: Docker Compose (Recommended for Small Teams)”1. Create the Environment File
Section titled “1. Create the Environment File”cat > .env <<EOF# Core BackendGIN_MODE=releasePORT=8080MONGO_URI=mongodb://mongo:27017/kubeorchJWT_SECRET=$(openssl rand -hex 32)ENCRYPTION_KEY=$(openssl rand -hex 16)TOKEN_TTL=24h
# FrontendNEXT_PUBLIC_API_URL=https://your-domain.com/api
# MongoDBMONGO_INITDB_DATABASE=kubeorchEOF2. Create the Compose File
Section titled “2. Create the Compose File”services: core: image: ghcr.io/kubeorch/core:latest restart: unless-stopped env_file: .env ports: - "8080:8080" depends_on: mongo: condition: service_healthy healthcheck: test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/health"] interval: 30s timeout: 5s retries: 3
ui: image: ghcr.io/kubeorch/ui:latest restart: unless-stopped environment: - NEXT_PUBLIC_API_URL=https://your-domain.com/api ports: - "3000:3000" depends_on: - core
mongo: image: mongo:7 restart: unless-stopped volumes: - mongo_data:/data/db healthcheck: test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"] interval: 10s timeout: 5s retries: 5
volumes: mongo_data:3. Start the Stack
Section titled “3. Start the Stack”docker compose -f docker-compose.production.yml up -d4. Verify
Section titled “4. Verify”# Check all services are runningdocker compose -f docker-compose.production.yml ps
# Check core healthcurl http://localhost:8080/healthOption 2: Kubernetes
Section titled “Option 2: Kubernetes”1. Create the Namespace
Section titled “1. Create the Namespace”kubectl create namespace kubeorch2. Create Secrets
Section titled “2. Create Secrets”kubectl create secret generic kubeorch-secrets \ --namespace kubeorch \ --from-literal=jwt-secret=$(openssl rand -hex 32) \ --from-literal=encryption-key=$(openssl rand -hex 16) \ --from-literal=mongo-uri=mongodb://mongo:27017/kubeorch3. Deploy MongoDB
Section titled “3. Deploy MongoDB”apiVersion: apps/v1kind: StatefulSetmetadata: name: mongo namespace: kubeorchspec: serviceName: mongo replicas: 1 selector: matchLabels: app: mongo template: metadata: labels: app: mongo spec: containers: - name: mongo image: mongo:7 ports: - containerPort: 27017 volumeMounts: - name: data mountPath: /data/db volumeClaimTemplates: - metadata: name: data spec: accessModes: ["ReadWriteOnce"] resources: requests: storage: 10Gi---apiVersion: v1kind: Servicemetadata: name: mongo namespace: kubeorchspec: selector: app: mongo ports: - port: 270174. Deploy Core Backend
Section titled “4. Deploy Core Backend”apiVersion: apps/v1kind: Deploymentmetadata: name: core namespace: kubeorchspec: replicas: 1 selector: matchLabels: app: core template: metadata: labels: app: core spec: containers: - name: core image: ghcr.io/kubeorch/core:latest ports: - containerPort: 8080 env: - name: GIN_MODE value: release - name: PORT value: "8080" - name: MONGO_URI valueFrom: secretKeyRef: name: kubeorch-secrets key: mongo-uri - name: JWT_SECRET valueFrom: secretKeyRef: name: kubeorch-secrets key: jwt-secret - name: ENCRYPTION_KEY valueFrom: secretKeyRef: name: kubeorch-secrets key: encryption-key livenessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 10 periodSeconds: 30 readinessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 5 periodSeconds: 10---apiVersion: v1kind: Servicemetadata: name: core namespace: kubeorchspec: selector: app: core ports: - port: 80805. Deploy UI Frontend
Section titled “5. Deploy UI Frontend”apiVersion: apps/v1kind: Deploymentmetadata: name: ui namespace: kubeorchspec: replicas: 1 selector: matchLabels: app: ui template: metadata: labels: app: ui spec: containers: - name: ui image: ghcr.io/kubeorch/ui:latest ports: - containerPort: 3000 env: - name: NEXT_PUBLIC_API_URL value: https://your-domain.com/api---apiVersion: v1kind: Servicemetadata: name: ui namespace: kubeorchspec: selector: app: ui ports: - port: 30006. Create Ingress
Section titled “6. Create Ingress”apiVersion: networking.k8s.io/v1kind: Ingressmetadata: name: kubeorch namespace: kubeorch annotations: cert-manager.io/cluster-issuer: letsencrypt-prodspec: tls: - hosts: - your-domain.com secretName: kubeorch-tls rules: - host: your-domain.com http: paths: - path: /v1 pathType: Prefix backend: service: name: core port: number: 8080 - path: / pathType: Prefix backend: service: name: ui port: number: 30007. Apply All Manifests
Section titled “7. Apply All Manifests”kubectl apply -f mongo.yamlkubectl apply -f core.yamlkubectl apply -f ui.yamlkubectl apply -f ingress.yamlTLS/HTTPS Configuration
Section titled “TLS/HTTPS Configuration”With Docker Compose (nginx reverse proxy)
Section titled “With Docker Compose (nginx reverse proxy)”Add an nginx service to your compose file:
nginx: image: nginx:alpine ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf:ro - ./certs:/etc/nginx/certs:ro depends_on: - core - uiWith Kubernetes
Section titled “With Kubernetes”Use cert-manager for automatic TLS:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/latest/download/cert-manager.yamlThen create a ClusterIssuer for Let’s Encrypt and reference it in the Ingress annotation as shown above.
Database Backup and Recovery
Section titled “Database Backup and Recovery”Backup
Section titled “Backup”# Docker Composedocker compose exec mongo mongodump --out /data/backupdocker compose cp mongo:/data/backup ./backup-$(date +%Y%m%d)
# Kuberneteskubectl exec -n kubeorch mongo-0 -- mongodump --out /data/backupkubectl cp kubeorch/mongo-0:/data/backup ./backup-$(date +%Y%m%d)Restore
Section titled “Restore”# Docker Composedocker compose cp ./backup mongo:/data/backupdocker compose exec mongo mongorestore /data/backup
# Kuberneteskubectl cp ./backup kubeorch/mongo-0:/data/backupkubectl exec -n kubeorch mongo-0 -- mongorestore /data/backupAutomated Backups
Section titled “Automated Backups”For production, schedule regular backups using a CronJob:
apiVersion: batch/v1kind: CronJobmetadata: name: mongo-backup namespace: kubeorchspec: schedule: "0 2 * * *" # Daily at 2 AM jobTemplate: spec: template: spec: containers: - name: backup image: mongo:7 command: - mongodump - --uri=mongodb://mongo:27017/kubeorch - --out=/backup/$(date +\%Y\%m\%d) volumeMounts: - name: backup mountPath: /backup volumes: - name: backup persistentVolumeClaim: claimName: backup-pvc restartPolicy: OnFailureEnvironment Variables Reference
Section titled “Environment Variables Reference”See the Configuration page for all available environment variables.