From dc54f6072890520bf8cb1334ba1d487e4d155bf6 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 18:27:39 +0800 Subject: [PATCH 01/25] pre-install openclaw plugin --- docker_openclaw/demo/docker-compose.yml | 20 +- docker_openclaw/openclaw.Dockerfile | 13 +- .../work/openclaw-plugin-installer.js | 368 ------------------ docker_openclaw/work/script-setup-openclaw.sh | 43 ++ docker_openclaw/work/start-openclaw.sh | 27 +- 5 files changed, 68 insertions(+), 403 deletions(-) delete mode 100644 docker_openclaw/work/openclaw-plugin-installer.js create mode 100644 docker_openclaw/work/script-setup-openclaw.sh diff --git a/docker_openclaw/demo/docker-compose.yml b/docker_openclaw/demo/docker-compose.yml index e7cc0f1..57e6ed6 100644 --- a/docker_openclaw/demo/docker-compose.yml +++ b/docker_openclaw/demo/docker-compose.yml @@ -4,7 +4,7 @@ services: openclaw-gateway: container_name: svc-openclaw-gateway hostname: svc-openclaw-gateway - image: "quay.io/labnow0dev/openclaw:latest" + image: "quay.io/labnow/openclaw:latest" pull_policy: if_not_present restart: unless-stopped environment: @@ -16,20 +16,4 @@ services: - "${OPENCLAW_GATEWAY_PORT:-18789}:18789" - "${OPENCLAW_BRIDGE_PORT:-18790}:18790" init: true - - openclaw-cli: - container_name: svc-openclaw-cli - hostname: svc-openclaw-cli - image: "quay.io/labnow0dev/openclaw:latest" - pull_policy: if_not_present - restart: "no" - environment: - - TZ=Asia/Shanghai - - PROFILE_LOCALIZE=aliyun-pub - - BROWSER=echo - volumes: - - /data/openclaw:/opt/openclaw/data - init: true - stdin_open: true - tty: true - entrypoint: ["node", "openclaw.mjs"] + # command: ["tail", "-f", "/dev/null"] diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index c569dd2..c323b67 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -7,14 +7,13 @@ FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} LABEL maintainer="postmaster@labnow.ai" ENV NODE_ENV=production ENV PNPM_HOME=/opt/node/pnpm -ENV PNPM_STORE_DIR=/opt/node/pnpm-store -ENV PNPM_NODE_LINKER=hoisted +ENV NPM_CONFIG_NODE_LINKER=hoisted ENV PATH="${PNPM_HOME}:${PATH}" COPY work /opt/openclaw/ RUN set -eux && source /opt/utils/script-setup.sh \ - && chmod +x /opt/openclaw/start-openclaw.sh && ln -sf /opt/openclaw/start-openclaw.sh /usr/local/bin/ \ + && chmod +x /opt/openclaw/*.sh && ln -sf /opt/openclaw/start-openclaw.sh /usr/local/bin/ \ && mkdir -pv /opt/openclaw/data \ && ln -sfn /opt/openclaw/data /opt/openclaw/.openclaw \ ## curl -fsSL https://openclaw.ai/install.sh | NO_PROMPT=1 bash -s -- --no-onboard --install-method npm \ @@ -26,8 +25,16 @@ RUN set -eux && source /opt/utils/script-setup.sh \ ## Clean up and display components version information... && list_installed_packages && install__clean +RUN set -euo pipefail && source /opt/utils/script-utils.sh \ + && source /opt/utils/script-setup-openclaw.sh \ + && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ + ## Clean up and display components version information... + && pnpm store prune --store-dir "$PNPM_STORE" || true \ + && list_installed_packages && install__clean + ENV HOME=/opt/openclaw/ ENV XDG_CONFIG_HOME=/opt/openclaw/data +ENV OPENCLAW_HIDE_BANNER=1 WORKDIR /opt/openclaw VOLUME ["/opt/openclaw/data"] EXPOSE 18789 18790 diff --git a/docker_openclaw/work/openclaw-plugin-installer.js b/docker_openclaw/work/openclaw-plugin-installer.js deleted file mode 100644 index b5bcdcd..0000000 --- a/docker_openclaw/work/openclaw-plugin-installer.js +++ /dev/null @@ -1,368 +0,0 @@ -#!/usr/bin/env node -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const { spawnSync } = require('child_process'); - -function buildDefaultConfig() { - return { - agents: { - defaults: { - workspace: '/opt/openclaw/data/workspace' - } - }, - channels: { - feishu: { - enabled: true, - appId: '', - appSecret: '', - domain: 'feishu', - connectionMode: 'websocket', - requireMention: true, - dmPolicy: 'pairing', - groupPolicy: 'open', - allowFrom: [], - groupAllowFrom: [] - } - }, - gateway: { - controlUi: { - dangerouslyAllowHostHeaderOriginFallback: true, - dangerouslyDisableDeviceAuth: true - } - } - }; -} - -function parseArgs(argv) { - const args = { _: [] }; - for (let i = 0; i < argv.length; i += 1) { - const token = argv[i]; - if (!token.startsWith('--')) { - args._.push(token); - continue; - } - - const eqIndex = token.indexOf('='); - if (eqIndex > -1) { - const key = token.slice(2, eqIndex); - const value = token.slice(eqIndex + 1); - args[key] = value; - continue; - } - - const key = token.slice(2); - const next = argv[i + 1]; - if (!next || next.startsWith('--')) { - args[key] = true; - continue; - } - - args[key] = next; - i += 1; - } - - return args; -} - -function parseCommaList(value) { - if (!value || value === true) return []; - return String(value) - .split(',') - .map((item) => item.trim()) - .filter(Boolean); -} - -function pluginIdFromPackage(packageName) { - return packageName.split('/').pop(); -} - -function ensureConfigShape(config) { - if (!config.plugins) config.plugins = {}; - if (!Array.isArray(config.plugins.allow)) config.plugins.allow = []; - if (!config.plugins.entries) config.plugins.entries = {}; -} - -function loadConfig(configPath) { - const raw = fs.readFileSync(configPath, 'utf8'); - return JSON.parse(raw); -} - -function saveConfig(configPath, config) { - fs.writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`, 'utf8'); -} - -function ensureConfigFile(configPath) { - fs.mkdirSync(path.dirname(configPath), { recursive: true }); - if (fs.existsSync(configPath) && fs.statSync(configPath).size > 0) { - return; - } - saveConfig(configPath, buildDefaultConfig()); -} - -function mergeDefaultConfig(configPath) { - const config = loadConfig(configPath); - - if (!config.agents) config.agents = {}; - if (!config.agents.defaults) config.agents.defaults = {}; - if (!config.agents.defaults.workspace) { - config.agents.defaults.workspace = '/opt/openclaw/data/workspace'; - } - - if (!config.gateway) config.gateway = {}; - if (!config.gateway.controlUi) config.gateway.controlUi = {}; - if (typeof config.gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback !== 'boolean') { - config.gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback = true; - } - if (typeof config.gateway.controlUi.dangerouslyDisableDeviceAuth !== 'boolean') { - config.gateway.controlUi.dangerouslyDisableDeviceAuth = true; - } - - saveConfig(configPath, config); -} - -function runOpenclawInstall(packageName, env) { - const result = spawnSync('openclaw', ['plugins', 'install', packageName], { - encoding: 'utf8', - env - }); - - if (result.stdout) process.stdout.write(result.stdout); - if (result.stderr) process.stderr.write(result.stderr); - - if (result.status === 0) { - return { ok: true, alreadyExists: false }; - } - - const output = `${result.stdout || ''}\n${result.stderr || ''}`; - if (output.includes('plugin already exists')) { - return { ok: true, alreadyExists: true }; - } - - const err = new Error(`Command failed: openclaw plugins install ${packageName}`); - err.status = result.status; - err.output = output; - throw err; -} - -function safeRemove(targetPath) { - if (!fs.existsSync(targetPath)) return; - const stat = fs.lstatSync(targetPath); - if (stat.isDirectory() && !stat.isSymbolicLink()) { - fs.rmSync(targetPath, { recursive: true, force: true }); - } else { - fs.unlinkSync(targetPath); - } -} - -function isSelfReferencingSymlink(targetPath) { - try { - const stat = fs.lstatSync(targetPath); - if (!stat.isSymbolicLink()) return false; - const linkValue = fs.readlinkSync(targetPath); - const resolved = path.resolve(path.dirname(targetPath), linkValue); - return resolved === path.resolve(targetPath); - } catch (_err) { - return false; - } -} - -function ensurePluginAtTarget(options) { - const { homeClaw, stateDir, extensionsDir, pluginDirName } = options; - const targetPath = path.join(extensionsDir, pluginDirName); - const resolvedTargetPath = path.resolve(targetPath); - - if (isSelfReferencingSymlink(targetPath)) { - safeRemove(targetPath); - } - - if (fs.existsSync(targetPath)) { - return targetPath; - } - - const candidates = [ - path.join(stateDir, 'extensions', pluginDirName), - path.join(homeClaw, 'extensions', pluginDirName), - ]; - - const actualPath = candidates.find((candidate) => fs.existsSync(candidate)); - if (!actualPath) { - return ''; - } - const resolvedActualPath = path.resolve(actualPath); - if (resolvedActualPath === resolvedTargetPath) { - return targetPath; - } - - fs.mkdirSync(path.dirname(targetPath), { recursive: true }); - - try { - fs.renameSync(actualPath, targetPath); - } catch (err) { - if (!err || err.code !== 'EXDEV') throw err; - fs.cpSync(actualPath, targetPath, { recursive: true }); - safeRemove(actualPath); - } - - return targetPath; -} - -function applyInstallConfig(configPath, pluginId) { - const config = loadConfig(configPath); - ensureConfigShape(config); - - if (!config.plugins.allow.includes(pluginId)) { - config.plugins.allow.push(pluginId); - } - config.plugins.entries[pluginId] = { enabled: true }; - - saveConfig(configPath, config); -} - -function applyDisableConfig(configPath, entryIds) { - const config = loadConfig(configPath); - ensureConfigShape(config); - - for (const entryId of entryIds) { - config.plugins.entries[entryId] = { enabled: false }; - } - - saveConfig(configPath, config); -} - -function installCommand(args) { - const packageName = args.package; - const configPath = args.config; - const homeClaw = path.resolve(args.home || '/opt/openclaw'); - const stateDir = path.resolve(args['state-dir'] || path.dirname(configPath || '')); - const extensionsDir = path.resolve(args['extensions-dir'] || path.join(stateDir, 'extensions')); - const pluginId = args.id || pluginIdFromPackage(packageName || ''); - const pluginDirName = args['plugin-dir'] || pluginId; - const forceInstall = Boolean(args.force); - - if (!packageName || !configPath) { - throw new Error('Missing required args: --package, --config'); - } - - ensureConfigFile(configPath); - mergeDefaultConfig(configPath); - - fs.mkdirSync(stateDir, { recursive: true }); - fs.mkdirSync(extensionsDir, { recursive: true }); - - const targetPath = path.join(extensionsDir, pluginDirName); - const installEnv = { - ...process.env, - XDG_CONFIG_HOME: stateDir, - OPENCLAW_DIR_STATE: stateDir, - }; - - if (forceInstall || !fs.existsSync(targetPath)) { - console.log(`[plugin-installer] Installing ${packageName} ...`); - const result = runOpenclawInstall(packageName, installEnv); - if (result.alreadyExists) { - console.log(`[plugin-installer] ${pluginId} already exists, treat as idempotent success.`); - } - } else { - console.log(`[plugin-installer] ${pluginId} already exists at ${targetPath}, skip install.`); - } - - const finalPath = ensurePluginAtTarget({ homeClaw, stateDir, extensionsDir, pluginDirName }); - if (!finalPath) { - console.warn(`[plugin-installer] WARN: unable to locate installed plugin ${pluginId}.`); - } else { - console.log(`[plugin-installer] plugin path: ${finalPath}`); - } - - applyInstallConfig(configPath, pluginId); - console.log(`[plugin-installer] ${packageName} install flow completed.`); -} - -function disableCommand(args) { - const configPath = args.config; - const entryIds = parseCommaList(args.entry || args.entries); - - if (!configPath || entryIds.length === 0) { - throw new Error('Missing required args: --config, --entry '); - } - - ensureConfigFile(configPath); - mergeDefaultConfig(configPath); - applyDisableConfig(configPath, entryIds); - console.log(`[plugin-installer] disabled entries: ${entryIds.join(', ')}`); -} - -function initConfigCommand(args) { - const configPath = args.config; - if (!configPath) { - throw new Error('Missing required args: --config'); - } - - ensureConfigFile(configPath); - mergeDefaultConfig(configPath); - console.log(`[plugin-installer] config ready: ${configPath}`); -} - -function printHelp() { - console.log(`Usage: - node openclaw-plugin-installer.js [options] - -Commands: - init-config Ensure config file exists and apply default base settings - install Install plugin package and enable corresponding plugin entry - disable Disable plugin entries in config - -Common options: - --config OpenClaw config path - -Install options: - --package NPM package, e.g. @larksuite/openclaw-lark - --id Optional plugin id (default: package basename) - --home OpenClaw home (default: /opt/openclaw) - --state-dir State dir (default: dirname(--config)) - --extensions-dir Extensions dir (default: /extensions) - --plugin-dir Plugin directory name (default: plugin id) - --force Force install even if target plugin dir exists - -Disable options: - --entry Comma separated plugin entry ids to disable -`); -} - -function main() { - const args = parseArgs(process.argv.slice(2)); - const command = args._[0]; - - if (!command || command === 'help' || command === '--help') { - printHelp(); - process.exit(command ? 0 : 1); - } - - if (command === 'init-config') { - initConfigCommand(args); - return; - } - - if (command === 'install') { - installCommand(args); - return; - } - - if (command === 'disable') { - disableCommand(args); - return; - } - - throw new Error(`Unsupported command: ${command}`); -} - -try { - main(); -} catch (err) { - console.error(`[plugin-installer] ${err.message}`); - if (err.output) { - console.error(err.output); - } - process.exit(1); -} diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh new file mode 100644 index 0000000..4b505cf --- /dev/null +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +PLUGINS_ROOT=/opt/openclaw/plugins +PNPM_STORE=${PNPM_HOME:-"/opt/node/pnpm"}/store + +verify_plugin_manifest() { + local dest="$1" + echo "[INFO] Verifying plugin manifest in $dest ..." + if [[ ! -f "$dest/openclaw.plugin.json" ]]; then + if ! node -e "const p=require('$dest/package.json'); process.exit(p.openclaw ? 0 : 1)" 2>/dev/null; then + echo "[ERROR] $dest has neither openclaw.plugin.json nor openclaw field in package.json!" >&2 + return 1 + fi + fi + echo "[OK] Manifest verified at $dest" +} + +install_plugin() { + mkdir -pv "$PLUGINS_ROOT" "$PNPM_STORE" + local npm_spec="$1" + local plugin_id="$2" + + local dest="$PLUGINS_ROOT/$plugin_id" + mkdir -p "$dest" + + echo "[INFO] Packing $npm_spec ..." + local tarball + tarball=$(npm pack "$npm_spec" --pack-destination /tmp/ 2>/dev/null | tail -1) + + echo "[INFO] Extracting to $dest ..." + tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" + rm -f "/tmp/$tarball" + + echo "[INFO] Installing deps (shared pnpm store) ..." + pnpm install \ + --dir "$dest" \ + --store-dir "$PNPM_STORE" \ + --ignore-scripts \ + --prod \ + --no-frozen-lockfile + + verify_plugin_manifest "$dest" || exit 1 + echo "[OK] Plugin $plugin_id ready at $dest" +} diff --git a/docker_openclaw/work/start-openclaw.sh b/docker_openclaw/work/start-openclaw.sh index 166d185..3d226bd 100644 --- a/docker_openclaw/work/start-openclaw.sh +++ b/docker_openclaw/work/start-openclaw.sh @@ -1,23 +1,22 @@ #!/bin/sh set -eu -export OPENCLAW_HOME="${OPENCLAW_HOME:-/opt/openclaw}" -export OPENCLAW_DIR_STATE="${OPENCLAW_DIR_STATE:-${XDG_CONFIG_HOME:-$OPENCLAW_HOME/data}}" -export OPENCLAW_CONFIG="${OPENCLAW_CONFIG:-$OPENCLAW_DIR_STATE/openclaw.json}" - -export OPENCLAW_HIDE_BANNER=1 - bootstrap() { - mkdir -pv "${OPENCLAW_DIR_STATE}" "$(dirname "${OPENCLAW_CONFIG}")" - - local PATH_PLUGIN_INSTALLER="${OPENCLAW_PLUGIN_INSTALLER:-$OPENCLAW_HOME/openclaw-plugin-installer.js}" - local CLAW_EXEC="node ${PATH_PLUGIN_INSTALLER} --config ${OPENCLAW_CONFIG}" + . /opt/openclaw/script-setup-openclaw.sh + + openclaw config set plugins.load.paths "[\"$PLUGINS_ROOT\"]" - $CLAW_EXEC init-config - openclaw config set skills.install.nodeManager pnpm + for name in /opt/openclaw/plugins/*/; do + name=$(basename "$name") + if verify_plugin_manifest "$PLUGINS_ROOT/$name"; then + openclaw config set "plugins.entries.${name}.enabled" true + else + echo "[WARN] Skipping $name: invalid or missing plugin manifest" >&2 + fi + done - $CLAW_EXEC disable --entry "feishu" - $CLAW_EXEC install --package "@larksuite/openclaw-lark" + openclaw config set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback true + openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true } /opt/utils/script-localize.sh "${PROFILE_LOCALIZE:-default}" From 73ca252a3a3c6ed5d8fe8a813dfd80d0df934dc1 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 18:28:34 +0800 Subject: [PATCH 02/25] typo --- docker_openclaw/openclaw.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index c323b67..ee7c689 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -26,7 +26,7 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && list_installed_packages && install__clean RUN set -euo pipefail && source /opt/utils/script-utils.sh \ - && source /opt/utils/script-setup-openclaw.sh \ + && source /opt/openclaw/script-setup-openclaw.sh \ && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ ## Clean up and display components version information... && pnpm store prune --store-dir "$PNPM_STORE" || true \ From 3944c3db43573be99d6477ca3123802ed6239548 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 19:29:02 +0800 Subject: [PATCH 03/25] debug build --- docker_openclaw/demo/docker-compose.yml | 1 + docker_openclaw/openclaw.Dockerfile | 16 +++++++--------- docker_openclaw/work/script-setup-openclaw.sh | 10 +++++----- docker_openclaw/work/start-openclaw.sh | 2 ++ 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/docker_openclaw/demo/docker-compose.yml b/docker_openclaw/demo/docker-compose.yml index 57e6ed6..58ef39b 100644 --- a/docker_openclaw/demo/docker-compose.yml +++ b/docker_openclaw/demo/docker-compose.yml @@ -10,6 +10,7 @@ services: environment: - TZ=Asia/Shanghai - PROFILE_LOCALIZE=aliyun-pub + - OPENCLAW_GATEWAY_TOKEN=openclaw volumes: - /data/openclaw:/opt/openclaw/data ports: diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index ee7c689..08ce086 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -7,8 +7,9 @@ FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} LABEL maintainer="postmaster@labnow.ai" ENV NODE_ENV=production ENV PNPM_HOME=/opt/node/pnpm -ENV NPM_CONFIG_NODE_LINKER=hoisted -ENV PATH="${PNPM_HOME}:${PATH}" +ENV PNPM_STORE=/opt/node/pnpm/store +ENV OPENCLAW_HOME=/opt/openclaw +ENV PATH="${PNPM_HOME}:${OPENCLAW_HOME}:${PATH}" COPY work /opt/openclaw/ @@ -20,17 +21,14 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ - && pnpm install -g openclaw@latest --ignore-scripts=false \ - && openclaw --version \ - ## Clean up and display components version information... - && list_installed_packages && install__clean + && pnpm install --prod -g openclaw@latest --ignore-scripts=false \ + && ( pnpm store prune --store-dir "$PNPM_STORE" || true ) && rm -rf "$PNPM_STORE" && install__clean \ + && openclaw --version RUN set -euo pipefail && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ - ## Clean up and display components version information... - && pnpm store prune --store-dir "$PNPM_STORE" || true \ - && list_installed_packages && install__clean + && ( pnpm store prune --store-dir "$PNPM_STORE" || true ) && rm -rf "$PNPM_STORE" && install__clean ENV HOME=/opt/openclaw/ ENV XDG_CONFIG_HOME=/opt/openclaw/data diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 4b505cf..741e81e 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -1,6 +1,5 @@ #!/usr/bin/env bash -PLUGINS_ROOT=/opt/openclaw/plugins -PNPM_STORE=${PNPM_HOME:-"/opt/node/pnpm"}/store +OPENCLAW_PLUGINS_ROOT=${OPENCLAW_HOME:-"/opt/openclaw"}/plugins verify_plugin_manifest() { local dest="$1" @@ -15,11 +14,11 @@ verify_plugin_manifest() { } install_plugin() { - mkdir -pv "$PLUGINS_ROOT" "$PNPM_STORE" + mkdir -pv "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" local npm_spec="$1" local plugin_id="$2" - local dest="$PLUGINS_ROOT/$plugin_id" + local dest="$OPENCLAW_PLUGINS_ROOT/$plugin_id" mkdir -p "$dest" echo "[INFO] Packing $npm_spec ..." @@ -34,7 +33,8 @@ install_plugin() { pnpm install \ --dir "$dest" \ --store-dir "$PNPM_STORE" \ - --ignore-scripts \ + --virtual-store-dir "$dest/node_modules/.pnpm" \ + --ignore-scripts=false \ --prod \ --no-frozen-lockfile diff --git a/docker_openclaw/work/start-openclaw.sh b/docker_openclaw/work/start-openclaw.sh index 3d226bd..8b09564 100644 --- a/docker_openclaw/work/start-openclaw.sh +++ b/docker_openclaw/work/start-openclaw.sh @@ -17,6 +17,8 @@ bootstrap() { openclaw config set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback true openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true + openclaw config set gateway.auth.mode token + openclaw config set gateway.auth.token "${OPENCLAW_GATEWAY_TOKEN:-"openclaw"}" } /opt/utils/script-localize.sh "${PROFILE_LOCALIZE:-default}" From 97e800128006c2443b8d619c255b9a87b72949c2 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 20:24:34 +0800 Subject: [PATCH 04/25] debug --- docker_openclaw/work/script-setup-openclaw.sh | 16 +++------------- docker_openclaw/work/start-openclaw.sh | 4 ++-- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 741e81e..32a1695 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -13,27 +13,17 @@ verify_plugin_manifest() { echo "[OK] Manifest verified at $dest" } -install_plugin() { - mkdir -pv "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" +install_plugin() { local npm_spec="$1" local plugin_id="$2" - local dest="$OPENCLAW_PLUGINS_ROOT/$plugin_id" - mkdir -p "$dest" - - echo "[INFO] Packing $npm_spec ..." - local tarball - tarball=$(npm pack "$npm_spec" --pack-destination /tmp/ 2>/dev/null | tail -1) - echo "[INFO] Extracting to $dest ..." - tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" - rm -f "/tmp/$tarball" + mkdir -pv "$dest" "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" echo "[INFO] Installing deps (shared pnpm store) ..." - pnpm install \ + pnpm add $npm_spec \ --dir "$dest" \ --store-dir "$PNPM_STORE" \ - --virtual-store-dir "$dest/node_modules/.pnpm" \ --ignore-scripts=false \ --prod \ --no-frozen-lockfile diff --git a/docker_openclaw/work/start-openclaw.sh b/docker_openclaw/work/start-openclaw.sh index 8b09564..88eab8b 100644 --- a/docker_openclaw/work/start-openclaw.sh +++ b/docker_openclaw/work/start-openclaw.sh @@ -4,11 +4,11 @@ set -eu bootstrap() { . /opt/openclaw/script-setup-openclaw.sh - openclaw config set plugins.load.paths "[\"$PLUGINS_ROOT\"]" + openclaw config set plugins.load.paths "[\"$OPENCLAW_PLUGINS_ROOT\"]" for name in /opt/openclaw/plugins/*/; do name=$(basename "$name") - if verify_plugin_manifest "$PLUGINS_ROOT/$name"; then + if verify_plugin_manifest "$OPENCLAW_PLUGINS_ROOT/$name"; then openclaw config set "plugins.entries.${name}.enabled" true else echo "[WARN] Skipping $name: invalid or missing plugin manifest" >&2 From 88e796b8806725b884687e90daae2a22e2385c0e Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 20:24:51 +0800 Subject: [PATCH 05/25] optimize install --- docker_openclaw/openclaw.Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 08ce086..e50204c 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -21,14 +21,14 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ - && pnpm install --prod -g openclaw@latest --ignore-scripts=false \ - && ( pnpm store prune --store-dir "$PNPM_STORE" || true ) && rm -rf "$PNPM_STORE" && install__clean \ + && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version RUN set -euo pipefail && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ - && ( pnpm store prune --store-dir "$PNPM_STORE" || true ) && rm -rf "$PNPM_STORE" && install__clean + ## clean up + && install__clean ENV HOME=/opt/openclaw/ ENV XDG_CONFIG_HOME=/opt/openclaw/data From 27a8ee29a40199d27dda49c459f96bfff93f0d6d Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 20:32:03 +0800 Subject: [PATCH 06/25] debug build --- docker_openclaw/work/script-setup-openclaw.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 32a1695..2fc03b7 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -25,8 +25,7 @@ install_plugin() { --dir "$dest" \ --store-dir "$PNPM_STORE" \ --ignore-scripts=false \ - --prod \ - --no-frozen-lockfile + --prod verify_plugin_manifest "$dest" || exit 1 echo "[OK] Plugin $plugin_id ready at $dest" From 29b07eba0d3aab8b311aac09eed7d38ebf554151 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 20:32:19 +0800 Subject: [PATCH 07/25] debug pnpm --- docker_openclaw/openclaw.Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index e50204c..8e67aa0 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -21,6 +21,11 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ + && echo 'onlyBuiltDependencies[]=@matrix-org/matrix-sdk-crypto-nodejs' >> /root/.npmrc \ + && echo 'onlyBuiltDependencies[]=koffi' >> /root/.npmrc \ + && echo 'onlyBuiltDependencies[]=openclaw' >> /root/.npmrc \ + && echo 'onlyBuiltDependencies[]=protobufjs' >> /root/.npmrc \ + && echo 'onlyBuiltDependencies[]=sharp' >> /root/.npmrc \ && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version From b97f60c80a9e57a2577a37f953543088b96daa59 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 20:36:29 +0800 Subject: [PATCH 08/25] debug pnpm scripts --- docker_openclaw/work/script-setup-openclaw.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 2fc03b7..cf1ae60 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -27,6 +27,6 @@ install_plugin() { --ignore-scripts=false \ --prod - verify_plugin_manifest "$dest" || exit 1 + verify_plugin_manifest "$dest" || return 2 echo "[OK] Plugin $plugin_id ready at $dest" } From 11390d8d8a7ad563a6a2744f95eb1e2eb02d1f41 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 20:36:36 +0800 Subject: [PATCH 09/25] debug --- docker_openclaw/openclaw.Dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 8e67aa0..4182f37 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -21,11 +21,11 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ - && echo 'onlyBuiltDependencies[]=@matrix-org/matrix-sdk-crypto-nodejs' >> /root/.npmrc \ - && echo 'onlyBuiltDependencies[]=koffi' >> /root/.npmrc \ - && echo 'onlyBuiltDependencies[]=openclaw' >> /root/.npmrc \ - && echo 'onlyBuiltDependencies[]=protobufjs' >> /root/.npmrc \ - && echo 'onlyBuiltDependencies[]=sharp' >> /root/.npmrc \ + && echo 'onlyBuiltDependencies[]=@matrix-org/matrix-sdk-crypto-nodejs' >> ~/.npmrc \ + && echo 'onlyBuiltDependencies[]=koffi' >> ~/.npmrc \ + && echo 'onlyBuiltDependencies[]=openclaw' >> ~/.npmrc \ + && echo 'onlyBuiltDependencies[]=protobufjs' >> ~/.npmrc \ + && echo 'onlyBuiltDependencies[]=sharp' >> ~/.npmrc \ && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version From 1d8fd394c33b4c1605399760227ff6824f7bd005 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 12:48:58 +0000 Subject: [PATCH 10/25] debug --- docker_openclaw/openclaw.Dockerfile | 2 +- docker_openclaw/work/script-setup-openclaw.sh | 2 +- tool.sh | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 4182f37..98ed0dc 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -10,6 +10,7 @@ ENV PNPM_HOME=/opt/node/pnpm ENV PNPM_STORE=/opt/node/pnpm/store ENV OPENCLAW_HOME=/opt/openclaw ENV PATH="${PNPM_HOME}:${OPENCLAW_HOME}:${PATH}" +ENV HOME=/opt/openclaw/ COPY work /opt/openclaw/ @@ -35,7 +36,6 @@ RUN set -euo pipefail && source /opt/utils/script-utils.sh \ ## clean up && install__clean -ENV HOME=/opt/openclaw/ ENV XDG_CONFIG_HOME=/opt/openclaw/data ENV OPENCLAW_HIDE_BANNER=1 WORKDIR /opt/openclaw diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index cf1ae60..36c2bc1 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -27,6 +27,6 @@ install_plugin() { --ignore-scripts=false \ --prod - verify_plugin_manifest "$dest" || return 2 + # verify_plugin_manifest "$dest" || return 2 echo "[OK] Plugin $plugin_id ready at $dest" } diff --git a/tool.sh b/tool.sh index 804a990..473315d 100644 --- a/tool.sh +++ b/tool.sh @@ -25,30 +25,30 @@ echo "--------> DOCKER_TAG_SUFFIX=${TAG_SUFFIX}" build_image() { echo "$@" ; IMG=$1; TAG=$2; FILE=$3; shift 3; VER=$(date +%Y.%m%d.%H%M)${TAG_SUFFIX}; WORKDIR="$(dirname $FILE)"; - docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" >&2 - docker tag "${IMG_PREFIX_DST}/${IMG}:${TAG}" "${IMG_PREFIX_DST}/${IMG}:${VER}" >&2 + docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" + docker tag "${IMG_PREFIX_DST}/${IMG}:${TAG}" "${IMG_PREFIX_DST}/${IMG}:${VER}" echo "${IMG_PREFIX_DST}/${IMG}:${TAG}" } build_image_no_tag() { echo "$@" ; IMG=$1; TAG=$2; FILE=$3; shift 3; WORKDIR="$(dirname $FILE)"; - docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" >&2 + docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" echo "${IMG_PREFIX_DST}/${IMG}:${TAG}" } build_image_common() { echo "$@" ; IMG=$1; TAG=$2; FILE=$3; shift 3; VER=$(date +%Y.%m%d.%H%M)${TAG_SUFFIX}; WORKDIR="$(dirname $FILE)"; - docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" >&2 - docker tag "${IMG_PREFIX_DST}/${IMG}:${TAG}" "${IMG_PREFIX_DST}/${IMG}:${VER}" >&2 + docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" + docker tag "${IMG_PREFIX_DST}/${IMG}:${TAG}" "${IMG_PREFIX_DST}/${IMG}:${VER}" echo "${IMG_PREFIX_DST}/${IMG}:${TAG}" } alias_image() { IMG_1=$1; TAG_1=$2; IMG_2=$3; TAG_2=$4; shift 4; VER=$(date +%Y.%m%d.%H%M)${TAG_SUFFIX}; - docker tag "${IMG_PREFIX_DST}/${IMG_1}:${TAG_1}" "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" >&2 - docker tag "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" "${IMG_PREFIX_DST}/${IMG_2}:${VER}" >&2 + docker tag "${IMG_PREFIX_DST}/${IMG_1}:${TAG_1}" "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" + docker tag "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" "${IMG_PREFIX_DST}/${IMG_2}:${VER}" } push_image() { From a1e5c7296c755bec2b4d31ca2c08a0b8add82f02 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 13:02:13 +0000 Subject: [PATCH 11/25] debug build --- docker_openclaw/openclaw.Dockerfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 98ed0dc..407d5c6 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -22,11 +22,13 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ - && echo 'onlyBuiltDependencies[]=@matrix-org/matrix-sdk-crypto-nodejs' >> ~/.npmrc \ - && echo 'onlyBuiltDependencies[]=koffi' >> ~/.npmrc \ - && echo 'onlyBuiltDependencies[]=openclaw' >> ~/.npmrc \ - && echo 'onlyBuiltDependencies[]=protobufjs' >> ~/.npmrc \ - && echo 'onlyBuiltDependencies[]=sharp' >> ~/.npmrc \ + && NPMRC=$(pnpm config get globalconfig) \ + && echo 'onlyBuiltDependencies[]=@matrix-org/matrix-sdk-crypto-nodejs' >> "$NPMRC" \ + && echo 'onlyBuiltDependencies[]=koffi' >> "$NPMRC" \ + && echo 'onlyBuiltDependencies[]=openclaw' >> "$NPMRC" \ + && echo 'onlyBuiltDependencies[]=protobufjs' >> "$NPMRC" \ + && echo 'onlyBuiltDependencies[]=sharp' >> "$NPMRC" \ + && pnpm config list \ && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version @@ -34,7 +36,7 @@ RUN set -euo pipefail && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ ## clean up - && install__clean + && install__clean && ls -alh ~/ ENV XDG_CONFIG_HOME=/opt/openclaw/data ENV OPENCLAW_HIDE_BANNER=1 From b3c7397d38c8ab0877a9ef19280effc7c1409fdf Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 13:13:40 +0000 Subject: [PATCH 12/25] fix pnpm rc --- docker_openclaw/openclaw.Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 407d5c6..1b34887 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -28,6 +28,10 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && echo 'onlyBuiltDependencies[]=openclaw' >> "$NPMRC" \ && echo 'onlyBuiltDependencies[]=protobufjs' >> "$NPMRC" \ && echo 'onlyBuiltDependencies[]=sharp' >> "$NPMRC" \ + && GLOBAL_DIR=$(pnpm root -g | sed 's|/node_modules$||') \ + && mkdir -pv "$GLOBAL_DIR" \ + && echo '{"dependencies":{},"pnpm":{"onlyBuiltDependencies":["@matrix-org/matrix-sdk-crypto-nodejs","koffi","openclaw","protobufjs","sharp"]}}' \ + | tee "$GLOBAL_DIR/package.json" \ && pnpm config list \ && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version From 5a91282fa292d692b56a18a39e201fbc30927528 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 13:35:50 +0000 Subject: [PATCH 13/25] refactor: update Dockerfile and scripts for improved plugin installation and setup --- docker_openclaw/openclaw.Dockerfile | 7 +++++-- docker_openclaw/work/script-setup-openclaw.sh | 17 ++++++++++++++--- docker_openclaw/work/start-openclaw.sh | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 1b34887..ad8a57e 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -36,11 +36,14 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version -RUN set -euo pipefail && source /opt/utils/script-utils.sh \ +RUN set -eux && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ ## clean up - && install__clean && ls -alh ~/ + && install__clean \ + && rm -rf ~/.* \ + && ln -sfn /opt/openclaw/data /opt/openclaw/.openclaw \ + && ls -alh ~/ ENV XDG_CONFIG_HOME=/opt/openclaw/data ENV OPENCLAW_HIDE_BANNER=1 diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 36c2bc1..c05e594 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -1,4 +1,6 @@ #!/usr/bin/env bash +set -eu + OPENCLAW_PLUGINS_ROOT=${OPENCLAW_HOME:-"/opt/openclaw"}/plugins verify_plugin_manifest() { @@ -20,13 +22,22 @@ install_plugin() { mkdir -pv "$dest" "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" + echo "[INFO] Packing $npm_spec ..." + local tarball + tarball=$(npm pack "$npm_spec" --pack-destination /tmp/ 2>/dev/null | tail -1) + + echo "[INFO] Extracting to $dest ..." + tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" + rm -f "/tmp/$tarball" + echo "[INFO] Installing deps (shared pnpm store) ..." - pnpm add $npm_spec \ + pnpm install \ --dir "$dest" \ --store-dir "$PNPM_STORE" \ --ignore-scripts=false \ - --prod + --prod \ + --no-frozen-lockfile - # verify_plugin_manifest "$dest" || return 2 + verify_plugin_manifest "$dest" || return 2 echo "[OK] Plugin $plugin_id ready at $dest" } diff --git a/docker_openclaw/work/start-openclaw.sh b/docker_openclaw/work/start-openclaw.sh index 88eab8b..56fe174 100644 --- a/docker_openclaw/work/start-openclaw.sh +++ b/docker_openclaw/work/start-openclaw.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash set -eu bootstrap() { From 354e31b27af355fe1080c7df0e6cc6b751f5c6f0 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 13:49:52 +0000 Subject: [PATCH 14/25] debug --- docker_openclaw/work/script-setup-openclaw.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index c05e594..fc28619 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -36,7 +36,8 @@ install_plugin() { --store-dir "$PNPM_STORE" \ --ignore-scripts=false \ --prod \ - --no-frozen-lockfile + --no-frozen-lockfile \ + --config.unsafe-perm=true verify_plugin_manifest "$dest" || return 2 echo "[OK] Plugin $plugin_id ready at $dest" From 4e1c8b390b4e8cb107e48806ac46d495243903eb Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 13:50:02 +0000 Subject: [PATCH 15/25] d --- docker_openclaw/openclaw.Dockerfile | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index ad8a57e..4642a9b 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -22,18 +22,12 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ - && NPMRC=$(pnpm config get globalconfig) \ - && echo 'onlyBuiltDependencies[]=@matrix-org/matrix-sdk-crypto-nodejs' >> "$NPMRC" \ - && echo 'onlyBuiltDependencies[]=koffi' >> "$NPMRC" \ - && echo 'onlyBuiltDependencies[]=openclaw' >> "$NPMRC" \ - && echo 'onlyBuiltDependencies[]=protobufjs' >> "$NPMRC" \ - && echo 'onlyBuiltDependencies[]=sharp' >> "$NPMRC" \ && GLOBAL_DIR=$(pnpm root -g | sed 's|/node_modules$||') \ && mkdir -pv "$GLOBAL_DIR" \ && echo '{"dependencies":{},"pnpm":{"onlyBuiltDependencies":["@matrix-org/matrix-sdk-crypto-nodejs","koffi","openclaw","protobufjs","sharp"]}}' \ | tee "$GLOBAL_DIR/package.json" \ && pnpm config list \ - && pnpm install --prod -g --ignore-scripts=false --store-dir "$PNPM_STORE" openclaw@latest \ + && pnpm install --prod -g --ignore-scripts=false --config.unsafe-perm=true --store-dir "$PNPM_STORE" openclaw@latest \ && openclaw --version RUN set -eux && source /opt/utils/script-utils.sh \ @@ -50,4 +44,4 @@ ENV OPENCLAW_HIDE_BANNER=1 WORKDIR /opt/openclaw VOLUME ["/opt/openclaw/data"] EXPOSE 18789 18790 -CMD ["sh", "start-openclaw.sh", "gateway", "--allow-unconfigured", "--bind", "${OPENCLAW_GATEWAY_BIND:-lan}", "--port", "${OPENCLAW_GATEWAY_PORT:-18789}"] +CMD ["start-openclaw.sh", "gateway", "--allow-unconfigured", "--bind", "${OPENCLAW_GATEWAY_BIND:-lan}", "--port", "${OPENCLAW_GATEWAY_PORT:-18789}"] From c5b813cf1f224b670d239c57aa748da242492562 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 15:09:10 +0000 Subject: [PATCH 16/25] update --- docker_openclaw/openclaw.Dockerfile | 10 ++++++---- docker_openclaw/work/script-setup-openclaw.sh | 9 +++++++++ docker_openclaw/work/start-openclaw.sh | 2 ++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 4642a9b..865a35f 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -28,9 +28,8 @@ RUN set -eux && source /opt/utils/script-setup.sh \ | tee "$GLOBAL_DIR/package.json" \ && pnpm config list \ && pnpm install --prod -g --ignore-scripts=false --config.unsafe-perm=true --store-dir "$PNPM_STORE" openclaw@latest \ - && openclaw --version - -RUN set -eux && source /opt/utils/script-utils.sh \ + && openclaw --version \ + ## install plugins && source /opt/openclaw/script-setup-openclaw.sh \ && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ ## clean up @@ -44,4 +43,7 @@ ENV OPENCLAW_HIDE_BANNER=1 WORKDIR /opt/openclaw VOLUME ["/opt/openclaw/data"] EXPOSE 18789 18790 -CMD ["start-openclaw.sh", "gateway", "--allow-unconfigured", "--bind", "${OPENCLAW_GATEWAY_BIND:-lan}", "--port", "${OPENCLAW_GATEWAY_PORT:-18789}"] + +CMD start-openclaw.sh gateway --allow-unconfigured \ + --bind "${OPENCLAW_GATEWAY_BIND:-lan}" \ + --port "${OPENCLAW_GATEWAY_PORT:-18789}" diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index fc28619..eb9fb5e 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -30,6 +30,15 @@ install_plugin() { tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" rm -f "/tmp/$tarball" + echo "[INFO] Patching package.json: allow all direct deps to build ..." + node -e " + const fs = require('fs'); + const pkg = JSON.parse(fs.readFileSync('$dest/package.json', 'utf8')); + pkg.pnpm = pkg.pnpm || {}; + pkg.pnpm.onlyBuiltDependencies = '*'; + fs.writeFileSync('$dest/package.json', JSON.stringify(pkg, null, 2)); + " + echo "[INFO] Installing deps (shared pnpm store) ..." pnpm install \ --dir "$dest" \ diff --git a/docker_openclaw/work/start-openclaw.sh b/docker_openclaw/work/start-openclaw.sh index 56fe174..e7f746e 100644 --- a/docker_openclaw/work/start-openclaw.sh +++ b/docker_openclaw/work/start-openclaw.sh @@ -23,4 +23,6 @@ bootstrap() { /opt/utils/script-localize.sh "${PROFILE_LOCALIZE:-default}" bootstrap + +echo "Starting openclaw with options: $@" exec openclaw "$@" From bb6dd12b043de8c42f34083e36afaddc01ee2093 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 15:15:42 +0000 Subject: [PATCH 17/25] x --- docker_openclaw/work/script-setup-openclaw.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index eb9fb5e..eb817a0 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -30,13 +30,15 @@ install_plugin() { tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" rm -f "/tmp/$tarball" - echo "[INFO] Patching package.json: allow all direct deps to build ..." + echo "[INFO] Patching package.json: allow build scripts ..." node -e " const fs = require('fs'); - const pkg = JSON.parse(fs.readFileSync('$dest/package.json', 'utf8')); - pkg.pnpm = pkg.pnpm || {}; - pkg.pnpm.onlyBuiltDependencies = '*'; - fs.writeFileSync('$dest/package.json', JSON.stringify(pkg, null, 2)); + const globalPkgPath = require('child_process').execSync('pnpm root -g').toString().trim().replace(/\/node_modules\$/, '') + '/package.json'; + const allowList = JSON.parse(fs.readFileSync(globalPkgPath, 'utf8'))?.pnpm?.onlyBuiltDependencies || []; + const pkgPath = '$dest/package.json'; + const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); + pkg.pnpm = { ...(pkg.pnpm || {}), onlyBuiltDependencies: allowList }; + fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2)); " echo "[INFO] Installing deps (shared pnpm store) ..." From 2c56486888fbe50d5f361158d7c1a759e5818961 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 16:31:55 +0000 Subject: [PATCH 18/25] x --- docker_openclaw/demo/docker-compose.yml | 2 +- docker_openclaw/openclaw.Dockerfile | 22 ++++++++++---- docker_openclaw/work/script-setup-openclaw.sh | 30 +++++++++---------- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/docker_openclaw/demo/docker-compose.yml b/docker_openclaw/demo/docker-compose.yml index 58ef39b..219323e 100644 --- a/docker_openclaw/demo/docker-compose.yml +++ b/docker_openclaw/demo/docker-compose.yml @@ -4,7 +4,7 @@ services: openclaw-gateway: container_name: svc-openclaw-gateway hostname: svc-openclaw-gateway - image: "quay.io/labnow/openclaw:latest" + image: "quay.io/labnow0dev/openclaw:latest" pull_policy: if_not_present restart: unless-stopped environment: diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 865a35f..d85ec2a 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -22,18 +22,30 @@ RUN set -eux && source /opt/utils/script-setup.sh \ && export SHARP_IGNORE_GLOBAL_LIBVIPS=1 \ && setup_node_pnpm 10 \ && pnpm config set enable-pre-post-scripts true \ + && pnpm config set package-import-method hardlink \ + && pnpm config set node-linker isolated \ + && pnpm config set store-dir $PNPM_STORE \ && GLOBAL_DIR=$(pnpm root -g | sed 's|/node_modules$||') \ && mkdir -pv "$GLOBAL_DIR" \ && echo '{"dependencies":{},"pnpm":{"onlyBuiltDependencies":["@matrix-org/matrix-sdk-crypto-nodejs","koffi","openclaw","protobufjs","sharp"]}}' \ | tee "$GLOBAL_DIR/package.json" \ && pnpm config list \ && pnpm install --prod -g --ignore-scripts=false --config.unsafe-perm=true --store-dir "$PNPM_STORE" openclaw@latest \ - && openclaw --version \ - ## install plugins + && pnpm store prune --store-dir "$PNPM_STORE" && rm -rf "$PNPM_STORE" && install__clean \ + && openclaw --version + +RUN set -eux && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ - && install_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ + && printf 'packages:\n - "plugins/*"\n' > pnpm-workspace.yaml; \ + && printf '{"name":"openclaw-root","version":"1.0.0","private":true}\n' > package.json \ + && PNPM_VER="$(pnpm --version)" \ + && jq --arg ver "$PNPM_VER" \ + --argjson deps '["koffi","sharp", "openclaw", "protobufjs", "@matrix-org/matrix-sdk-crypto-nodejs"]' \ + '. + {dependencies: {openclaw:"latest"}, packageManager: ("pnpm@" + $ver), pnpm: { onlyBuiltDependencies: $deps } }' package.json > package.tmp.json \ + && mv package.tmp.json package.json \ + && add_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ ## clean up - && install__clean \ + && pnpm store prune --store-dir "$PNPM_STORE" && rm -rf "$PNPM_STORE" && install__clean \ && rm -rf ~/.* \ && ln -sfn /opt/openclaw/data /opt/openclaw/.openclaw \ && ls -alh ~/ @@ -41,7 +53,7 @@ RUN set -eux && source /opt/utils/script-setup.sh \ ENV XDG_CONFIG_HOME=/opt/openclaw/data ENV OPENCLAW_HIDE_BANNER=1 WORKDIR /opt/openclaw -VOLUME ["/opt/openclaw/data"] +VOLUME ["/opt/openclaw/data", "/opt/node/pnpm/store"] EXPOSE 18789 18790 CMD start-openclaw.sh gateway --allow-unconfigured \ diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index eb817a0..7b6fd41 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -6,7 +6,7 @@ OPENCLAW_PLUGINS_ROOT=${OPENCLAW_HOME:-"/opt/openclaw"}/plugins verify_plugin_manifest() { local dest="$1" echo "[INFO] Verifying plugin manifest in $dest ..." - if [[ ! -f "$dest/openclaw.plugin.json" ]]; then + if [ ! -f "$dest/openclaw.plugin.json" ]; then if ! node -e "const p=require('$dest/package.json'); process.exit(p.openclaw ? 0 : 1)" 2>/dev/null; then echo "[ERROR] $dest has neither openclaw.plugin.json nor openclaw field in package.json!" >&2 return 1 @@ -15,7 +15,7 @@ verify_plugin_manifest() { echo "[OK] Manifest verified at $dest" } -install_plugin() { +add_plugin() { local npm_spec="$1" local plugin_id="$2" local dest="$OPENCLAW_PLUGINS_ROOT/$plugin_id" @@ -30,16 +30,17 @@ install_plugin() { tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" rm -f "/tmp/$tarball" - echo "[INFO] Patching package.json: allow build scripts ..." - node -e " - const fs = require('fs'); - const globalPkgPath = require('child_process').execSync('pnpm root -g').toString().trim().replace(/\/node_modules\$/, '') + '/package.json'; - const allowList = JSON.parse(fs.readFileSync(globalPkgPath, 'utf8'))?.pnpm?.onlyBuiltDependencies || []; - const pkgPath = '$dest/package.json'; - const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); - pkg.pnpm = { ...(pkg.pnpm || {}), onlyBuiltDependencies: allowList }; - fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2)); - " + if ! node -e "require('$dest/package.json').name" >/dev/null 2>&1; then + echo "[ERROR] package.json missing name field in $dest" >&2 + return 1 + fi + verify_plugin_manifest "$dest" || return 2 +} + +install_plugin(){ + local npm_spec="$1" + local plugin_id="$2" + local dest="$OPENCLAW_PLUGINS_ROOT/$plugin_id" echo "[INFO] Installing deps (shared pnpm store) ..." pnpm install \ @@ -49,7 +50,6 @@ install_plugin() { --prod \ --no-frozen-lockfile \ --config.unsafe-perm=true - - verify_plugin_manifest "$dest" || return 2 + echo "[OK] Plugin $plugin_id ready at $dest" -} +} \ No newline at end of file From 1b9b09d7ca6d3a4798b7cb2a02f4d43d7ac15a4d Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Thu, 2 Apr 2026 16:39:28 +0000 Subject: [PATCH 19/25] x --- docker_openclaw/openclaw.Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index d85ec2a..67f2d95 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -10,7 +10,7 @@ ENV PNPM_HOME=/opt/node/pnpm ENV PNPM_STORE=/opt/node/pnpm/store ENV OPENCLAW_HOME=/opt/openclaw ENV PATH="${PNPM_HOME}:${OPENCLAW_HOME}:${PATH}" -ENV HOME=/opt/openclaw/ +ENV HOME=/opt/openclaw COPY work /opt/openclaw/ @@ -36,12 +36,12 @@ RUN set -eux && source /opt/utils/script-setup.sh \ RUN set -eux && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ - && printf 'packages:\n - "plugins/*"\n' > pnpm-workspace.yaml; \ + && printf 'packages:\n - "plugins/*"\n' > pnpm-workspace.yaml \ && printf '{"name":"openclaw-root","version":"1.0.0","private":true}\n' > package.json \ && PNPM_VER="$(pnpm --version)" \ && jq --arg ver "$PNPM_VER" \ - --argjson deps '["koffi","sharp", "openclaw", "protobufjs", "@matrix-org/matrix-sdk-crypto-nodejs"]' \ - '. + {dependencies: {openclaw:"latest"}, packageManager: ("pnpm@" + $ver), pnpm: { onlyBuiltDependencies: $deps } }' package.json > package.tmp.json \ + --argjson deps '["koffi","sharp","openclaw","protobufjs","@matrix-org/matrix-sdk-crypto-nodejs"]' \ + '. + {dependencies: {openclaw:"latest"}, packageManager: ("pnpm@" + $ver), pnpm: { onlyBuiltDependencies: $deps } }' package.json > package.tmp.json \ && mv package.tmp.json package.json \ && add_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ ## clean up From d42c2ecbd3d4167d903ac2f4c166f8bedbdc750b Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 3 Apr 2026 02:16:45 +0800 Subject: [PATCH 20/25] fix: update image reference and enhance plugin configuration setup --- docker_openclaw/demo/docker-compose.yml | 3 +- docker_openclaw/openclaw.Dockerfile | 4 + docker_openclaw/work/script-setup-openclaw.sh | 75 ++++++++++++------- docker_openclaw/work/start-openclaw.sh | 36 ++++----- 4 files changed, 74 insertions(+), 44 deletions(-) diff --git a/docker_openclaw/demo/docker-compose.yml b/docker_openclaw/demo/docker-compose.yml index 219323e..b44f283 100644 --- a/docker_openclaw/demo/docker-compose.yml +++ b/docker_openclaw/demo/docker-compose.yml @@ -4,7 +4,7 @@ services: openclaw-gateway: container_name: svc-openclaw-gateway hostname: svc-openclaw-gateway - image: "quay.io/labnow0dev/openclaw:latest" + image: "quay.io/labnow/openclaw:latest" pull_policy: if_not_present restart: unless-stopped environment: @@ -16,5 +16,4 @@ services: ports: - "${OPENCLAW_GATEWAY_PORT:-18789}:18789" - "${OPENCLAW_BRIDGE_PORT:-18790}:18790" - init: true # command: ["tail", "-f", "/dev/null"] diff --git a/docker_openclaw/openclaw.Dockerfile b/docker_openclaw/openclaw.Dockerfile index 67f2d95..9398a48 100644 --- a/docker_openclaw/openclaw.Dockerfile +++ b/docker_openclaw/openclaw.Dockerfile @@ -9,6 +9,8 @@ ENV NODE_ENV=production ENV PNPM_HOME=/opt/node/pnpm ENV PNPM_STORE=/opt/node/pnpm/store ENV OPENCLAW_HOME=/opt/openclaw +ENV OPENCLAW_PLUGINS_ROOT=${OPENCLAW_HOME}/plugins +ENV OPENCLAW_CONFIG=${OPENCLAW_HOME}/.openclaw/openclaw.json ENV PATH="${PNPM_HOME}:${OPENCLAW_HOME}:${PATH}" ENV HOME=/opt/openclaw @@ -36,6 +38,7 @@ RUN set -eux && source /opt/utils/script-setup.sh \ RUN set -eux && source /opt/utils/script-utils.sh \ && source /opt/openclaw/script-setup-openclaw.sh \ + && cd $OPENCLAW_HOME \ && printf 'packages:\n - "plugins/*"\n' > pnpm-workspace.yaml \ && printf '{"name":"openclaw-root","version":"1.0.0","private":true}\n' > package.json \ && PNPM_VER="$(pnpm --version)" \ @@ -44,6 +47,7 @@ RUN set -eux && source /opt/utils/script-utils.sh \ '. + {dependencies: {openclaw:"latest"}, packageManager: ("pnpm@" + $ver), pnpm: { onlyBuiltDependencies: $deps } }' package.json > package.tmp.json \ && mv package.tmp.json package.json \ && add_plugin "@larksuite/openclaw-lark" "openclaw-lark" \ + && pnpm install --prod \ ## clean up && pnpm store prune --store-dir "$PNPM_STORE" && rm -rf "$PNPM_STORE" && install__clean \ && rm -rf ~/.* \ diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 7b6fd41..6e1c504 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -1,7 +1,49 @@ #!/usr/bin/env bash set -eu -OPENCLAW_PLUGINS_ROOT=${OPENCLAW_HOME:-"/opt/openclaw"}/plugins +init_config() { + if [ ! -f "$OPENCLAW_CONFIG" ]; then + mkdir -p "$(dirname "$OPENCLAW_CONFIG")" + + jq -n \ + --argjson plugin_paths "[\"$OPENCLAW_PLUGINS_ROOT\"]" \ + --arg token "${OPENCLAW_GATEWAY_TOKEN:-openclaw}" \ + '{ + plugins: { + load: { paths: $plugin_paths }, + entries: {} + }, + gateway: { + controlUi: { + dangerouslyAllowHostHeaderOriginFallback: true, + dangerouslyDisableDeviceAuth: true + }, + auth: { + mode: "token", + token: $token + } + } + }' > "$OPENCLAW_CONFIG" + fi +} + +list_downloaded_plugins() { + local plugins=() + + for plugin_dir in "$OPENCLAW_PLUGINS_ROOT"/*/; do + [[ -d "$plugin_dir" ]] || continue + local plugin + plugin=$(basename "$plugin_dir") + + if verify_plugin_manifest "$OPENCLAW_PLUGINS_ROOT/$plugin"; then + plugins+=("$plugin") + else + echo "[WARN] Skipping $plugin: invalid or missing plugin manifest" >&2 + fi + done + + printf '%s\n' "${plugins[@]}" | jq -R . | jq -s . +} verify_plugin_manifest() { local dest="$1" @@ -22,34 +64,17 @@ add_plugin() { mkdir -pv "$dest" "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" - echo "[INFO] Packing $npm_spec ..." - local tarball - tarball=$(npm pack "$npm_spec" --pack-destination /tmp/ 2>/dev/null | tail -1) - - echo "[INFO] Extracting to $dest ..." - tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" - rm -f "/tmp/$tarball" + echo "[INFO] Adding $npm_spec ..." + pnpm add "$npm_spec" + --dir "$dest" \ + --prod \ + --no-frozen-lockfile if ! node -e "require('$dest/package.json').name" >/dev/null 2>&1; then echo "[ERROR] package.json missing name field in $dest" >&2 return 1 fi + verify_plugin_manifest "$dest" || return 2 + echo "[OK] Plugin $plugin_id installed via pnpm" } - -install_plugin(){ - local npm_spec="$1" - local plugin_id="$2" - local dest="$OPENCLAW_PLUGINS_ROOT/$plugin_id" - - echo "[INFO] Installing deps (shared pnpm store) ..." - pnpm install \ - --dir "$dest" \ - --store-dir "$PNPM_STORE" \ - --ignore-scripts=false \ - --prod \ - --no-frozen-lockfile \ - --config.unsafe-perm=true - - echo "[OK] Plugin $plugin_id ready at $dest" -} \ No newline at end of file diff --git a/docker_openclaw/work/start-openclaw.sh b/docker_openclaw/work/start-openclaw.sh index e7f746e..432f5b3 100644 --- a/docker_openclaw/work/start-openclaw.sh +++ b/docker_openclaw/work/start-openclaw.sh @@ -1,28 +1,30 @@ #!/usr/bin/env bash set -eu + bootstrap() { . /opt/openclaw/script-setup-openclaw.sh - - openclaw config set plugins.load.paths "[\"$OPENCLAW_PLUGINS_ROOT\"]" - - for name in /opt/openclaw/plugins/*/; do - name=$(basename "$name") - if verify_plugin_manifest "$OPENCLAW_PLUGINS_ROOT/$name"; then - openclaw config set "plugins.entries.${name}.enabled" true - else - echo "[WARN] Skipping $name: invalid or missing plugin manifest" >&2 - fi - done - - openclaw config set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback true - openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true - openclaw config set gateway.auth.mode token - openclaw config set gateway.auth.token "${OPENCLAW_GATEWAY_TOKEN:-"openclaw"}" + + init_config + + local plugins_json + plugins_json=$(list_downloaded_plugins) + plugins_json=${plugins_json:-"[]"} + + jq \ + --argjson plugins "$plugins_json" \ + ' + def build_entries: + reduce $plugins[] as $p ({}; .[$p] = {enabled: true}); + .plugins.entries = build_entries + ' "$OPENCLAW_CONFIG" > "${OPENCLAW_CONFIG}.tmp" \ + && mv "${OPENCLAW_CONFIG}.tmp" "$OPENCLAW_CONFIG" + + echo "[OK] Plugins entries updated" } /opt/utils/script-localize.sh "${PROFILE_LOCALIZE:-default}" -bootstrap +[ ! -f "$OPENCLAW_CONFIG" ] && bootstrap echo "Starting openclaw with options: $@" exec openclaw "$@" From 2fabe7a3a9e98e5fe833fa523e4156b50eadb682 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 3 Apr 2026 02:22:42 +0800 Subject: [PATCH 21/25] fix: update pnpm add command to include directory option --- docker_openclaw/work/script-setup-openclaw.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 6e1c504..992dcaa 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -65,7 +65,7 @@ add_plugin() { mkdir -pv "$dest" "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" echo "[INFO] Adding $npm_spec ..." - pnpm add "$npm_spec" + pnpm add "$npm_spec" \ --dir "$dest" \ --prod \ --no-frozen-lockfile From 55eeba3f643ac54e4087f3d75e64d2535784e623 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 3 Apr 2026 02:29:35 +0800 Subject: [PATCH 22/25] fix: update pnpm add command to include directory option and adjust bash script settings --- docker_openclaw/work/script-setup-openclaw.sh | 4 ++-- tool.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 992dcaa..381b2ec 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -eu + init_config() { if [ ! -f "$OPENCLAW_CONFIG" ]; then mkdir -p "$(dirname "$OPENCLAW_CONFIG")" @@ -67,8 +68,7 @@ add_plugin() { echo "[INFO] Adding $npm_spec ..." pnpm add "$npm_spec" \ --dir "$dest" \ - --prod \ - --no-frozen-lockfile + --prod if ! node -e "require('$dest/package.json').name" >/dev/null 2>&1; then echo "[ERROR] package.json missing name field in $dest" >&2 diff --git a/tool.sh b/tool.sh index 473315d..9fd281c 100644 --- a/tool.sh +++ b/tool.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -xu +set -eux CI_PROJECT_NAME=${CI_PROJECT_NAME:-$GITHUB_REPOSITORY} CI_PROJECT_BRANCH=${GITHUB_HEAD_REF:-"main"} From bbda542fed63e3279c1fd523cefef9cb30da78ea Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 3 Apr 2026 02:34:23 +0800 Subject: [PATCH 23/25] fix: comment out plugin verification in add_plugin function --- docker_openclaw/work/script-setup-openclaw.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 381b2ec..9d45e21 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -75,6 +75,5 @@ add_plugin() { return 1 fi - verify_plugin_manifest "$dest" || return 2 - echo "[OK] Plugin $plugin_id installed via pnpm" + # verify_plugin_manifest "$dest" && echo "[OK] Plugin $plugin_id installed via pnpm" || return 2 } From 573ab30f5351a5b6824e1a26227056050c95bb9b Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 3 Apr 2026 03:24:50 +0800 Subject: [PATCH 24/25] x --- docker_openclaw/work/script-setup-openclaw.sh | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docker_openclaw/work/script-setup-openclaw.sh b/docker_openclaw/work/script-setup-openclaw.sh index 9d45e21..72c993e 100644 --- a/docker_openclaw/work/script-setup-openclaw.sh +++ b/docker_openclaw/work/script-setup-openclaw.sh @@ -66,14 +66,12 @@ add_plugin() { mkdir -pv "$dest" "$OPENCLAW_PLUGINS_ROOT" "$PNPM_STORE" echo "[INFO] Adding $npm_spec ..." - pnpm add "$npm_spec" \ - --dir "$dest" \ - --prod + local tarball + tarball=$(npm pack "$npm_spec" --pack-destination /tmp/ 2>/dev/null | tail -1) - if ! node -e "require('$dest/package.json').name" >/dev/null 2>&1; then - echo "[ERROR] package.json missing name field in $dest" >&2 - return 1 - fi + echo "[INFO] Extracting to $dest ..." + tar -xzf "/tmp/$tarball" --strip-components=1 -C "$dest" + rm -f "/tmp/$tarball" - # verify_plugin_manifest "$dest" && echo "[OK] Plugin $plugin_id installed via pnpm" || return 2 + verify_plugin_manifest "$dest" && echo "[OK] Plugin $plugin_id installed via pnpm" || return 2 } From d44ea61ea9d1f683e2aab4463ba3210a6701a24d Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 3 Apr 2026 03:49:11 +0800 Subject: [PATCH 25/25] update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 52c99a4..677472e 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Discussion and contributions are welcome: ## Documentation & Tutorial -[Wiki & Document](https://labnow.ai/) | [中文使用指引(含中国网络镜像)](https://labnow-ai.feishu.cn/wiki/wikcn0sBhMtb1KNRSUTettxWstc) +[Wiki & Document](https://doc.labnow.ai/) | [中文使用指引(含中国网络镜像)](https://doc.labnow.ai/zh-CN/) ## Develop and Debug