Skip to content

Commit 2a452ed

Browse files
author
iPythoning
committed
chore: release v3.8.0 deploy doctor
1 parent 913e2a9 commit 2a452ed

12 files changed

Lines changed: 340 additions & 26 deletions

File tree

.github/workflows/validate.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Validate Template
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
validate:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 22
23+
24+
- name: Validate template
25+
run: npm test

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,20 @@ Changes sourced from upstream (openclaw/openclaw) are labeled with the originati
88

99
## [Unreleased]
1010

11+
## 2026-06-07 — Template v3.8.0 CI + deploy doctor
12+
13+
### Added
14+
15+
- **GitHub Actions CI**: Added `.github/workflows/validate.yml` so pushes and pull requests to `main` run `npm test` automatically.
16+
- **Post-deploy doctor**: Added `deploy/doctor.sh` for SSH-based health checks covering Node/npm, OpenClaw CLI, config permissions, workspace files, local skills, Gateway service, Gateway health endpoint, and Chroma memory.
17+
- **Remote path configuration**: Added `REMOTE_HOME`, `REMOTE_OPENCLAW_HOME`, `REMOTE_CONFIG_HOME`, and `REMOTE_WORKSPACE_DIR` so non-root or custom-path deployments no longer require editing deploy scripts.
18+
- **IP isolation path alignment**: `deploy/ip-isolate.sh` now uses the configured OpenClaw and systemd user paths when injecting Gateway proxy settings.
19+
20+
### Fixed
21+
22+
- **Generated workspace path**: `deploy/generate-config.sh` now writes `agents.defaults.workspace` from the configured remote workspace path instead of hardcoding `/root/.openclaw/workspace`.
23+
- **Validation coverage**: `npm test` now verifies the CI workflow, doctor script, current `b2b_trade` skill count, and non-root workspace path generation.
24+
1125
## 2026-06-07 — Template v3.7.0 validation + memory deployment alignment
1226

1327
### Added

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,14 @@ cp deploy/config.sh.example deploy/config.sh
6262

6363
# Template smoke tests
6464
npm test
65+
66+
# Post-deploy remote health check
67+
cd deploy
68+
./doctor.sh
6569
```
6670

71+
Pull requests to `main` run the same `npm test` checks in GitHub Actions.
72+
6773
## License
6874

6975
By contributing, you agree that your contributions will be licensed under the MIT License.

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
> Turn any B2B export business into an AI-powered sales machine in 5 minutes.
1414
15-
> **New · 2026-06-07****Template v3.7.0**: Local `npm test` validation, deploy-time ChromaDB memory alignment, README metadata cleanup, and release smoke tests for product KB, PI generation, Chroma memory, and generated OpenClaw config. [See full changelog →](./CHANGELOG.md)
15+
> **New · 2026-06-07****Template v3.8.0**: GitHub Actions CI for `npm test`, post-deploy `deploy/doctor.sh` health checks, configurable remote OpenClaw paths for non-root deployments, and expanded validation for skill counts + workspace path generation. [See full changelog →](./CHANGELOG.md)
1616
1717
> 🚀 **New · 2026-06-03****OpenClaw v2026.6.1**: Multi-agent workboard orchestration, rebuilt Skill Workshop Control UI (proposal lists, today actions, review states, locale coverage), 8-platform channel delivery hardening, iMessage SQLite state persistence, 6-category hot-path performance gains, and MiniMax M3 + GitHub Copilot agent runtime. [See full changelog →](./CHANGELOG.md)
1818
@@ -112,6 +112,7 @@ vim config.sh # Fill in: server IP, API key, WhatsApp number
112112
#### 3. Validate Locally
113113

114114
```bash
115+
cd ..
115116
npm test
116117
```
117118

@@ -120,6 +121,7 @@ This checks the template structure, shell scripts, product KB JSON, proforma inv
120121
#### 4. Deploy
121122

122123
```bash
124+
cd deploy
123125
./deploy.sh my-company
124126

