部署与运维
生产环境部署、守护进程与一键启动配置
本指南介绍如何在生产环境中部署和管理 Crab Claw。
系统要求
| 项目 | 最低要求 | 推荐 |
|---|---|---|
| 操作系统 | macOS 13+ / Ubuntu 22.04+ / Windows 10+ | macOS 14+ / Ubuntu 24.04 |
| 内存 | 2 GB | 4 GB+ |
| 磁盘 | 1 GB | 10 GB+(含模型缓存) |
| Go | 1.22+(从源码构建) | — |
| Rust | 1.75+(从源码构建) | — |
守护进程
安装守护进程
# 安装并启用守护进程
crabclaw daemon install
# 启动
crabclaw daemon start
# 停止
crabclaw daemon stop
# 卸载
crabclaw daemon uninstall# 安装并启用守护进程
crabclaw daemon install
# 启动
crabclaw daemon start
# 停止
crabclaw daemon stop
# 卸载
crabclaw daemon uninstall平台实现
| 平台 | 守护方式 | 配置文件位置 |
|---|---|---|
| macOS | launchd | ~/Library/LaunchAgents/com.acosmi.crabclaw.plist |
| Linux | systemd | ~/.config/systemd/user/crabclaw.service |
| Windows | schtasks | 计划任务 CrabClaw Gateway |
端口配置
| 端口 | 服务 | 默认值 |
|---|---|---|
| Gateway 主端口 | WebSocket RPC + HTTP | 19001 |
| Browser Control | 浏览器控制服务 | 19002 |
| Extension Relay | 浏览器扩展中继 | 19004 |
| Control UI | Web 管理界面 | 18789 |
在 crabclaw.json 中自定义:
{
"gateway": {
"port": 19001
}
}{
"gateway": {
"port": 19001
}
}TLS 配置
启用 TLS 加密通信:
{
"gateway": {
"tls": {
"enabled": true,
"certFile": "/path/to/cert.pem",
"keyFile": "/path/to/key.pem"
}
}
}{
"gateway": {
"tls": {
"enabled": true,
"certFile": "/path/to/cert.pem",
"keyFile": "/path/to/key.pem"
}
}
}多节点部署
Crab Claw 支持多节点联邦架构:
# 在主节点上添加远程节点
crabclaw nodes add --name worker-1 --host 192.168.1.100
# 查看节点状态
crabclaw nodes list# 在主节点上添加远程节点
crabclaw nodes add --name worker-1 --host 192.168.1.100
# 查看节点状态
crabclaw nodes list节点间通过 TLS + mDNS 自动发现和安全通信。
Docker 部署
# 使用官方镜像
docker run -d \
--name crabclaw \
-p 19001:19001 \
-p 18789:18789 \
-v ~/.crabclaw:/root/.crabclaw \
acosmi/crabclaw:latest# 使用官方镜像
docker run -d \
--name crabclaw \
-p 19001:19001 \
-p 18789:18789 \
-v ~/.crabclaw:/root/.crabclaw \
acosmi/crabclaw:latest日志管理
# 查看实时日志
crabclaw logs
# 查看历史日志
crabclaw logs --since 1h
# 按模块过滤
crabclaw logs --filter gateway
crabclaw logs --filter channels# 查看实时日志
crabclaw logs
# 查看历史日志
crabclaw logs --since 1h
# 按模块过滤
crabclaw logs --filter gateway
crabclaw logs --filter channels日志文件位置: ~/.crabclaw/logs/
健康检查
# 全面诊断
crabclaw doctor
# 查看系统状态
crabclaw status# 全面诊断
crabclaw doctor
# 查看系统状态
crabclaw statuscrabclaw doctor 会检查:
- Gateway 进程状态
- 模型提供商连通性
- 频道连接状态
- 磁盘空间和端口占用
- 浏览器可用性
备份与恢复
关键数据目录:
| 路径 | 内容 |
|---|---|
~/.crabclaw/crabclaw.json | 主配置文件 |
~/.crabclaw/agents/ | 智能体工作区 |
~/.crabclaw/state/ | 运行时状态 |
~/.crabclaw/memory/ | UHMS 记忆数据 |
建议定期备份整个 ~/.crabclaw/ 目录。