Files
knowledge-governance/scripts/library-capture.sh
T
姚章浩 045fc44f0e
build / build (push) Failing after 19s
feat(library): 接通整库封存真实入口与只读版本页
- libraryctl:status/preflight/capture/list/verify/recover,只读来源会话、
  结清检查、契约推导、维护窗口内停写者、导出十表+索引+对象+Wiki、封存候选后恢复
- libraryfreeze.ProjectController:按 Compose 项目逐服务声明固定身份,
  未声明服务/容器重建即拒绝,仅 SIGTERM,恢复后必须 healthy
- httpapi:GET /api/v1/library/snapshots[/{id}] 只读列出封存产物
- web:「整库版本」页(只读、未接线显示原因、无假按钮)
- api:LIBRARY_ARCHIVE_ROOT + 归档根只读挂载
- docs/library-capture.md:运维手册与 2026-10-28 两次真实封存实测

不代表整库业务验收通过:内容/问答/性能验收、跨系统切点、Wiki 删除语义重算、
生产预备份/恢复演练/双闸/同步协调仍未完成。
2026-10-28 11:39:50 +08:00

42 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Whole-library capture entry point for the local WKNFull test stack.
#
# Every service of the Compose project is declared below: exactly one writer
# (app) and a reason for each sibling which must NOT be stopped. ProjectController
# refuses to run if the project gains a service that is not declared here, so a
# new container cannot be silently left outside the maintenance window.
#
# Credentials are read from the running containers at call time and are never
# printed. Nothing here writes to the source stack except SIGTERM/SIGSTART of the
# declared writer.
set -euo pipefail
ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
BIN="${LIBRARYCTL_BIN:-$ROOT/libraryctl}"
if [ ! -x "$BIN" ]; then
echo "LIBRARYCTL_MISSING: build it with 'go build -o libraryctl ./cmd/libraryctl'" >&2
exit 1
fi
# Reasons must not contain commas: the flag is comma-separated.
NON_WRITERS="frontend=UI only; no knowledge writes"
NON_WRITERS+=",mcp=read-only MCP server"
NON_WRITERS+=",dobotai-target=alpine placeholder; no knowledge writes"
NON_WRITERS+=",docreader=parse RPC service; app persists parse output and settlement requires zero pending ops"
NON_WRITERS+=",elasticsearch=search store; not an initiator"
NON_WRITERS+=",postgres=database store; not an initiator"
NON_WRITERS+=",redis=queue/cache store; not an initiator"
NON_WRITERS+=",neo4j=graph store; not an initiator"
NON_WRITERS+=",langfuse-web=LLM observability UI"
NON_WRITERS+=",langfuse-worker=LLM observability worker; own storage"
NON_WRITERS+=",langfuse-clickhouse=observability store"
NON_WRITERS+=",langfuse-minio=observability object store"
NON_WRITERS+=",langfuse-db-init=one-shot init; exited"
NON_WRITERS+=",searxng=read-only search proxy"
NON_WRITERS+=",searxng-init=one-shot init; exited"
exec "$BIN" "$@" \
-source-app WKNFull-app \
-source-pg WKNFull-postgres \
-source-es WKNFull-elasticsearch \
-governance-pg knowledge-governance-p1-postgres-1 \
-project weknora071full \
-writers app \
-non-writers "$NON_WRITERS"