phase 5 prep: backfill-users.ts + deployment runbook in .memory
- scripts/backfill-users.ts: 扫 PG users 表,对每人幂等调 orchestrator POST /users - orchestrator/package.json: 加 postgres 依赖 - .memory/project.md: Phase 3/4 完成状态,Phase 5 上线 checklist Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -81,18 +81,35 @@ Debian 13 默认 Python 3.13(不是计划的 3.12)。不影响功能,更新。
|
||||
- **不预装** pandas/numpy/torch/playwright/ffmpeg/libreoffice
|
||||
- LLM 按需 `uv pip install xxx` — 后续加本地 PyPI 缓存镜像让它快到秒级(尚未做,列在 TODO)
|
||||
|
||||
## 进度(2026-04-18)
|
||||
## 进度(2026-04-19 更新)
|
||||
|
||||
- ✅ Phase 0 Pre-flight(VPS 摸底:31GB RAM / 387GB 磁盘 / Incus 6.0.0 / hermes-box 已跑)
|
||||
- ✅ Phase 1 宿主初始化(btrfs pool + project + profile + **UFW iptables 修复并持久化**)
|
||||
- 🔄 **Phase 2 base 镜像构建**(apt 完成,Node 20 安装中/卡)
|
||||
- 已装:python3.13, build-essential, git, curl, ripgrep, fd, bat, 中文字体, tzdata, locale
|
||||
- 已装:nodejs 20.20.2(via NodeSource)
|
||||
- **待装**:corepack + uv + bun + sandbox 用户 + /workspace + publish
|
||||
- **已踩的坑**:用 `nohup bash -s <<EOF &` 跑后台任务,SSH 断开时脚本跟着死。应改 `systemd-run --unit=xxx` 或 `setsid` 真正脱离 shell
|
||||
- ⏸ Phase 3 Orchestrator 服务(Bun HTTP,15 工具)
|
||||
- ⏸ Phase 4 LobeChat 侧接入(4 文件小改)
|
||||
- ⏸ Phase 5 存量补建 + 联调 + 上线
|
||||
- ✅ Phase 2 base 镜像 `lobe-sandbox-base` 已发布(500MiB,fingerprint `de8d9b6b73c4`)
|
||||
- Debian 13 trixie + Python 3.13.5 + Node 20.20.2 + Bun 1.3.12 + uv 0.11.7 + git/ripgrep/fd/bat + 中文字体 + zh_CN locale
|
||||
- **两个坑踩过并写进脚本**:
|
||||
1. `INSTALL_DIR` 装 uv 无效,要用 `UV_INSTALL_DIR` 环境变量
|
||||
2. `nohup bash -s <<EOF &` 脱不开 SSH,后续全改 `systemd-run --unit=xxx --slice=system.slice`
|
||||
- ✅ Phase 3 Orchestrator(Bun + Hono,已部署 VPS systemd)
|
||||
- 服务:`sandbox-orchestrator.service` 监听 `127.0.0.1:8700`
|
||||
- 配置:`/etc/lobe-sandbox/orchestrator.env`(含 SANDBOX_ORCH_SECRET)
|
||||
- 端到端验证:POST /users → executeCode → runCommand + uv pip install numpy → writeLocalFile → listLocalFiles 全 OK
|
||||
- 已实现 13 工具(executeCode/runCommand/readLocalFile/writeLocalFile/editLocalFile/listLocalFiles/moveLocalFiles/renameLocalFile/searchLocalFiles/grepContent/globLocalFiles + ensureRunning 逻辑 + 30min idle reaper + HMAC auth + S3 export 占位)
|
||||
- **长驻命令(getCommandOutput/killCommand)留到 v2**,当前 runCommand 是同步 2min 超时
|
||||
- ✅ Phase 4 LobeChat 侧接入代码已提交(分支 `feat/self-hosted-sandbox`,commit `12b53e90b1`)
|
||||
- `src/envs/app.ts` 新增 `SANDBOX_BACKEND_URL` + `SANDBOX_BACKEND_SECRET`
|
||||
- `src/server/services/sandbox/localSandbox.ts` 新 LocalSandboxService
|
||||
- `src/server/services/toolExecution/serverRuntimes/cloudSandbox.ts` env 分叉
|
||||
- `src/libs/better-auth/define-config.ts` user.create.after 追加 provision(fire-and-forget)
|
||||
- **注意**: main 分支 pre-commit 会跑全量 tsc 撑爆内存 + 碰到别人的 pre-existing TS 错误,所以必须在 feature branch 上 commit
|
||||
- ⏸ Phase 5 待做(上线):
|
||||
- [ ] 确定 LobeChat docker 容器访问 orchestrator 的网络路径(host.docker.internal / docker0 网关 172.17.0.1 / 绑 0.0.0.0 + UFW 限制)
|
||||
- [ ] merge `feat/self-hosted-sandbox` 到 main(需先解决 main 上别人的 pre-existing TS 错误,或单独 deploy 这个 branch)
|
||||
- [ ] Coolify 里 LobeChat 容器加 `SANDBOX_BACKEND_URL` + `SANDBOX_BACKEND_SECRET` 环境变量
|
||||
- [ ] 重启 LobeChat(一次性,不要频繁重启)
|
||||
- [ ] 跑 `scripts/backfill-users.ts` 给存量用户补建沙箱
|
||||
- [ ] exportFile 接入:当前 `S3_ENDPOINT=192.168.2.221:9000` 是内网,VPS 够不着 → 改用 LobeChat 同机上的 RustFS(`lobemile2026/RustFS@2026MileSecure`)
|
||||
- [ ] 端到端 smoke:用户 ai.milejoy.com 发"写个 Python 打印 hello" → 查 orchestrator 日志命中 → 不是 market.lobehub.com
|
||||
|
||||
## 关键路径速查
|
||||
|
||||
|
||||
@@ -160,6 +160,13 @@
|
||||
"message": "orchestrator MVP: 13 工具跑通 + systemd + 部署脚本",
|
||||
"hash": "ce8e22f",
|
||||
"files_changed": 1
|
||||
},
|
||||
{
|
||||
"ts": "2026-04-19T21:12:27+08:00",
|
||||
"type": "commit",
|
||||
"message": "auto-save 2026-04-19 21:12 (~1)",
|
||||
"hash": "e7155b7",
|
||||
"files_changed": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user