基于 OpenClaw + WireGuard 的生产级部署方案
本指南介绍如何在多台服务器上部署 FSC 集群,结合 OpenClaw 实现智能任务调度。
| 项目 | 用途 |
|---|---|
| Full Self Coding | 多Agent并行代码修复 |
| OpenClaw | Agent调度与Session管理 |
| WireGuard | 内网VPN互联 |
| 节点 | 角色 | 说明 |
|---|---|---|
| 节点1 | 调度中心 | 运行 OpenClaw Gateway |
| 节点2 | 执行节点 | Claude Code Agent |
| 节点3 | 执行节点 | Gemini CLI Agent |
所有节点执行:
# 安装 Bun
curl -fsSL https://bun.sh/install | bash
echo 'registry = "https://registry.npmjs.org/"' > ~/.bunfig.toml
# 安装 Docker
dnf install -y podman-docker # OpenCloudOS/CentOS
# 或
apt-get install -y docker.io # Ubuntu/Debian
# 安装 WireGuard
dnf install -y wireguard-tools生成密钥:
wg genkey | tee private.key | wg pubkey > public.key配置 /etc/wireguard/wg0.conf:
[Interface]
PrivateKey = <你的PrivateKey>
Address = <本机IP>/24
ListenPort = 51820
[Peer]
PublicKey = <对端PublicKey>
Endpoint = <对端IP>:51820
AllowedIPs = <对端内网IP>/32
PersistentKeepalive = 25启动:
wg-quick up wg0
systemctl enable wg-quick@wg0git clone https://github.com/2233admin/full-self-coding.git
cd full-self-coding
bun install# 生成专用密钥
ssh-keygen -t rsa -b 4096 -f ~/.ssh/fsc_cluster
# 复制到其他节点
ssh-copy-id -i ~/.ssh/fsc_cluster.pub root@<节点2_IP>
ssh-copy-id -i ~/.ssh/fsc_cluster.pub root@<节点3_IP># 在调度节点配置 OpenClaw Gateway
openclaw gateway start| 任务类型 | 默认路由节点 |
|---|---|
| code-fix | 节点2 (Claude) |
| analysis | 节点3 (Gemini) |
| bug-fix | 节点2 (Claude) |
| optimize | 节点3 (Gemini) |
# 本地执行
python3 fsc_wrapper.py --target /path/to/project --task-type code-fix
# 远程执行
ssh -i ~/.ssh/fsc_cluster root@<节点2_IP> "cd /path/to/fsc && python3 fsc_wrapper.py --task-type code-fix"export ANTHROPIC_API_KEY="sk-ant-..."
export GEMINI_API_KEY="AIza..."创建 ~/.config/full-self-coding/config.json:
{
"agentType": "claude-code",
"anthropicAPIKey": "${ANTHROPIC_API_KEY}",
"googleGeminiApiKey": "${GEMINI_API_KEY}",
"maxParallelDockerContainers": 5,
"maxDockerContainers": 10,
"dockerMemoryMB": 2048,
"dockerCpuCores": 2
}# 检查状态
wg show wg0
# 测试连通性
ping -c 2 <对端内网IP># 查看容器日志
docker logs <container_id>
# 查看运行中的容器
docker ps -a本项目基于 GPL v2 许可证发布。