chore: add offline backend wheelhouse deployment

This commit is contained in:
吉鑫升 committed 2026-07-21 14:35:06 +08:00
1 parent f485d4fff3
commit f8cb7be18c
6 files changed
+370

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
# DeerFlow 离线后端部署补充
本目录提供一套与 `start_backend_offline.sh` 配套的 wheelhouse 流程,用于在联网机器准备 Python 依赖,再将整个发布目录复制到无网络服务器运行。
## 文件
- `offline-runtime-requirements.txt`:启动时补装的固定版本依赖。
- `prepare_wheelhouse.sh`:联网机器下载 Linux/Python 3.12 wheel,并验证传递依赖完整性。
- `start_backend_offline.sh`:从本地 wheelhouse 补装依赖后启动 Docker 后端。
- `wheelhouse/`:下载脚本生成;应与启动脚本一起复制到离线机。
## 联网机器准备
默认目标是后端镜像使用的 CPython 3.12、Linux x86_64:
```bash
cd offline-backend-20260512
bash prepare_wheelhouse.sh
```
脚本固定下载:
- `croniter==6.2.2`
- `hindsight-client==0.6.2`
- `redis==5.2.1`
- 上述包在 Python 3.12/Linux x86_64 下的 19 个传递依赖;版本也已全部锁定在 `offline-runtime-requirements.txt`
国内镜像示例:
```bash
PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple bash prepare_wheelhouse.sh
```
ARM64 镜像需要改目标平台:
```bash
TARGET_PLATFORM=manylinux2014_aarch64 bash prepare_wheelhouse.sh
```
下载完成后,`wheelhouse/SHA256SUMS` 可用于离线机校验文件完整性。
## 离线机器启动
确保发布目录还包含 Docker 镜像 tar、`.env`、`config.yaml`、`skill_evolution.json` 和 `backend/`,然后运行。`extensions_config.json` 与 `skills/` 会优先从发布根目录读取,不存在时自动回退到 `backend/`:
```bash
cd offline-backend-20260512
bash start_backend_offline.sh
docker logs -f deerflow-backend
```
只检查目录、配置项、wheel 和 checksum,不操作容器:
```bash
PREFLIGHT_ONLY=1 bash start_backend_offline.sh
```
启动脚本只使用 `/app/wheelhouse`,不会访问 PyPI。它会验证 checksum,并在镜像虚拟环境缺包时一次性安装三个固定版本的运行时包。
## Redis 说明
`redis==5.2.1` 只是 Python 客户端,不包含 Redis 服务端。`config.yaml` 中 `concurrency.redis.enabled: false` 时无需部署 Redis;启用后必须另行准备可访问的 Redis 服务或离线 Redis Docker 镜像。
如果 Redis 运行在另一个容器,`redis://127.0.0.1:6379/0` 指向的是后端容器自身,不能直接使用。应将两个容器加入同一个 Docker network,并把 URL 改成类似 `redis://redis:6379/0`,同时为不同环境设置不同的 `namespace`。