Skip to content

Commit 10fb309

Browse files
hotplex-aiclaude
andcommitted
docs: fix architecture descriptions and add missing commands
- CLAUDE.md: Clarify 7897/15721 are proxy configs, not services - USER_ONBOARDING.md: Fix port table, remove misleading proxy services - REFERENCE.md: Add 30+ missing commands, organize by category - REFERENCE_en.md: Sync with Chinese version, add all missing commands Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7a1a0c1 commit 10fb309

4 files changed

Lines changed: 176 additions & 13 deletions

File tree

CLAUDE.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ make clean-volumes # 清理所有数据卷 (危险!)
7777
| Service | Port | Description |
7878
| ---------------- | ----- | ------------------------------- |
7979
| openclaw-gateway | 18789 | 主网关服务 (Web UI + WebSocket) |
80-
| HTTP Proxy | 7897 | 代理服务 (访问外网) |
81-
| Claude API Proxy | 15721 | Claude API 代理 |
80+
| | 18790 | Bridge WebSocket 桥接 |
81+
| | 18791 | Browser 浏览器调试端口 |
82+
83+
> **代理配置**: 通过 `HTTP_PROXY`/`HTTPS_PROXY` 环境变量配置外部代理,用于访问 Google 和 Claude API
8284
8385
## Docker Image Variants
8486

@@ -133,8 +135,46 @@ GITHUB_TOKEN=xxx
133135
- Gateway 日志位于容器内 `/tmp/openclaw-gateway.log`
134136
- 进入容器后可直接运行 `openclaw` 命令
135137

138+
### CI 调试命令
139+
140+
```bash
141+
# 查看最近的 CI 运行
142+
gh run list --repo hrygo/openclaw-devkit --limit 5
143+
144+
# 查看特定运行的详细信息
145+
gh run view <run-id> --repo hrygo/openclaw-devkit
146+
147+
# 获取完整 CI 日志
148+
gh run view <run-id> --repo hrygo/openclaw-devkit --log
149+
150+
# 搜索日志中的错误
151+
gh run view <run-id> --repo hrygo/openclaw-devkit --log 2>&1 | grep -E "(ERROR|failed|process \")"
152+
```
153+
136154
## Gotchas
137155

156+
### Shell 条件执行陷阱 (Dockerfile)
157+
158+
**问题**: 在 Dockerfile RUN 命令中使用 `&&` 链时,条件测试 `[ condition ] && cmd` 如果返回 false 会中断整个链条。
159+
160+
**错误示例**:
161+
```dockerfile
162+
RUN ARCH=$(dpkg --print-architecture) && \
163+
JUST_ARCH="${ARCH}" && \
164+
[ "$ARCH" = "amd64" ] && JUST_ARCH="x86_64" && \ # 如果 ARCH=arm64,这里不会执行
165+
[ "$ARCH" = "arm64" ] && JUST_ARCH="aarch64" && \ # 如果 ARCH=amd64,这里断链!
166+
curl ... # 不会执行
167+
```
168+
169+
**正确做法**: 使用 `if-then-elif-else-fi` 语法:
170+
```dockerfile
171+
RUN ARCH=$(dpkg --print-architecture) && \
172+
if [ "$ARCH" = "amd64" ]; then JUST_ARCH="x86_64"; \
173+
elif [ "$ARCH" = "arm64" ]; then JUST_ARCH="aarch64"; \
174+
else JUST_ARCH="${ARCH}"; fi && \
175+
curl ...
176+
```
177+
138178
### Shell 脚本换行符问题
139179

140180
**症状**: 执行 `make up` 时报错 `env: 'bash\r': No such file or directory`
@@ -173,6 +213,20 @@ git diff --check
173213

174214
## Dockerfile Development
175215

