feat: add cloud-api runtime DB image entrypoints
This commit is contained in:
@@ -220,11 +220,23 @@ below are true.
|
||||
|
||||
## DEV DB Provisioning Automation
|
||||
|
||||
The repo-owned DEV DB provisioning entrypoint is:
|
||||
The cloud-api image owns a stable DEV DB provisioning entrypoint:
|
||||
|
||||
```sh
|
||||
node cmd/hwlab-cloud-api/provision.mjs --check
|
||||
node cmd/hwlab-cloud-api/provision.mjs --dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/dev-runtime-provisioning-report.json
|
||||
node cmd/hwlab-cloud-api/provision.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/dev-runtime-provisioning-report.json
|
||||
```
|
||||
|
||||
This is the preferred image-internal operator command for `hwlab-cloud-api`.
|
||||
It delegates to the same repo-owned provisioning implementation as the root
|
||||
script and receives admin/target DB inputs only through SecretRef-backed env.
|
||||
|
||||
The repo-level compatibility entrypoint remains:
|
||||
|
||||
```sh
|
||||
node scripts/dev-runtime-provisioning.mjs --check
|
||||
node scripts/dev-runtime-provisioning.mjs --dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/report.json
|
||||
node scripts/dev-runtime-provisioning.mjs --dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/dev-runtime-provisioning-report.json
|
||||
```
|
||||
|
||||
The default `--check` path validates the redacted target DB URL contract only:
|
||||
@@ -237,7 +249,7 @@ kubeconfig material.
|
||||
An authorized DEV provisioning apply is:
|
||||
|
||||
```sh
|
||||
node scripts/dev-runtime-provisioning.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/report.json
|
||||
node scripts/dev-runtime-provisioning.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/dev-runtime-provisioning-report.json
|
||||
```
|
||||
|
||||
The apply path uses `HWLAB_CLOUD_DB_URL` from
|
||||
@@ -258,11 +270,27 @@ untracked manual DB write.
|
||||
|
||||
## Runtime Migration Automation
|
||||
|
||||
The repo-owned runtime migration entrypoint is:
|
||||
The cloud-api image owns a stable runtime migration entrypoint:
|
||||
|
||||
```sh
|
||||
node cmd/hwlab-cloud-api/migrate.mjs --check
|
||||
node cmd/hwlab-cloud-api/migrate.mjs --dry-run --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json
|
||||
node cmd/hwlab-cloud-api/migrate.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json
|
||||
```
|
||||
|
||||
This is the preferred image-internal operator command for `hwlab-cloud-api`.
|
||||
It delegates to the same repo-owned migration implementation as the root
|
||||
script, so there is only one migration contract and one output format. The
|
||||
cloud-api artifact build copies `cmd/`, `scripts/`, `internal/`, `package.json`,
|
||||
and runtime dependencies into the image; the DEV CD runtime migration Job uses
|
||||
`node cmd/hwlab-cloud-api/migrate.mjs` from the current cloud-api image and
|
||||
injects DB inputs only through SecretRef-backed env.
|
||||
|
||||
The repo-level compatibility entrypoint remains:
|
||||
|
||||
```sh
|
||||
node scripts/dev-runtime-migration.mjs --check
|
||||
node scripts/dev-runtime-migration.mjs --dry-run --report /tmp/hwlab-dev-gate/report.json
|
||||
node scripts/dev-runtime-migration.mjs --dry-run --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json
|
||||
```
|
||||
|
||||
Those default paths are source-only. They validate
|
||||
@@ -275,14 +303,14 @@ An authorized operator may run a read-only live verification only after
|
||||
injecting the DEV DB URL through the existing Secret/env path:
|
||||
|
||||
```sh
|
||||
node scripts/dev-runtime-migration.mjs --dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/report.json
|
||||
node scripts/dev-runtime-migration.mjs --dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json
|
||||
```
|
||||
|
||||
A real DEV migration apply is intentionally separate and requires all explicit
|
||||
write flags:
|
||||
|
||||
```sh
|
||||
node scripts/dev-runtime-migration.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/report.json
|
||||
node scripts/dev-runtime-migration.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json
|
||||
```
|
||||
|
||||
The apply command is scoped to DEV Postgres schema objects declared by
|
||||
@@ -306,7 +334,7 @@ The repo-owned postflight entrypoint is:
|
||||
|
||||
```sh
|
||||
node scripts/dev-runtime-postflight.mjs --check
|
||||
node scripts/dev-runtime-postflight.mjs --live --confirm-dev --confirmed-non-production --target api --report /tmp/hwlab-dev-gate/report.json
|
||||
node scripts/dev-runtime-postflight.mjs --live --confirm-dev --confirmed-non-production --target api --report /tmp/hwlab-dev-gate/dev-runtime-postflight-report.json
|
||||
```
|
||||
|
||||
Default `--check` is source-only. Live mode first reads
|
||||
@@ -335,13 +363,13 @@ authorizes the DEV apply command and the preconditions below are already true.
|
||||
|
||||
| Check | Safe for normal runners | Evidence allowed | Not allowed |
|
||||
| --- | --- | --- | --- |
|
||||
| Source migration contract | Yes | `node scripts/dev-runtime-migration.mjs --check` and `node scripts/dev-runtime-migration.mjs --dry-run --report /tmp/hwlab-dev-gate/report.json` | DB connection, Secret read, DEV/PROD write |
|
||||
| Source migration contract | Yes | `node scripts/dev-runtime-migration.mjs --check` and `node scripts/dev-runtime-migration.mjs --dry-run --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json` | DB connection, Secret read, DEV/PROD write |
|
||||
| Static runtime boundary contract | Yes | `node scripts/validate-runtime-boundary.mjs`, source docs, manifests, and redacted Secret refs | Live mutation, service restart, Secret value output |
|
||||
| Public health observation | Yes, when command scope is read-only | `/health/live` fields such as `db.liveDbEvidence`, `runtime.adapter`, `runtime.durable`, `runtime.blocker`, `readiness.durability.blockedLayer`, `requiredEvidence`, and redaction/safety flags | Printing DB URLs, passwords, tokens, kubeconfig material, or Secret data |
|
||||
| Live provisioning apply | No, unless explicitly authorized by commander/operator | `node scripts/dev-runtime-provisioning.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/report.json` with role/database created/existed booleans and no secret output | PROD apply, Secret value output, manual DB shell, schema migration, service restart, M3 acceptance promotion |
|
||||
| Live DB read verification | Only with explicit DEV read authorization | `--dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/report.json` output with redacted endpoint and `secretValuesPrinted=false` | Kubernetes Secret reads, writes, migration apply, PROD target |
|
||||
| Live migration/repair apply | No, unless explicitly authorized by commander/operator | `--apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/report.json` plus post-apply health evidence | PROD apply, Secret value output, service restart, Code Agent POST, hardware write, or acceptance promotion |
|
||||
| Durable runtime postflight | Only after durable runtime readiness is already green | `node scripts/dev-runtime-postflight.mjs --live --confirm-dev --confirmed-non-production --target api --report /tmp/hwlab-dev-gate/report.json` with `/health/live`, `/v1`, and M3 true/false durable green evidence | Running M3 writes while runtime durable readiness is blocked, Secret output, PROD, or manual rollout |
|
||||
| Live provisioning apply | No, unless explicitly authorized by commander/operator | `node scripts/dev-runtime-provisioning.mjs --apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/dev-runtime-provisioning-report.json` with role/database created/existed booleans and no secret output | PROD apply, Secret value output, manual DB shell, schema migration, service restart, M3 acceptance promotion |
|
||||
| Live DB read verification | Only with explicit DEV read authorization | `--dry-run --allow-live-db-read --confirm-dev --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json` output with redacted endpoint and `secretValuesPrinted=false` | Kubernetes Secret reads, writes, migration apply, PROD target |
|
||||
| Live migration/repair apply | No, unless explicitly authorized by commander/operator | `--apply --confirm-dev --confirmed-non-production --report /tmp/hwlab-dev-gate/dev-runtime-migration-report.json` plus post-apply health evidence | PROD apply, Secret value output, service restart, Code Agent POST, hardware write, or acceptance promotion |
|
||||
| Durable runtime postflight | Only after durable runtime readiness is already green | `node scripts/dev-runtime-postflight.mjs --live --confirm-dev --confirmed-non-production --target api --report /tmp/hwlab-dev-gate/dev-runtime-postflight-report.json` with `/health/live`, `/v1`, and M3 true/false durable green evidence | Running M3 writes while runtime durable readiness is blocked, Secret output, PROD, or manual rollout |
|
||||
|
||||
Secret handling rules are the same for every row: verify env names,
|
||||
`secretKeyRef` names/keys, configured provider/model/base URL, redacted endpoint
|
||||
|
||||
Reference in New Issue
Block a user