docs: explain deployment stages and separate comment sections [skip ci]
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 远程私有 worker 启动器;使用与 Core 同一二进制的 codex-worker 模式,CLI 和登录目录由运维预先提供。
|
||||
set -euo pipefail
|
||||
|
||||
# 参数一是已经构建好的 Go 程序;realpath 把挂载源固定为绝对路径,Docker 不会替这里编译源码。
|
||||
base=/opt/endoleap-infra
|
||||
dir=$base/foundry/codex
|
||||
binary=$(realpath "$1")
|
||||
|
||||
# 启动前检查可执行文件、专用 CLI 登录和项目授权表;本脚本不执行登录流程,也不生成授权令牌。
|
||||
test -x "$binary"
|
||||
test -s "$dir/home/auth.json"
|
||||
test -s "$dir/grants/projects.json"
|
||||
|
||||
# socket 目录归容器 uid 1000,socket 本身由服务设为 0600;不公布宿主 TCP 端口。
|
||||
install -d -m 700 "$dir/run"
|
||||
chown 1000:1000 "$dir/run"
|
||||
@@ -20,6 +25,10 @@ if [[ -s "$dir/canvas.env" ]]; then canvas_env=(--env-file "$dir/canvas.env"); f
|
||||
# The Docker default bridge supplies egress independently of Foundry's network.
|
||||
# 单 worker 使用独立 bridge 出网,根文件系统只读;临时任务写 /tmp,登录目录需允许 CLI 自身状态更新。
|
||||
# CLI/二进制只读挂载,Core 只看到 socket,不共享本登录目录。
|
||||
# 容器参数分工:--init 负责子进程收尾,资源上限限制进程数/内存,cap-drop 与 no-new-privileges 收紧权限。
|
||||
# /tmp 可写用于临时任务,/work 只读且设为工作目录;没有 -p,因此不向宿主发布 worker 的 TCP 端口。
|
||||
# 挂载中 /opt/foundry 是 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 \
|
||||
|
||||
Reference in New Issue
Block a user