build(docker): static ffprobe, --allow-run=ffprobe,sha256sum, three supervised processes
entrypoint runs api + worker (io) + worker:agent; compose/runbooks document WORKER_CONCURRENCY, WORKER_AGENT_CONCURRENCY, ORGANIZE_WALK_MAX_FILES. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f6457a29db
commit
3792868816
8 files changed
+78
-21
No files matched your search
@@ -20,3 +20,9 @@ BACKUP_KEEP=14
|
||||
LOG_LEVEL=info
|
||||
# APP_VERSION=v0.1.0
|
||||
# 国内网络构建换源(可选):APT_MIRROR=mirrors.ustc.edu.cn
|
||||
|
||||
# worker 并发(可选):io 组(下载提交/入库复制/缓存清理/资产对账/抓取)与 agent 组(Agent 会话)分池
|
||||
# WORKER_CONCURRENCY=4
|
||||
# WORKER_AGENT_CONCURRENCY=2
|
||||
# 手动按路径整理时递归遍历的文件数上限(dryRun 超出返回 truncated,正式执行拒绝)
|
||||
# ORGANIZE_WALK_MAX_FILES=5000
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# 容器入口。
|
||||
# root 启动:建好 DATA_DIR 子目录、按 PUID/PGID 修正属主,再用 gosu 降权重跑自己(二进制与 /app 保持 root 只读)。
|
||||
# serve(缺省):迁移 → 启动自检 → api 与 worker 两个进程互相看护。
|
||||
# serve(缺省):迁移 → 启动自检 → api、worker(io 组)、worker:agent(Agent 会话)三个进程互相看护。
|
||||
# 任一进程退出就停掉另一个并以非 0 退出,把"半死容器"变成整体退出,交给 restart 策略自愈。
|
||||
# backup / restore <备份目录> / migrate / preflight / export-mappings ...:一次性子命令(降权后执行)。
|
||||
# 其它参数原样 exec(例如 bash)。
|
||||
@@ -45,14 +45,17 @@ esac
|
||||
api_pid=$!
|
||||
"$BIN" --role worker &
|
||||
worker_pid=$!
|
||||
"$BIN" --role worker:agent &
|
||||
agent_pid=$!
|
||||
pids=("$api_pid" "$worker_pid" "$agent_pid")
|
||||
|
||||
stop_all() {
|
||||
kill -TERM "$api_pid" "$worker_pid" 2>/dev/null || true
|
||||
wait "$api_pid" "$worker_pid" 2>/dev/null || true
|
||||
kill -TERM "${pids[@]}" 2>/dev/null || true
|
||||
wait "${pids[@]}" 2>/dev/null || true
|
||||
}
|
||||
|
||||
on_signal() {
|
||||
echo "entrypoint: 收到 $1,停止 api 与 worker" >&2
|
||||
echo "entrypoint: 收到 $1,停止 api / worker / worker:agent" >&2
|
||||
stop_all
|
||||
exit 0
|
||||
}
|
||||
@@ -60,7 +63,7 @@ trap 'on_signal SIGTERM' TERM
|
||||
trap 'on_signal SIGINT' INT
|
||||
|
||||
set +e
|
||||
wait -n "$api_pid" "$worker_pid"
|
||||
wait -n "${pids[@]}"
|
||||
code=$?
|
||||
set -e
|
||||
echo "entrypoint: 有进程退出(code=$code),停止其余进程" >&2
|
||||
|
||||
Reference in new issue
Block a user