125127
# Output:
@@ -130,6 +132,14 @@ This checks the template structure, shell scripts, product KB JSON, proforma inv
130132
# Skills: b2b_trade (41 skills)
131133
```
132134

135+
#### 5. Verify Remote Health
136+
137+
```bash
138+
./doctor.sh
139+
```
140+
141+
Doctor checks SSH, Node/npm, OpenClaw CLI, `openclaw.json` permissions, workspace context files, local skills, Gateway service state, Gateway `/health`, and Chroma memory.
142+
133143
That's it. Your AI SDR is live on WhatsApp and ready to sell.
134144

135145
## What It Does
@@ -347,6 +357,18 @@ SHEETS_SPREADSHEET_ID="your-google-sheets-id"
347357
ADMIN_PHONES="+1234567890"
348358
```
349359

360+
For non-root servers or custom OpenClaw locations, set the remote paths instead of editing deploy scripts:
361+
362+
```bash
363+
SERVER_USER="openclaw"
364+
REMOTE_HOME="/srv/openclaw"
365+
REMOTE_OPENCLAW_HOME="/srv/openclaw/.openclaw"
366+
REMOTE_CONFIG_HOME="/srv/openclaw/.config"
367+
REMOTE_WORKSPACE_DIR="/srv/openclaw/.openclaw/workspace"
368+
```
369+
370+
CI runs `npm test` on every push and pull request to `main`.
371+
350372
### WhatsApp IP Isolation (Multi-Tenant)
351373

352374
When running multiple agents on the same server, each should have a unique exit IP so WhatsApp sees independent devices. This prevents cross-account flagging.

