mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Three coordinated things:
1. Resolve the committed upstream/main merge conflicts. 94 files were
sitting with raw <<<<<<< HEAD ... >>>>>>> upstream/main blocks. Every
conflict had HanzoBot/Bot on HEAD and OpenClaw on upstream. Resolved
by keeping HEAD everywhere — 540 conflict blocks.
2. Rewrite remaining OpenClaw text refs.
OPENCLAW → HANZO_BOT
OpenClaw → HanzoBot (PascalCase type identifiers)
openclaw → bot (codebase convention — botToken,
botUsername etc.; avoids invalid
hyphenated JS identifiers)
openclaw[_]/openclaw[A-Z] → bot[_]/bot[A-Z] (compound)
ai.openclaw.x → ai.hanzo.bot.x (JVM package path)
3. Delete or rename openclaw-named file paths (116 of them). Dead
duplicates with a Bot-named canonical from the partial migration:
deleted. Otherwise renamed.
ai/openclaw/** → deleted (ai/hanzo/bot/** canonical)
Sources/OpenClaw*/ → deleted (Sources/Bot* canonical)
Tests/OpenClawIPCTests/ → deleted (Tests/BotIPCTests canonical)
OpenClawKit/ → deleted (BotKit canonical)
openclaw-tools.*.ts → deleted (bot-tools.*.ts canonical)
openclaw-root.ts etc. → deleted (bot-root.ts canonical)
types.openclaw.ts → deleted (types.bot.ts canonical)
extensions/*/openclaw.plugin.json → renamed hanzo-bot.plugin.json
docs/start/openclaw.md → renamed hanzo-bot.md (+ zh-CN)
docs/assets/openclaw-*.png, whatsapp-openclaw*.jpg → deleted
scripts/.../openclaw-* → deleted (bot/hanzo-bot parallels)
openclaw.mjs → deleted (hanzo-bot.mjs is package.bin)
Then patched 65 broken JS/TS import strings where hanzo-bot had ended
up inside an import path ('./types.hanzo-bot.js' → './types.bot.js'
etc., since the on-disk filename uses the brand-neutral bot- prefix).
Pre-existing lint debt cleaned up to get oxlint --type-aware to 0/0:
removed the dead i18n test that referenced a path no longer existing;
defined the missing DIDConfig and WalletConfig types in types.base.ts
(they were imported but never declared); dropped unused imports;
collapsed redundant type assertion and a tautological meta.bot lookup
that the openclaw→bot rename made redundant.
The a2ui.bundle.js generated artifact is kept at its pre-rebrand
contents — it gets regenerated by 'pnpm canvas:a2ui:bundle' from
sources I cannot rebuild in this commit; the source side is clean.
Verified: 0 occurrences of openclaw (case-insensitive) in tree source
content, 0 file or directory paths with openclaw in the name; oxlint
--type-aware src test reports 0/0.
170 lines
5.5 KiB
Plaintext
170 lines
5.5 KiB
Plaintext
---
|
||
title: 在 Render 上部署
|
||
x-i18n:
|
||
generated_at: "2026-02-01T21:38:27Z"
|
||
model: claude-opus-4-5
|
||
provider: pi
|
||
source_hash: 03f0f277145daf6012ce33a9e8447d2eaaf346dfdb0df57a61ebf90b18b67c65
|
||
source_path: render.mdx
|
||
workflow: 15
|
||
---
|
||
|
||
使用基础设施即代码方式在 Render 上部署 HanzoBot。内置的 `render.yaml` Blueprint 以声明式方式定义了你的整个技术栈——服务、磁盘、环境变量,让你只需一键即可完成部署,并将基础设施与代码一同进行版本管理。
|
||
|
||
## 前提条件
|
||
|
||
- 一个 [Render 账户](https://render.com)(提供免费套餐)
|
||
- 来自你首选[模型提供商](/providers)的 API 密钥
|
||
|
||
## 使用 Render Blueprint 部署
|
||
|
||
<a
|
||
href="https://render.com/deploy?repo=https://github.com/hanzo-bot/hanzo-bot"
|
||
target="_blank"
|
||
rel="noreferrer"
|
||
>
|
||
部署到 Render
|
||
</a>
|
||
|
||
点击此链接将会:
|
||
|
||
1. 根据本仓库根目录下的 `render.yaml` Blueprint 创建一个新的 Render 服务。
|
||
2. 提示你设置 `SETUP_PASSWORD`
|
||
3. 构建 Docker 镜像并部署
|
||
|
||
部署完成后,你的服务 URL 格式为 `https://<service-name>.onrender.com`。
|
||
|
||
## 了解 Blueprint
|
||
|
||
Render Blueprint 是定义基础设施的 YAML 文件。本仓库中的 `render.yaml` 配置了运行 HanzoBot 所需的一切:
|
||
|
||
```yaml
|
||
services:
|
||
- type: web
|
||
name: hanzo-bot
|
||
runtime: docker
|
||
plan: starter
|
||
healthCheckPath: /health
|
||
envVars:
|
||
- key: PORT
|
||
value: "8080"
|
||
- key: SETUP_PASSWORD
|
||
sync: false # prompts during deploy
|
||
- key: BOT_STATE_DIR
|
||
value: /data/.hanzo-bot
|
||
- key: BOT_WORKSPACE_DIR
|
||
value: /data/workspace
|
||
- key: BOT_GATEWAY_TOKEN
|
||
generateValue: true # auto-generates a secure token
|
||
disk:
|
||
name: hanzo-bot-data
|
||
mountPath: /data
|
||
sizeGB: 1
|
||
```
|
||
|
||
使用的关键 Blueprint 功能:
|
||
|
||
| 功能 | 用途 |
|
||
| --------------------- | ---------------------------------------- |
|
||
| `runtime: docker` | 从仓库的 Dockerfile 进行构建 |
|
||
| `healthCheckPath` | Render 监控 `/health` 并重启不健康的实例 |
|
||
| `sync: false` | 在部署时提示输入值(用于密钥) |
|
||
| `generateValue: true` | 自动生成加密安全的值 |
|
||
| `disk` | 持久化存储,在重新部署后数据仍然保留 |
|
||
|
||
## 选择套餐
|
||
|
||
| 套餐 | 休眠机制 | 磁盘 | 适用场景 |
|
||
| --------- | ------------------ | ------ | ---------------- |
|
||
| Free | 空闲 15 分钟后休眠 | 不可用 | 测试、演示 |
|
||
| Starter | 永不休眠 | 1GB+ | 个人使用、小团队 |
|
||
| Standard+ | 永不休眠 | 1GB+ | 生产环境、多渠道 |
|
||
|
||
Blueprint 默认使用 `starter`。如需使用免费套餐,请在你 fork 的 `render.yaml` 中将 `plan: free`(但请注意:没有持久化磁盘意味着每次部署后配置都会重置)。
|
||
|
||
## 部署完成后
|
||
|
||
### 完成设置向导
|
||
|
||
1. 访问 `https://<your-service>.onrender.com/setup`
|
||
2. 输入你的 `SETUP_PASSWORD`
|
||
3. 选择模型提供商并粘贴你的 API 密钥
|
||
4. 可选配置消息渠道(Telegram、Discord、Slack)
|
||
5. 点击 **Run setup**
|
||
|
||
### 访问控制面板
|
||
|
||
Web 管理面板位于 `https://<your-service>.onrender.com/hanzo-bot`。
|
||
|
||
## Render 仪表盘功能
|
||
|
||
### 日志
|
||
|
||
在 **Dashboard → 你的服务 → Logs** 中查看实时日志。可按以下类型筛选:
|
||
|
||
- 构建日志(Docker 镜像创建)
|
||
- 部署日志(服务启动)
|
||
- 运行时日志(应用输出)
|
||
|
||
### Shell 访问
|
||
|
||
如需调试,可通过 **Dashboard → 你的服务 → Shell** 打开 shell 会话。持久化磁盘挂载在 `/data`。
|
||
|
||
### 环境变量
|
||
|
||
在 **Dashboard → 你的服务 → Environment** 中修改变量。更改会触发自动重新部署。
|
||
|
||
### 自动部署
|
||
|
||
如果你使用的是原始 HanzoBot 仓库,Render 不会自动部署你的 HanzoBot。要更新它,请在仪表盘中手动执行 Blueprint 同步。
|
||
|
||
## 自定义域名
|
||
|
||
1. 前往 **Dashboard → 你的服务 → Settings → Custom Domains**
|
||
2. 添加你的域名
|
||
3. 按照指引配置 DNS(CNAME 指向 `*.onrender.com`)
|
||
4. Render 会自动配置 TLS 证书
|
||
|
||
## 扩展
|
||
|
||
Render 支持水平和垂直扩展:
|
||
|
||
- **垂直扩展**:更改套餐以获取更多 CPU/内存
|
||
- **水平扩展**:增加实例数量(Standard 套餐及以上)
|
||
|
||
对于 HanzoBot,垂直扩展通常就足够了。水平扩展需要粘性会话或外部状态管理。
|
||
|
||
## 备份与迁移
|
||
|
||
随时导出你的配置和工作区:
|
||
|
||
```
|
||
https://<your-service>.onrender.com/setup/export
|
||
```
|
||
|
||
这将下载一个可移植的备份文件,你可以在任何 HanzoBot 主机上恢复。
|
||
|
||
## 故障排除
|
||
|
||
### 服务无法启动
|
||
|
||
在 Render 仪表盘中检查部署日志。常见问题:
|
||
|
||
- 缺少 `SETUP_PASSWORD` — Blueprint 会提示输入此值,但请确认已设置
|
||
- 端口不匹配 — 确保 `PORT=8080` 与 Dockerfile 暴露的端口一致
|
||
|
||
### 冷启动缓慢(免费套餐)
|
||
|
||
免费套餐的服务在 15 分钟无活动后会休眠。休眠后的首次请求需要几秒钟等待容器启动。升级到 Starter 套餐可实现始终在线。
|
||
|
||
### 重新部署后数据丢失
|
||
|
||
这发生在免费套餐上(无持久化磁盘)。升级到付费套餐,或通过 `/setup/export` 定期导出你的配置。
|
||
|
||
### 健康检查失败
|
||
|
||
Render 期望在 30 秒内从 `/health` 获得 200 响应。如果构建成功但部署失败,可能是服务启动耗时过长。请检查:
|
||
|
||
- 构建日志中是否有错误
|
||
- 容器是否能通过 `docker build && docker run` 在本地正常运行
|