216+
### 工具架构映射表
217+
218+
不同工具使用不同的架构命名约定,需要正确映射:
219+
220+
| 工具 | amd64 命名 | arm64 命名 | 示例 URL |
221+
|------|-----------|-----------|----------|
222+
| yq | `amd64` | `arm64` | `yq_linux_amd64` |
223+
| just | `x86_64` | `aarch64` | `just-1.47.0-x86_64-unknown-linux-musl.tar.gz` |
224+
| lazygit | `x86_64` | `arm64` | `lazygit_0.49.0_Linux_x86_64.tar.gz` |
225+
| gh CLI | `amd64` | `arm64` | `gh_2.67.0_linux_amd64.deb` |
226+
| Go | `amd64` | `arm64` | `go1.26.1.linux-arm64.tar.gz` |
227+
228+
**推荐**: 在 RUN 命令中使用 `if-then-else-fi` 处理架构差异。
229+
176230
### Version Verification
177231
Before using specific versions in Dockerfile, verify download URLs exist:
178232
```bash
@@ -191,6 +245,21 @@ docker build --check -f Dockerfile . # Validate without full build
191245
- golangci-lint: 1.64.x
192246
- Java: 21 LTS (via Eclipse Temurin)
193247

248+
### 版本锁定原则
249+
250+
**必须锁定版本**: 所有工具版本必须锁定,避免因上游更新导致构建失败。
251+
252+
```bash
253+
# ❌ 错误: 动态查询最新版本 (消耗 GitHub API 配额,易触发 rate limit)
254+
LATEST=$(curl -s https://api.github.com/repos/foo/bar/releases/latest | jq -r '.tag_name')
255+
256+
# ✅ 正确: 锁定具体版本
257+
ARG TOOL_VERSION=1.2.3
258+
curl -fsSL "https://github.com/foo/bar/releases/download/v${TOOL_VERSION}/..."
259+
```
260+
261+
**好处**: 可重复构建 + 避免 API rate limit + 便于追踪回滚
262+
194263
### Installation Methods
195264
- **Node.js**: Use NodeSource APT repository (not direct nodejs.org download)
196265
- More reliable for multi-architecture builds (amd64 + arm64)

docs/REFERENCE.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,24 +64,65 @@ make onboard
6464

6565
## 3. 常用运维指令
6666

67+
### 快速开始
68+
69+
| 指令 | 说明 |
70+
| :--- | :--- |
71+
| `make help` | 显示所有可用命令 |
72+
| `make install` | 首次安装/初始化环境 |
73+
| `make onboard` | 交互式配置 (LLM/API) |
74+
75+
### 生命周期管理
76+
77+
| 指令 | 说明 |
78+
| :--- | :--- |
79+
| `make up` / `make start` | 启动 openclaw-gateway 服务 |
80+
| `make down` / `make stop` | 移除容器,保留 Data Volumes |
81+
| `make restart` | 执行 down + up,刷新配置 |
82+
| `make status` | 显示容器健康状态、运行时间、端口占用 |
83+
84+
### 构建与更新
85+
86+
| 指令 | 说明 |
87+
| :--- | :--- |
88+
| `make build` | 构建标准版镜像 |
89+
| `make build-go` | 构建 Go 版镜像 |
90+
| `make build-java` | 构建 Java 版镜像 |
91+
| `make build-office` | 构建 Office 版镜像 |
92+
| `make rebuild` | 重建镜像并重启服务 |
93+
| `make update` | 从 GitHub 同步最新代码 |
94+
95+
### 调试诊断
96+
6797
| 指令 | 说明 |
6898
| :--- | :--- |
69-
| `make start` / `make up` | 启动 openclaw-gateway 服务 |
70-
| `make stop` / `make down` | 移除容器,保留 Data Volumes |
7199
| `make logs` | 追踪任务分发、WebSocket 状态、错误堆栈 |
72100
| `make logs-all` | 查看所有容器日志 |
73-
| `make status` | 显示容器健康状态、运行时间、端口占用 |
74-
| `make restart` | 执行 down + up,刷新配置 |
75101
| `make shell` | 进入 Gateway 容器 |
76102
| `make run` | 交互式进入容器 |
77103
| `make exec CMD="..."` | 在容器中执行命令 |
78104
| `make cli CMD="..."` | 执行 OpenClaw CLI 命令 |
105+
| `make verify` | 验证镜像工具版本 |
106+
| `make test-proxy` | 测试代理连接 |
107+
108+
### 设备管理
109+
110+
| 指令 | 说明 |
111+
| :--- | :--- |
112+
| `make devices` | 列举配对设备 |
113+
| `make approve` | 批准配对请求 |
114+
| `make pairing` / `make pair` | 频道配对 |
79115
| `make dashboard` | 一键直达仪表盘 |
80116
| `make health` | 检查健康状态 |
117+
118+
### 备份恢复
119+
120+
| 指令 | 说明 |
121+
| :--- | :--- |
81122
| `make backup` | 备份配置文件 |
82123
| `make restore FILE=...` | 恢复配置文件 |
83124
| `make clean` | 清理容器和悬空镜像 |
84-
| `make clean-volumes` | 清理所有数据卷 |
125+
| `make clean-volumes` | 清理所有数据卷 (危险!) |
85126

86127
---
87128

docs/REFERENCE_en.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,65 @@ make onboard
6464

6565
## 3. Common Commands
6666

67+
### Quick Start
68+
6769
| Command | Description |
6870
| :--- | :--- |
69-
| `make up` | Start openclaw-gateway service |
70-
| `make down` | Remove containers, preserve Data Volumes |
71-
| `make logs` | Trace task distribution, WebSocket states, error stacks |
72-
| `make status` | Display container health, uptime, port occupancy |
71+
| `make help` | Show all available commands |
72+
| `make install` | First-time installation/setup |
73+
| `make onboard` | Interactive configuration (LLM/API) |
74+
75+
### Lifecycle Management
76+
77+
| Command | Description |
78+
| :--- | :--- |
79+
| `make up` / `make start` | Start openclaw-gateway service |
80+
| `make down` / `make stop` | Remove containers, preserve Data Volumes |
7381
| `make restart` | Execute down + up, refresh configuration |
82+
| `make status` | Display container health, uptime, port occupancy |
83+
84+
### Build & Update
85+
86+
| Command | Description |
87+
| :--- | :--- |
88+
| `make build` | Build standard image |
89+
| `make build-go` | Build Go variant image |
90+
| `make build-java` | Build Java variant image |
91+
| `make build-office` | Build Office variant image |
92+
| `make rebuild` | Rebuild image and restart service |
93+
| `make update` | Sync latest code from GitHub |
94+
95+
### Debugging
96+
97+
| Command | Description |
98+
| :--- | :--- |
99+
| `make logs` | Trace task distribution, WebSocket states, error stacks |
100+
| `make logs-all` | View all container logs |
101+
| `make shell` | Enter Gateway container |
102+
| `make run` | Interactive container access |
103+
| `make exec CMD="..."` | Execute command in container |
104+
| `make cli CMD="..."` | Execute OpenClaw CLI command |
105+
| `make verify` | Verify image tool versions |
106+
| `make test-proxy` | Test proxy connection |
107+
108+
### Device Management
109+
110+
| Command | Description |
111+
| :--- | :--- |
112+
| `make devices` | List paired devices |
113+
| `make approve` | Approve pairing request |
114+
| `make pairing` / `make pair` | Channel pairing |
115+
| `make dashboard` | Quick access to dashboard |
116+
| `make health` | Check health status |
117+
118+
### Backup & Restore
119+
120+
| Command | Description |
121+
| :--- | :--- |
122+
| `make backup` | Backup configuration files |
123+
| `make restore FILE=...` | Restore configuration |
124+
| `make clean` | Clean containers and dangling images |
125+
| `make clean-volumes` | Clean all data volumes (dangerous!) |
74126

75127
---
76128

docs/USER_ONBOARDING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,9 @@ make install / make up
112112
| :---- | :--------------- | :--------------- |
113113
| 18789 | Gateway Web UI | HTTP 访问 |
114114
| 18790 | Bridge | WebSocket 桥接 |
115-
| 7897 | HTTP Proxy | 代理服务(可选) |
116-
| 15721 | Claude API Proxy | API 代理(可选) |
115+
| 18791 | Browser | 浏览器调试端口 |
116+
117+
> **代理配置**: 通过环境变量 `HTTP_PROXY`/`HTTPS_PROXY` 配置外部代理访问
117118
118119
### 5.3 数据持久化
119120

0 commit comments

Comments
 (0)