README.zh-CN.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
基于 [OpenClaw](https://openclaw.dev) 构建,已在真实外贸企业验证。
88

9-
> **最新 · 2026-06-07****Template v3.7.0**新增本地 `npm test` 验收、部署时 ChromaDB 记忆开关对齐、README 元数据清理,并覆盖产品知识库、PI 生成、Chroma 记忆、OpenClaw 配置生成的 release smoke test[查看完整更新日志 →](./CHANGELOG.md)
9+
> **最新 · 2026-06-07****Template v3.8.0**新增 GitHub Actions 自动跑 `npm test`、部署后 `deploy/doctor.sh` 健康检查、非 root 部署远端路径配置,并扩展技能数量与 workspace 路径生成验收[查看完整更新日志 →](./CHANGELOG.md)
1010
1111
> 🚀 **平台 · 2026-06-03****OpenClaw v2026.6.1**:多 Agent workboard 编排、重构 Skill Workshop 控制台、8 平台渠道投递加固、iMessage SQLite 状态持久化、6 类热路径性能优化,以及 MiniMax M3 + GitHub Copilot agent runtime。[查看完整更新日志 →](./CHANGELOG.md)
1212
@@ -88,6 +88,7 @@ vim config.sh # 填入:服务器 IP、API Key、WhatsApp 号码
8888
#### 3. 本地验收
8989

9090
```bash
91+
cd ..
9192
npm test
9293
```
9394

@@ -96,6 +97,7 @@ npm test
9697
#### 4. 一键部署
9798

9899
```bash
100+
cd deploy
99101
./deploy.sh my-company
100102

101103
# 输出:
@@ -106,6 +108,14 @@ npm test
106108
# Skills: b2b_trade (41 个)
107109
```
108110

111+
#### 5. 远端健康检查
112+
113+
```bash
114+
./doctor.sh
115+
```
116+
117+
Doctor 会检查 SSH、Node/npm、OpenClaw CLI、`openclaw.json` 权限、workspace 上下文文件、本地 skills、Gateway 服务状态、Gateway `/health`,以及 Chroma 记忆脚本。
118+
109119
完成。你的 AI SDR 已在 WhatsApp 上线,准备好卖货了。
110120

111121
## 功能概览
@@ -272,6 +282,20 @@ Token 在部署时自动生成并显示在输出中。请妥善保管 — 拥有
272282
- AI 模型 API Key(OpenAI、Anthropic、Google、Kimi 等)
273283
- WhatsApp Business 账号(可选但推荐)
274284

285+
### 配置
286+
287+
所有部署配置都在 `deploy/config.sh`。非 root 服务器或自定义 OpenClaw 路径时,不要改部署脚本,直接配置远端路径:
288+
289+
```bash
290+
SERVER_USER="openclaw"
291+
REMOTE_HOME="/srv/openclaw"
292+
REMOTE_OPENCLAW_HOME="/srv/openclaw/.openclaw"
293+
REMOTE_CONFIG_HOME="/srv/openclaw/.config"
294+
REMOTE_WORKSPACE_DIR="/srv/openclaw/.openclaw/workspace"
295+
```
296+
297+
CI 会在每次 push 和 pull request 到 `main` 时自动运行 `npm test`
298+
275299
### WhatsApp 配置
276300

277301
默认情况下,AI SDR 接受**所有 WhatsApp 联系人**的消息(`dmPolicy: "open"`)。这是销售代理的推荐设置 — 你希望每个潜在客户都能联系到你。

deploy/config.sh.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ SERVER_PORT=22 # SSH port
1212
SSH_KEY="" # SSH key path (leave empty for default)
1313
SSH_PASS="" # SSH password (key preferred, password as fallback)
1414

15+
# ─── Remote Paths ────────────────────────────────────────
16+
# Defaults:
17+
# root user -> /root/.openclaw
18+
# non-root user -> /home/<SERVER_USER>/.openclaw
19+
# Override these when the server uses a custom home directory or OpenClaw path.
20+
REMOTE_HOME=""
21+
REMOTE_OPENCLAW_HOME=""
22+
REMOTE_CONFIG_HOME=""
23+
REMOTE_WORKSPACE_DIR=""
24+
1525
# ─── OpenClaw Gateway ────────────────────────────────────
1626
GATEWAY_PORT=18789 # Gateway port
1727
GATEWAY_TOKEN="" # Auth token (auto-generated if empty)

deploy/deploy.sh

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ fi
4343
# ─── Load Config ──────────────────────────────────────────
4444
source "$CONFIG_FILE"
4545

46+
SERVER_USER="${SERVER_USER:-root}"
47+
SERVER_PORT="${SERVER_PORT:-22}"
48+
if [ -z "${REMOTE_HOME:-}" ]; then
49+
if [ "$SERVER_USER" = "root" ]; then
50+
REMOTE_HOME="/root"
51+
else
52+
REMOTE_HOME="/home/$SERVER_USER"
53+
fi
54+
fi
55+
REMOTE_OPENCLAW_HOME="${REMOTE_OPENCLAW_HOME:-$REMOTE_HOME/.openclaw}"
56+
REMOTE_CONFIG_HOME="${REMOTE_CONFIG_HOME:-$REMOTE_HOME/.config}"
57+
REMOTE_WORKSPACE_DIR="${REMOTE_WORKSPACE_DIR:-$REMOTE_OPENCLAW_HOME/workspace}"
58+
4659
missing=()
4760
[ -z "$SERVER_HOST" ] && missing+=("SERVER_HOST")
4861
[ -z "$PRIMARY_API_KEY" ] && [ -z "$FALLBACK_API_KEY" ] && missing+=("At least one model API key")
@@ -58,6 +71,16 @@ fi
5871
if ! [[ "${SERVER_PORT:-22}" =~ ^[0-9]+$ ]]; then
5972
err "Invalid SERVER_PORT: ${SERVER_PORT}"; exit 1
6073
fi
74+
validate_remote_path() {
75+
if ! [[ "$1" =~ ^/[a-zA-Z0-9._/-]+$ ]]; then
76+
err "Invalid remote path: $1"
77+
exit 1
78+
fi
79+
}
80+
validate_remote_path "$REMOTE_HOME"
81+
validate_remote_path "$REMOTE_OPENCLAW_HOME"
82+
validate_remote_path "$REMOTE_CONFIG_HOME"
83+
validate_remote_path "$REMOTE_WORKSPACE_DIR"
6184

6285
echo ""
6386
echo "═══════════════════════════════════════════════════════════"
@@ -67,6 +90,7 @@ echo ""
6790
info "Server: ${SERVER_USER}@${SERVER_HOST}:${SERVER_PORT:-22}"
6891
info "Primary Model: ${PRIMARY_PROVIDER}/${PRIMARY_MODEL_ID}"
6992
info "Gateway Port: ${GATEWAY_PORT}"
93+
info "OpenClaw Home: ${REMOTE_OPENCLAW_HOME}"
7094
echo ""
7195

7296
if [ "$DRY_RUN" = true ]; then
@@ -145,7 +169,7 @@ fi
145169

146170
# Ensure exec-approvals are set to full (default since 2026.4.2; explicit for forward-compatibility)
147171
info " Setting exec approvals to full..."
148-
remote "cat > /root/.openclaw/exec-approvals.json << 'EAEOF'
172+
remote "mkdir -p '$REMOTE_OPENCLAW_HOME' && cat > '$REMOTE_OPENCLAW_HOME/exec-approvals.json' << 'EAEOF'
149173
{
150174
\"version\": 1,
151175
\"defaults\": {
@@ -156,7 +180,7 @@ remote "cat > /root/.openclaw/exec-approvals.json << 'EAEOF'
156180
\"agents\": {}
157181
}
158182
EAEOF
159-
chmod 600 /root/.openclaw/exec-approvals.json"
183+
chmod 600 '$REMOTE_OPENCLAW_HOME/exec-approvals.json'"
160184
log " Exec approvals configured (security=full)"
161185

162186
# ─── Step 3: Check Node.js ───────────────────────────────
@@ -191,7 +215,7 @@ log " graphify installed"
191215
info "Step 4/8: Generating config..."
192216

193217
# Backup existing config before overwriting
194-
remote "[ -f /root/.openclaw/openclaw.json ] && cp /root/.openclaw/openclaw.json /root/.openclaw/openclaw.json.bak.\$(date +%s) || true" 2>/dev/null
218+
remote "[ -f '$REMOTE_OPENCLAW_HOME/openclaw.json' ] && cp '$REMOTE_OPENCLAW_HOME/openclaw.json' '$REMOTE_OPENCLAW_HOME/openclaw.json.bak.'\$(date +%s) || true" 2>/dev/null
195219

196220
bash "$SCRIPT_DIR/generate-config.sh" "$SCRIPT_DIR"
197221
log "openclaw.json generated"
@@ -206,17 +230,17 @@ fi
206230
# ─── Step 5: Deploy Files ────────────────────────────────
207231
info "Step 5/8: Deploying files..."
208232

209-
remote "mkdir -p /root/.openclaw/{workspace,memory,skills,delivery-queue}"
233+
remote "mkdir -p '$REMOTE_WORKSPACE_DIR' '$REMOTE_OPENCLAW_HOME/memory' '$REMOTE_WORKSPACE_DIR/skills' '$REMOTE_OPENCLAW_HOME/delivery-queue'"
210234

211-
remote_upload "$SCRIPT_DIR/openclaw.json" "/root/.openclaw/openclaw.json"
212-
remote "chmod 600 /root/.openclaw/openclaw.json"
235+
remote_upload "$SCRIPT_DIR/openclaw.json" "$REMOTE_OPENCLAW_HOME/openclaw.json"
236+
remote "chmod 600 '$REMOTE_OPENCLAW_HOME/openclaw.json'"
213237
log " openclaw.json deployed (permissions: 600)"
214238

215239
# Upload workspace MD files
216240
WORKSPACE_DIR="$(dirname "$SCRIPT_DIR")/workspace"
217241
for md in IDENTITY.md SOUL.md USER.md AGENTS.md MEMORY.md HEARTBEAT.md TOOLS.md; do
218242
if [ -f "$WORKSPACE_DIR/$md" ]; then
219-
remote_upload "$WORKSPACE_DIR/$md" "/root/.openclaw/workspace/$md"
243+
remote_upload "$WORKSPACE_DIR/$md" "$REMOTE_WORKSPACE_DIR/$md"
220244
log " $md deployed"
221245
fi
222246
done
@@ -226,11 +250,11 @@ SKILLS_DIR="$(dirname "$SCRIPT_DIR")/skills"
226250
for skill_dir in "$SKILLS_DIR"/*/; do
227251
skill_name=$(basename "$skill_dir")
228252
if [ -f "$skill_dir/SKILL.md" ]; then
229-
remote "mkdir -p /root/.openclaw/workspace/skills/$skill_name"
230-
remote_upload "$skill_dir/SKILL.md" "/root/.openclaw/workspace/skills/$skill_name/SKILL.md"
253+
remote "mkdir -p '$REMOTE_WORKSPACE_DIR/skills/$skill_name'"
254+
remote_upload "$skill_dir/SKILL.md" "$REMOTE_WORKSPACE_DIR/skills/$skill_name/SKILL.md"
231255
# Upload any script files (.mjs, .sh) alongside the SKILL.md
232256
for script in "$skill_dir"*.mjs "$skill_dir"*.sh; do
233-
[ -f "$script" ] && remote_upload "$script" "/root/.openclaw/workspace/skills/$skill_name/$(basename "$script")"
257+
[ -f "$script" ] && remote_upload "$script" "$REMOTE_WORKSPACE_DIR/skills/$skill_name/$(basename "$script")"
234258
done
235259
log " skill/$skill_name deployed"
236260
fi
@@ -239,9 +263,9 @@ done
239263
# ─── Step 6: Start Gateway ───────────────────────────────
240264
info "Step 6/8: Starting Gateway..."
241265

242-
remote "mkdir -p /root/.config/systemd/user"
266+
remote "mkdir -p '$REMOTE_CONFIG_HOME/systemd/user'"
243267
SAFE_PORT=$(printf '%d' "$GATEWAY_PORT")
244-
remote "cat > /root/.config/systemd/user/openclaw-gateway.service << SVCEOF
268+
remote "cat > '$REMOTE_CONFIG_HOME/systemd/user/openclaw-gateway.service' << SVCEOF
245269
[Unit]
246270
Description=OpenClaw Gateway
247271
After=network-online.target
@@ -250,11 +274,11 @@ After=network-online.target
250274
ExecStart=/usr/bin/openclaw gateway --port $SAFE_PORT
251275
Restart=always
252276
RestartSec=5
253-
Environment=HOME=/root
254-
Environment=PATH=/root/.local/bin:/usr/local/bin:/usr/bin:/bin
277+
Environment=HOME=$REMOTE_HOME
278+
Environment=PATH=$REMOTE_HOME/.local/bin:/usr/local/bin:/usr/bin:/bin
255279
NoNewPrivileges=yes
256280
ProtectSystem=strict
257-
ReadWritePaths=/root/.openclaw /root/.config /tmp
281+
ReadWritePaths=$REMOTE_OPENCLAW_HOME $REMOTE_CONFIG_HOME /tmp
258282
PrivateTmp=yes
259283
260284
[Install]
@@ -296,7 +320,7 @@ if [ -n "$SKILL_LIST" ] && [ "$SKILL_COUNT" -gt 0 ]; then
296320
if [[ ! "$skill" =~ ^[a-zA-Z0-9_-]+$ ]]; then
297321
warn " Skipping invalid skill name: $skill"; continue
298322
fi
299-
remote "cd /root/.openclaw/workspace/skills && clawhub install $(printf '%q' "$skill") --force --no-input 2>&1 | tail -1" 2>/dev/null || true
323+
remote "cd '$REMOTE_WORKSPACE_DIR/skills' && clawhub install $(printf '%q' "$skill") --force --no-input 2>&1 | tail -1" 2>/dev/null || true
300324
done
301325
log " Skills installed"
302326
fi
@@ -318,7 +342,8 @@ echo "════════════════════════
318342
echo ""
319343
echo " Server: ${SERVER_HOST}"
320344
echo " Gateway: ws://${SERVER_HOST}:${GATEWAY_PORT}"
321-
echo " Gateway Token: [hidden — see /root/.openclaw/openclaw.json]"
345+
echo " OpenClaw Home: ${REMOTE_OPENCLAW_HOME}"
346+
echo " Gateway Token: [hidden — see ${REMOTE_OPENCLAW_HOME}/openclaw.json]"
322347
echo ""
323348
echo " WhatsApp: $( [ "$WHATSAPP_ENABLED" = true ] && echo 'Enabled' || echo 'Disabled' )"
324349
echo " Telegram: $( [ "$TELEGRAM_ENABLED" = true ] && echo 'Enabled' || echo 'Disabled' )"
@@ -330,4 +355,5 @@ echo " Commands:"
330355
echo " Status: ssh ${SERVER_USER}@${SERVER_HOST} systemctl --user status openclaw-gateway"
331356
echo " Logs: ssh ${SERVER_USER}@${SERVER_HOST} journalctl --user -u openclaw-gateway -f"
332357
echo " Restart: ssh ${SERVER_USER}@${SERVER_HOST} systemctl --user restart openclaw-gateway"
358+
echo " Doctor: cd deploy && ./doctor.sh"
333359
echo ""

0 commit comments

Comments
 (0)