#!/usr/bin/env bash # Whole-library capture entry point for the RDS-backed WeKnora 0.9.0 test stack # (Compose project weknora-v090). # # Why a separate file instead of a parameterised one: this stack has no source # PostgreSQL container and no governance PostgreSQL container. Both databases are # managed instances (RDS). -source-pg / -governance-pg are therefore passed empty, # which is libraryctl's documented signal to resolve them from the source app # container env (DB_HOST/DB_PORT/DB_NAME/DB_USER/DB_PASSWORD + LIBRARY_SOURCE_DB_SSLMODE) # and from LIBRARY_GOVERNANCE_DSN_FILE (0600 file). Keeping the 0.7.1 entry point # untouched means a change here can never alter a stack that already ran. # # 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 at call time (container env / 0600 file) and are never # printed. Nothing here writes to the source stack except SIGTERM/SIGSTART of the # declared writer. set -euo pipefail # The binary is pinned by the caller on purpose: there is no "whatever is in this # directory" fallback, so a stale build next to the script cannot be executed by # accident against a live stack. BIN="${LIBRARYCTL_BIN:-}" if [ -z "$BIN" ]; then echo "LIBRARYCTL_MISSING: set LIBRARYCTL_BIN to the libraryctl binary built for this run" >&2 exit 1 fi if [ ! -x "$BIN" ]; then echo "LIBRARYCTL_NOT_EXECUTABLE: $BIN is not an executable file" >&2 exit 1 fi # Archives/journals live outside the home directory on this host (they survive the # operator account); both roots stay overridable for an isolated rehearsal. ARCHIVE_ROOT="${LIBRARY_ARCHIVE_ROOT:-/var/lib/knowledge-governance/library}" JOURNAL_ROOT="${LIBRARY_JOURNAL_ROOT:-/var/lib/knowledge-governance/freeze}" # Reasons must not contain commas: the flag is comma-separated. NON_WRITERS="frontend=UI only; no knowledge writes" NON_WRITERS+=",docreader=parse RPC service; app persists parse output" NON_WRITERS+=",elasticsearch=search store; not an initiator" NON_WRITERS+=",redis=queue/cache store; not an initiator" exec "$BIN" "$@" \ -project weknora-v090 \ -writers app \ -source-app weknora-v090-app \ -source-es weknora-v090-elasticsearch \ -source-pg "" \ -governance-pg "" \ -non-writers "$NON_WRITERS" \ -archive "$ARCHIVE_ROOT" \ -journal "$JOURNAL_ROOT"