开启左侧

docker升级openclaw版本

[复制链接]
米落枫 发表于 前天 08:25 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
作者:CSDN博客
docker升级openclaw版本

    容器内升级openclaw
      遇到的问题重建openclaw


容器内升级openclaw

docker run -u root 进入你的openclaw容器(不带-u默认node用户)
  1. # 1. 强制安装最新版并覆盖旧链接npminstall-g openclaw@latest --force--registry=https://registry.npmmirror.com
  2. # 2. 建立目录软链接(将 npm 全局路径映射到 app 工作目录)rm-rf /app/dist /app/node_modules
  3. ln-sf /usr/local/lib/node_modules/openclaw/dist /app/dist
  4. ln-sf /usr/local/lib/node_modules/openclaw/node_modules /app/node_modules
  5. # 3. 清理旧版模型缓存(激活 128k 规格的关键)rm-f /root/.openclaw/models.json
  6. # 4. 权限归属与启动chown-R node:node /root/.openclaw
  7. execnode /app/dist/index.js gateway
复制代码
npm install升级openclaw gateway,但web ui前端文件不会主动引导到新的目录/usr/local/lib/node_modules/openclaw/dist,所以即使openclaw --version看到已经完成升级,但web ui显示还是旧版本,此处将新版本目录覆盖旧版本目录即可
遇到的问题

报错说明解决
Missing config. Run openclaw setup or set gateway.mode=local (or pass --allow-unconfigured).出现类似配置文件已配置但读不到,需要注意检查当前用户,启动命令会在当前用户目录下.openclaw找json切换到对应用户
npm error code EEXIST、npm error path /usr/local/bin/openclaw、npm error EEXIST: file already existsopenclaw二进制文件已存在无直接覆盖npm install -g openclaw@latest 加上 --force
如果你只想本地访问bind 的值lan改成 loopback
重建openclaw

若出现openclaw误操作起不来,可使用如下启动命令重建新版本的openclaw(官方docker-setup.sh拉起的镜像openclaw:local)
  1. docker run -d\--name openclaw-prod \--restart unless-stopped \-u root \--memory=8g \-p18789:18789 \-p18790:18790 \-v /root/.openclaw:/root/.openclaw \-v /root/.openclaw/workspace:/root/.openclaw/workspace \-eNODE_ENV=production \-eNODE_OPTIONS="--max-old-space-size=4096"\--entrypoint"/bin/sh"\
  2.   openclaw:local \-c"npm install -g openclaw@latest --force --registry=https://registry.npmmirror.com && \
  3.       rm -rf /app/dist /app/node_modules && \
  4.       ln -sf /usr/local/lib/node_modules/openclaw/dist /app/dist && \
  5.       ln -sf /usr/local/lib/node_modules/openclaw/node_modules /app/node_modules && \
  6.       exec node /app/dist/index.js gateway"
复制代码
参考openclaw.json (gateway部分)
  1. "gateway":{"port":18789,
  2.     "mode":"local",
  3.     "bind":"lan",
  4.     "controlUi":{"enabled": true,
  5.       "allowedOrigins":["http://物理机ip:18789",
  6.         "http://127.0.0.1:18789",
  7.         "http://localhost:18789"],
  8.       "dangerouslyAllowHostHeaderOriginFallback": true,
  9.       "allowInsecureAuth": true,
  10.       "dangerouslyDisableDeviceAuth":true},
  11.     "auth":{"mode":"token",
  12.       "token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"#gateway授权token},
  13.     "trustedProxies":["192.168.65.0/24",
  14.       "172.18.0.0/16"],
  15.     "tailscale":{"mode":"off",
  16.       "resetOnExit":false},
  17.     "nodes":{"denyCommands":["camera.snap",
  18.         "camera.clip",
  19.         "screen.record",
  20.         "contacts.add",
  21.         "calendar.add",
  22.         "reminders.add",
  23.         "sms.send"]}},
复制代码
openclaw.json工具与安全策略部分
  1. "tools":{"profile":"coding",
  2.     "exec":{"host":"gateway",
  3.       "security":"full",
  4.       "ask":"on-miss"}},
复制代码
原文地址:https://blog.csdn.net/qq_33034095/article/details/159719709
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

发布主题
阅读排行更多+

Powered by Discuz! X3.4© 2001-2013 Discuz Team.( 京ICP备17022993号-3 )