Files
NODEDC_PLATFORM/infra/cms-deploy/README.md
T

66 lines
6.1 KiB
Markdown

# CMS Git deployment domain
Source: SILVER/DC_CMS, repository 33, master. Push → qualification → Gitea artifact → outbound durable queue → canonical installer.
The Device Core runner is scoped only to its own repository. CMS therefore registers its own build-runner in project nodedc-cms-ci, with the accepted Synology v4 resource and isolation profile. Existing Device Core registration, source and units are untouched. Both pinned images must already exist; bootstrap pulls neither. New runner registration is repository-scoped, staged separately from artifacts, imported to root0600 and removed from handoff storage. No credentials appear in Git, receipts or workflow artifacts.
`dc-cms-autodeploy` bootstraps exactly three source files under /volume1/docker/nodedc-cms-autodeploy, one build-runner service and two systemd units. Root-private queue state is /var/lib/nodedc-cms-autodeploy. Its read-only Gitea client uses the existing private Device Core read identity without copying it; preflight checks actual access to repository 33. The installed canonical receipt gates polling. Bootstrap preserves all preexisting containers and CMS data; rollback removes only the new runner/units/source partition, retaining private enrollment and queue for diagnosis.
`dc-cms-release` allows only flat admin/server application files and two exact dependency files. The initial predecessor is original CMS commit 4c6f133 with SMB-verified hashes in baseline.json. Foundation pins adm-zip 0.6.1 in foundation.json to fix known ZIP vulnerabilities. No later dependency, Dockerfile, Compose or Caddy change is admitted by this domain. Build uses the registered Dockerfile in an isolated temporary context with an empty projects directory. Only the temporary FROM line is replaced by the exact cached Node image ID proved against the accepted application's layer ancestry and inherited configuration; see [the build-base contract](R40_BUILD_BASE.md). The canonical installer restarts only cms-app with no dependencies, no image pull and no rebuild during rollback. Acceptance verifies authentication, app hashes inside the running container, image generation, fixed ZIP dependency version, preserved env/mounts/networks/ports, other Compose services and site/project data.
## Build and checks
`python3 infra/cms-deploy/embed_runtime.py` refreshes only the explicitly marked standalone section. Registry and dispatcher wiring are ordinary reviewed runner source. Runtime never imports the fragment files from SMB.
`python3 -m unittest discover -s infra/cms-deploy -p 'test_*.py'`
`python3 -m unittest discover -s infra/deploy-runner -p 'test_device_core_*.py'`
`python3 infra/cms-deploy/build_autodeploy.py --output-dir <directory>`
Before production: SHA-pinned root runner promotion and verify-install; then fresh canonical plan/apply of the bootstrap artifact. Ordinary CMS pushes afterward need no operator NAS commands. A queued or green Actions run alone is not deployment evidence; require canonical receipt and product acceptance.
Bootstrap 002 corrects the initial POSIX inventory: the NAS contains a Synology
`server/@eaDir/admin-server.mjs@SynoEAStream` file hidden from SMB. The original
application and foundation hashes were confirmed unchanged through both paths.
Only flat `admin|server/@eaDir/<present-application-file>@SynoEAStream` regular
files are classified as metadata. Orphaned streams, unknown paths and symlinks
remain errors. Metadata is excluded from application identity and clean image
build inputs, and preserved byte-for-byte across application release/rollback.
The same partition handles old images containing these non-code streams; all
application hashes are still exact. Bootstrap 001 failed during read-only plan,
never entered apply, and is superseded rather than retried or overwritten.
After bootstrap 002 was accepted, Gitea assigned CMS runner ID 2. The initial
copied source verifier still required Device Core's ID 1 and rejected successful
run 39 before staging or deployment. Qualification now receives the ID from the
root-private CMS `data/.runner` registration; it verifies exact runner name,
repository, labels, job, steps, run identity and artifact ownership. Registration
IDs are allocated by Gitea, so no fixed numeric fallback is permitted. This
controller correction preserves the accepted bootstrap 002 receipt and private
queue; it does not rerun bootstrap or re-register/restart the build daemon.
Release r39 then reached canonical apply but failed runtime-config acceptance;
its automatic rollback restored the original source and healthy authenticated
CMS, while full runtime equivalence remained unproven. The failed receipt and
controller reconciliation barrier stay intact. `dc-cms-runtime-audit` is a
separate **plan-only** diagnostic domain pinned to that exact incident, archive
and six backup-file hashes. It reads current source/data/image/runtime evidence
and reports a bounded saved-digest preimage search without accepting any drift.
No environment values or raw Docker inspection are printed. `apply` is forbidden;
no application, queue, receipt or service is changed by this audit. Recovery must
be a separately reviewed transition after its actual runtime findings.
After diagnostic runner promotion, build its fixed data bundle with
`python3 infra/cms-deploy/build_runtime_audit.py --output-dir <directory>` and
use only the canonical `plan` operation for the audit artifact.
The r39 audit confirmed the old image and all source/data/dependency checks.
Offline reconstruction matched the complete current fingerprint and the complete
saved predecessor fingerprint: only bind-string order and three empty DNS list
representations differ. See [the incident proof and recovery contract](R39_RUNTIME_RECONCILIATION.md).
The separate `dc-cms-runtime-reconciliation` marker transition re-proves that
exact legacy hash on NAS before releasing the r39 barrier. It never retries r39.
Reconciliation was accepted at 2026-11-04T20:28:35Z. The next qualified run r40
failed only `config.Env`; its automatic rollback passed completely. r40 is also
terminal and must not be replayed. The build-base correction requires a new
runner promotion followed by a new CMS commit/run, without another bootstrap.