Files
home-docker/home-apps/moltbot.yaml
T
2026-01-30 13:38:49 +11:00

265 lines
6.8 KiB
YAML

apiVersion: v1
kind: PersistentVolume
metadata:
name: moltbot-config-local-pv
labels:
type: local
name: moltbot-config
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: /mnt/k8s/moltbot/config
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- server-3
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: home-apps
name: moltbot-config-local-pvc
spec:
volumeName: moltbot-config-local-pv
storageClassName: "local-storage"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: moltbot-workspace-local-pv
labels:
type: local
name: moltbot-workspace
spec:
capacity:
storage: 10Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Delete
storageClassName: local-storage
local:
path: /mnt/k8s/moltbot/workspace
nodeAffinity:
required:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values:
- server-3
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: home-apps
name: moltbot-workspace-local-pvc
spec:
volumeName: moltbot-workspace-local-pv
storageClassName: "local-storage"
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
---
apiVersion: v1
kind: Secret
metadata:
name: moltbot-credentials
namespace: home-apps
type: Opaque
stringData:
gateway-token: "96101b63fec7789ef14e4691d30745c2a329170aa165f8dbe3174407ca61aefa" # Generate with: openssl rand -hex 32
# Optional: Claude AI credentials (NOT REQUIRED - can configure any provider later)
# Supported providers: OpenRouter, Google Gemini, OpenAI, Anthropic, Venice AI, Ollama, etc.
# Configure via: kubectl exec -it deployment/moltbot-gateway -n home-apps -- node dist/index.js onboard
# Or edit config at: /home/node/.clawdbot/moltbot.json with model like:
# { "agents": { "defaults": { "model": { "primary": "openrouter/google/gemini-2.0-flash-exp" } } } }
claude-ai-session-key: ""
claude-web-session-key: ""
claude-web-cookie: ""
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: moltbot-gateway
namespace: home-apps
labels:
app: moltbot-gateway
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
matchLabels:
app: moltbot-gateway
template:
metadata:
labels:
app: moltbot-gateway
name: moltbot-gateway
spec:
imagePullSecrets:
- name: github-image-pull-secret
containers:
- name: moltbot-gateway
image: ghcr.io/wahyd4/home-docker/moltbot:master-bab2f8a
imagePullPolicy: IfNotPresent
workingDir: /home/node
ports:
- containerPort: 18789
name: gateway
protocol: TCP
- containerPort: 18790
name: bridge
protocol: TCP
env:
- name: HOME
value: "/home/node"
- name: TERM
value: "xterm-256color"
- name: PATH
value: "/usr/local/bin:/usr/bin:/bin"
- name: CLAWDBOT_GATEWAY_BIND
value: "0.0.0.0"
- name: CLAWDBOT_GATEWAY_TOKEN
valueFrom:
secretKeyRef:
name: moltbot-credentials
key: gateway-token
- name: CLAUDE_AI_SESSION_KEY
valueFrom:
secretKeyRef:
name: moltbot-credentials
key: claude-ai-session-key
optional: true
- name: CLAUDE_WEB_SESSION_KEY
valueFrom:
secretKeyRef:
name: moltbot-credentials
key: claude-web-session-key
optional: true
- name: CLAUDE_WEB_COOKIE
valueFrom:
secretKeyRef:
name: moltbot-credentials
key: claude-web-cookie
optional: true
volumeMounts:
- name: config
mountPath: "/home/node/.clawdbot"
- name: workspace
mountPath: "/home/node/clawd"
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: 2000m
memory: 2Gi
# Use exec probes that run INSIDE the container to reach localhost
livenessProbe:
exec:
command:
- /bin/sh
- -c
- "curl -sf http://127.0.0.1:18789/ || exit 1"
initialDelaySeconds: 30
periodSeconds: 30
timeoutSeconds: 10
failureThreshold: 3
readinessProbe:
exec:
command:
- /bin/sh
- -c
- "curl -sf http://127.0.0.1:18789/ || exit 1"
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 10
failureThreshold: 6
volumes:
- name: config
persistentVolumeClaim:
claimName: moltbot-config-local-pvc
- name: workspace
persistentVolumeClaim:
claimName: moltbot-workspace-local-pvc
---
apiVersion: v1
kind: Service
metadata:
name: moltbot-gateway
namespace: home-apps
labels:
name: moltbot-gateway
spec:
type: ClusterIP
selector:
app: moltbot-gateway
ports:
- name: gateway
targetPort: gateway
port: 18789
protocol: TCP
- name: bridge
targetPort: bridge
port: 18790
protocol: TCP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: moltbot-gateway-ingress
namespace: home-apps
annotations:
cert-manager.io/cluster-issuer: "letsencrypt-prod"
# WebSocket support - required for moltbot gateway
nginx.ingress.kubernetes.io/proxy-http-version: "1.1"
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
# Enable WebSocket upgrade via standard nginx-ingress annotation
nginx.ingress.kubernetes.io/websocket-services: "moltbot-gateway"
# Note: OAuth2 removed - moltbot uses its own gateway token authentication
spec:
ingressClassName: nginx
tls:
- hosts:
- moltbot.junv.cc
secretName: moltbot-gateway-tls
rules:
- host: moltbot.junv.cc
http:
paths:
- backend:
service:
name: moltbot-gateway
port:
number: 18789
path: /
pathType: Prefix