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

3.2 KiB

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.

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.