Files
ThothII/docs/install/installation-preflight.md
T

146 lines
9.6 KiB
Markdown

# Installation preflight and release manifest
The native operator protocol is version 1. `installation preflight` is the independent
step-3 host check. `installation plan` repeats document validation, performs step-5
live checks and writes an owner-only JSON plan plus a separate owner-only `.key` file.
Neither command creates containers, imports bindings, modifies a database or invokes
model generation. Exit codes are 0 (checks passed), 1 (blocking error), and 2 (usage).
JSON stdout contains only the report. Checks carry stable `id`, `outcome`, `field`
and `action`; outcomes are `passed`, `error`, `warning`, `deferred-to-runtime`.
## Release manifest schema 1
The manifest is a local JSON file shipped with the verified operator/release bundle.
Required keys:
| Key | Contract |
| --- | --- |
| `schema_version` | `1` |
| `version` | Semantic release version, optionally prerelease |
| `revision` | 40 lowercase hexadecimal Git commit characters |
| `validator_protocol` | `1`; incompatible consumers refuse the manifest |
| `requirements` | `cpus`, `memory_bytes`, `disk_bytes`; at least 2 CPUs, 4 GiB Docker memory and 10 GiB installation filesystem space |
| `components` | Includes `pi`, `catalog-migrations`, `workspace-maintenance` |
| `images` | Exactly `core`, `frontend`, `catalog`, `qdrant`, `embedding`; each maps `linux/amd64` and/or `linux/arm64` to a `docker.io/...@sha256:...` **single-platform image digest** |
| `files` | Relative packaged resource paths to SHA-256; no traversal, links or absolute paths; maximum 256 files, 32 MiB per resource |
| `compose` | Ordered relative Compose file paths present in `files` for this release configuration |
Include the selected `deploy/compose.git-https.yaml` or `deploy/compose.git-ssh.yaml`
transport overlay in `files`. Standard transport overlays are resolved from the
release while absent in the installation directory; existing authored overrides
remain input files. Compose must resolve all eight services: core, frontend,
catalog-db, catalog-migrate, workspace-maintenance, qdrant, embedding and
embedding-model-init. The two maintenance services share the core digest; embedding
initialization shares the embedding digest. Source builds and undeclared services
are rejected in this prebuilt path. The explicit source path is a separate ticket.
`docker manifest inspect --verbose` checks each selected immutable image and its
platform without pulling layers. `docker compose config --format json` checks the
effective service configuration. Compose receives only Docker connection/trust,
proxy and executable-discovery host variables; application parameters come from
the prepared environment file. Raw Docker output is never copied into reports.
Each preflight Docker command has a 15-second bound. Public image publication is
verified separately; controlled manifest tests alone do not certify host acceptance.
## External checks and bounds
- Git HTTPS: authenticated `GET /info/refs?service=git-upload-pack`, configured CA,
no redirects, selected branch advertised, 1 MiB response and 5-second bound.
Git SSH uses its prepared key/known-hosts and `git-upload-pack --advertise-refs`
with the same response/time bounds; no checkout or push occurs.
- PostgreSQL: the existing Catalog diagnostic adapter authenticates and reads
`current_database()` plus schema `USAGE`; no user tables are modified.
- REST database transport: existing Catalog diagnostic `GET` with the configured
bearer/API-key header and status validation. SSH database bindings cannot pass
this NL-to-SQL installation plan because runtime sessions do not support them.
- Evidence: local paths were already validated. HTTP performs bounded GET requests
and cancels response bodies; signed URL identities must match authored provenance.
S3 performs one `ListObjectsV2` request with `MaxKeys: 1`, no retries, explicit
file credentials and the canonical Evidence egress policy. These metadata requests
can incur normal remote-service request charges; they do not run LLM generation.
Each external request has a 5-second bound; the native database/Evidence helper
has a 60-second aggregate bound. Correct unavailable services before repeating.
- Explicit model endpoints: DNS/TCP/TLS origin reachability, without generating
tokens. Built-in endpoint resolution, provider authentication and model smoke
operations use the bundled Pi SDK at runtime; the report never claims those
operations have already passed.
No unreachable configured external dependency is converted to a deferred success.
Runtime obligations have explicit identities: `container-network`,
`catalog-initialization`, `pi-operation`, `local-embedding`,
`workspace-preprocessing`, `workspace-readiness`. These must be discharged by the
execution/readiness tickets before final success. Host disk inspection cannot prove
Docker Desktop VM free storage; its separate storage warning remains explicit.
## Input identity and freshness
The plan records normalized installation configuration, release digests, validator
build identity, verified input paths, local workspace content and its Git HEAD when
available (otherwise a content snapshot). Files are bounded to 32 MiB each and
256 MiB total; workspace/auth trees to 10,000 entries, without links or special files.
Credential contents are never serialized. An HMAC covers the private inputs and
plan using a separate random 32-byte owner-only key; no public unkeyed secret hash
is generated. Credential rotation invalidates the plan. Added/deleted/changed
workspace files invalidate it as well. Changes during the checks abort publication.
Plan output never overwrites an existing plan or key.
Execution and resumption call `ReadExecutionPlan` **and repeat live checks and
credential reads before mutations**. A valid seal alone does not certify current
network availability, Docker state or runtime readiness. Keep both plan files
private and outside the workspace repository; they are installation-local artifacts.
## Non-interactive platform execution
`tht --installation ABS_DESCRIPTOR installation apply --plan ABS_PLAN [--json]`
requires an operator whose version and revision match the manifest. Plans must
include the manifest and bootstrap paths; regenerate older plans. The only permitted
absent-input transition is materialization of a standard release transport overlay
with exactly its packaged digest. All other input changes invalidate execution.
The local profile uses the preparing non-root Unix operator's UID/GID for core,
maintenance, migrations and PostgreSQL. Original private authentication directory
and credential mounts remain authoritative. A pinned, offline one-shot helper seeds
only installation-owned volumes, retaining a root-owned initialization marker for
interruption recovery. Existing ready volumes are never recursively chowned.
Account collisions and foreign volumes stop execution. This requires local Docker;
Windows runs inside WSL2 rather than the native Windows shell.
The lifecycle lock excludes concurrent operations. Asset publication and journal
updates are atomic. Every retry repeats reconciliation, even after a completed
journal stage. Pull and service startup have 30-minute bounds; Catalog startup and
migration have 5-minute bounds; final health inspection has a 1-minute bound.
Cancellation cleans up named one-shot containers and releases the lock. Hard-killed
processes require explicit stale-owner inspection; automatic destructive repair is
not performed. Errors contain a stage/action without raw Docker output or secrets.
Binding import uses a named, bounded one-shot client on the Compose network. Protected
bootstrap material travels through stdin, never arguments or journals. The client logs
in through local authentication, obtains CSRF protection, calls permission-checked
administration services, and logs out. Prepare `authentication.username` and
`authentication.passwordFile` in `database-bootstrap.yaml`; offline validation checks
the account/password against the private local registry and seals that file too.
The registry consumes the exact prepared Git file inventory and optional commit, without
retargeting or refreshing an existing checkout. Binding creation and its durable import
receipt commit together in the Catalog. The receipt survives administrative deletion.
Reruns compare live configuration and encrypted-store contents, retain equivalent values,
and stop on divergence. No bootstrap document becomes runtime authority. The application
tests the imported connection; a successful host probe alone is insufficient.
Success reports `platform_ready: true`, `bindings_ready: true`, `workspace_ready: true`.
The bounded `binding_import` report distinguishes authentication, workspace reconciliation,
binding reconciliation and container connectivity failures. `workspace_preparation`
reports existing Catalog synchronization and preprocessing outcomes. Pending destructive
review returns exit 3 with `schema_review_required`; resolve it in Administration and
repeat apply. Other failures return exit 1. No confirmation, curation overwrite, AI
description generation or Memory clearing is implicit. Current completed stages are reused.
`runtime_checks` retains workspace diagnostics (DWH, Evidence, Qdrant and embedding),
workflow diagnostics and Pi/default-provider smoke as pending/passed/failed. These
checks use bounded named one-shot containers, preserving cancellation cleanup. The
Pi smoke sends a short provider request with no DWH context and may incur usage.
Runtime failure preserves platform/binding success but leaves workspace readiness false.
`functional_acceptance` stays false: only a real human-reviewed question provides that
acceptance. Published preview.5 predates binding import and readiness; use a subsequent
matching image/operator release for this extension.