From a66bad33e2dbd100afc72763f5b20f6225f22702 Mon Sep 17 00:00:00 2001 From: Clawdbot Date: Fri, 30 Jan 2026 11:22:32 +0000 Subject: [PATCH] deploy: initContainer openclaw setup + run gateway as command --- manifests/deployment.yaml | 52 ++++++++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 9 deletions(-) diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml index 972f5d5..6c63c8e 100644 --- a/manifests/deployment.yaml +++ b/manifests/deployment.yaml @@ -16,27 +16,61 @@ spec: app.kubernetes.io/name: openclaw spec: serviceAccountName: openclaw - containers: - - name: openclaw + + # First-run bootstrap: + # `openclaw` with no args just prints help and exits. + # We run a one-time, non-interactive initializer to create the state dir + config on the PVC. + initContainers: + - name: openclaw-setup image: default-route-openshift-image-registry.apps.lab.apilab.us/openclaw/openclaw:latest imagePullPolicy: Always - ports: - - name: http - containerPort: 18789 env: - # Keep caches out of $HOME under restricted SCC + - name: HOME + value: /home/node - name: NPM_CONFIG_CACHE value: /tmp/npm-cache - name: XDG_CACHE_HOME value: /tmp - # OpenClaw docs default to /home/node in containers; persist it. - - name: HOME - value: /home/node + command: ["/bin/sh","-lc"] + args: + - | + set -eu + mkdir -p /home/node + if [ ! -f /home/node/.openclaw/openclaw.json ]; then + echo "No openclaw config found; running 'openclaw setup'..." + openclaw setup + else + echo "openclaw config already present; skipping setup." + fi volumeMounts: - name: home mountPath: /home/node - name: tmp mountPath: /tmp + + containers: + - name: openclaw + image: default-route-openshift-image-registry.apps.lab.apilab.us/openclaw/openclaw:latest + imagePullPolicy: Always + # Run the Gateway daemon in-cluster. + command: ["openclaw"] + args: ["gateway","--port","18789","--bind","0.0.0.0"] + ports: + - name: http + containerPort: 18789 + env: + - name: HOME + value: /home/node + - name: NPM_CONFIG_CACHE + value: /tmp/npm-cache + - name: XDG_CACHE_HOME + value: /tmp + volumeMounts: + - name: home + mountPath: /home/node + - name: tmp + mountPath: /tmp + volumes: - name: home persistentVolumeClaim: