Rename shared backend to Bedrock [skip ci]

This commit is contained in:
2026-11-19 19:30:05 +08:00
parent 3bc3051383
commit 6fcfbf1def
21 changed files with 42 additions and 40 deletions
+2 -2
View File
@@ -46,13 +46,13 @@ docker run -d --name "$worker" --init --network bridge --user 1000:1000 \
--tmpfs /tmp:rw,nosuid,nodev,size=128m --tmpfs /work:ro,nosuid,nodev \
--tmpfs /home/node/.codex:rw,nosuid,nodev,size=32m,uid=1000,gid=1000 --workdir /work \
-e "FOUNDRY_CANVAS_IMAGE_MODELS=$FOUNDRY_CANVAS_IMAGE_MODELS" \
--mount "type=bind,source=$binary,target=/opt/foundry,readonly" \
--mount "type=bind,source=$binary,target=/opt/bedrock,readonly" \
--mount "type=bind,source=$cli,target=/opt/codex,readonly" \
--mount "type=bind,source=$login/auth.json,target=/home/node/.codex/auth.json,readonly" \
--mount "type=bind,source=$login/models_cache.json,target=/home/node/.codex/models_cache.json,readonly" \
--mount "type=bind,source=$scratch/run,target=/run/foundry-codex" \
--mount type=bind,source=/etc/ssl/certs/ca-certificates.crt,target=/etc/ssl/certs/ca-certificates.crt,readonly \
node:24-bookworm-slim /opt/foundry codex-worker >/dev/null
node:24-bookworm-slim /opt/bedrock codex-worker >/dev/null
for attempt in {1..30}; do if [[ -S "$scratch/run/worker.sock" ]]; then break; fi; sleep 1; done
test -S "$scratch/run/worker.sock"
+3 -3
View File
@@ -27,16 +27,16 @@ if [[ -s "$dir/canvas.env" ]]; then canvas_env=(--env-file "$dir/canvas.env"); f
# CLI/二进制只读挂载,Core 只看到 socket,不共享本登录目录。
# 容器参数分工:--init 负责子进程收尾,资源上限限制进程数/内存,cap-drop 与 no-new-privileges 收紧权限。
# /tmp 可写用于临时任务,/work 只读且设为工作目录;没有 -p,因此不向宿主发布 worker 的 TCP 端口。
# 挂载中 /opt/foundry 是 Go worker,/opt/codex 是预装 Node CLI;执行 CLI 才是这里需要 Node 环境的原因。
# 挂载中 /opt/bedrock 是 Go worker,/opt/codex 是预装 Node CLI;执行 CLI 才是这里需要 Node 环境的原因。
# 最后一行的 codex-worker 参数选中 main.go 的 worker 分支,而不是启动普通 Foundry HTTP API。
docker run -d --name foundry-codex-worker --restart unless-stopped --init \
--network bridge --user 1000:1000 --cap-drop ALL --security-opt no-new-privileges \
--read-only --pids-limit 128 --memory 1g --tmpfs /tmp:rw,nosuid,nodev \
--tmpfs /work:ro,nosuid,nodev --workdir /work \
--mount "type=bind,source=$binary,target=/opt/foundry,readonly" \
--mount "type=bind,source=$binary,target=/opt/bedrock,readonly" \
--mount "type=bind,source=$base/codex-cli,target=/opt/codex,readonly" \
--mount "type=bind,source=$dir/home,target=/home/node/.codex" \
--mount "type=bind,source=$dir/run,target=/run/foundry-codex" \
--mount "type=bind,source=/etc/ssl/certs/ca-certificates.crt,target=/etc/ssl/certs/ca-certificates.crt,readonly" \
"${canvas_env[@]}" \
node:24-bookworm-slim /opt/foundry codex-worker
node:24-bookworm-slim /opt/bedrock codex-worker
+5 -5
View File
@@ -63,7 +63,7 @@ python3 "$(dirname "$0")/migrate.py"
# 每次发布使用独立二进制目录供只读挂载;本脚本不清除旧 release 目录。
release=$(mktemp -d "$foundry/release.XXXXXXXX")
install -m 755 "$1" "$release/foundry"
install -m 755 "$1" "$release/bedrock"
# 容器内监听全部接口供同网络的代理访问;端口 8080 没有在此发布到宿主公网,TLS 由 Traefik 处理。
export HOST=0.0.0.0 PORT=8080 PUBLIC_ORIGIN="$origin"
@@ -113,7 +113,7 @@ if [[ -d "$codex_dir" ]]; then
# 用当前 release 的同一份 Go 二进制启动 worker,避免 Core/worker 的画布产物协议不一致。
# 目录探测只验证 socket 和非空模型目录,不执行一次真实生成,也不验证模型账户额度。
worker_ready=false
if bash "$(dirname "$0")/codex-worker.sh" "$release/foundry" >/dev/null; then
if bash "$(dirname "$0")/codex-worker.sh" "$release/bedrock" >/dev/null; then
for attempt in {1..20}; do
if docker exec foundry-codex-worker node -e '
const http = require("node:http");
@@ -157,7 +157,7 @@ if [[ -d "$codex_dir" ]]; then
)
fi
# 使用现成 node 镜像作为运行载体,实际启动 /opt/foundry 这个 Go 可执行文件,不在此 docker build。
# 使用现成 node 镜像作为运行载体,实际启动 /opt/bedrock 这个 Go 可执行文件,不在此 docker build。
# Node 供就绪探测使用;CA bundle 供 Go 的 HTTPS 客户端使用,二者的证书来源不能混为一谈。
# Core 只挂载 IPC/授权表,不挂载 CLI 登录;以非 root、只读根文件系统和裁剪能力运行。
docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack_env[@]}" "${research_env[@]}" --network "$network" \
@@ -167,8 +167,8 @@ docker run -d --name "$candidate" "${codex_mounts[@]}" "${mail_env[@]}" "${slack
--read-only --memory 1g \
--mount "type=bind,source=$ca_bundle,target=/etc/ssl/certs/ca-certificates.crt,readonly" \
-e SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
--mount "type=bind,source=$release/foundry,target=/opt/foundry,readonly" \
node:24-bookworm-slim /opt/foundry >/dev/null
--mount "type=bind,source=$release/bedrock,target=/opt/bedrock,readonly" \
node:24-bookworm-slim /opt/bedrock >/dev/null
# 候选或路由失败时删除本次新 Core;旧 Core 由 route 成功探测后才停止。
cleanup_candidate() {