Files
NODEDC_PLATFORM/infra/deploy-runner/DEVICE_B2_FOUNDATION.md
T

74 lines
4.3 KiB
Markdown

# Device Core: external B2 VPS foundation v1
Draft, 2026-09-30. Not installed. Canonical design recorded in DCPLATFORM-21.
This transition precedes the normal Device Core application release. It keeps
its image and existing infrastructure, adds one Core private bind mount and
`DEVICE_B2_SECRET_ROOT`, and executes one SHA-pinned additive SQL transaction.
Neither Manager nor PostgreSQL is recreated. No build, pull, port or network change.
The fixed artifact contains only:
- `docker-compose.device-b2-foundation.yml`
- `deployment/device-b2-foundation-v1.sql`
- `deployment/device-b2-foundation-v1.json`
It is built by Device Core's `infra/deploy-runner/build_device_b2_foundation.py`.
The source SQL SHA is `dc5608eccb8f628aab49390d245e6758505bb8a459a49705c375c3ca59b3e03b`.
The initial predecessor is accepted r14, source
`6ca6738bab22d0fdef714b90c68959363106ee5b`, archive SHA
`385c2fec8fce300cb80a93edfbcb0d537e34755b0ccc35294c0102b3c4a7f724`.
The accepted network-priority override remains part of effective Compose.
Preflight proves exact predecessor source and its applied archive, empty feature
schema, absent private directory, current healthy runtime and immutable effective
Compose delta. The local Core tag must equal its running image. Fresh root runner
promotion and plan/apply are still required; local tests do not prove NAS state.
Apply owns schema execution/receipt, private directory UID/GID1000 mode0700,
Core-only recreation using its existing image, health, exact before/after runtime
comparison with only the new mount/env removed, unchanged dependent containers,
existing Compose/source files and unrelated services. Schema acceptance compares
all ordered columns/types/nullability and constraint definitions to a fixed
contract. PostgreSQL18's separately catalogued NOT NULL constraints are omitted
from the constraint list because nullability is checked independently; NAS uses
PostgreSQL16. This is a scoped schema normalization, not runtime guard relaxation.
Rollback restores source and the original Core configuration with the same image.
It may remove only its verified, complete and empty new schema and empty key
directory. Any unexpected schema, inserted data or key is retained and triggers
reconciliation; it is never erased to make rollback appear successful.
Normal later `device-core-release` operations include the new Compose file only
when a complete matching canonical receipt and applied archive prove ownership.
They also validate the installed private directory, actual mount/environment,
and exact schema on preflight and acceptance. A SQL failure before Core recreation
does not mark runtime as changed or restart Core during rollback.
Existing Dockerfile/migration immutability remains unchanged.
Runner016 was installed (SHA256
`1cda852fec9e940cfbec835b27159f04e96b13e24b6bbcd3ef87dd1a91f306aa`),
but plan001 rejected the effective Compose comparison before mutation. Official
Compose2.20.1 reproduced that rejection on all five current NAS Compose files:
the sole mismatch was the new mount's `bind: {}` versus an expected explicit
`create_host_path: false`. Existing synthetic tests missed this serializer form.
The corrected transition is `device-b2-foundation-v1-20260930-002`;001 is rejected
by identity and must not be applied. SQL, source YAML, predecessor and runtime
scope are unchanged.
Runner017 normalizes only omitted/false `create_host_path` on this one new bind,
in private comparison copies, alongside the existing false `read_only` rule.
Actual config hashes remain untouched. True/null/non-boolean values, missing
bind objects, unknown bind options, duplicate mounts and unrelated changes fail.
See `fixtures/device-b2-foundation-compose220` for real parser output and exact
reproduction. Qualification with that fixture and with all five NAS files proves
the old failure and corrected exact comparison. This is local parser evidence,
not proof of NAS apply or runtime acceptance.
Local validation: foundation boundary/negative tests, deterministic artifact,
real archive through runner loader, existing release/network-priority/autodeploy
and Device Plane registry regression. SQL was also executed after all17 existing
migrations in temporary PGlite PostgreSQL WASM, with cross-company foreign-key
and contour uniqueness checks. This is SQL validation, not NAS runtime acceptance.
The actual Device Core connect/link SQL also passed against that database.