Beds read the catalogue: a shared loader, eight beds converted, the rest declared
catalogueModule() in the harness reads a module's manifest from the catalogue and rewrites only what the lab must: the build section goes, each artifact becomes the image the machine holds, images are pinned, and a bed may declare a host-port remap or a lab-local address. confluence, gitlab, openai-consumer, audit-logger, ollama, local-model-consumer, model-usage, mosquitto, anthropic-manager and anthropic-consumer now install the catalogue's manifest. A unit test refuses any inline copy naming a catalogue module unless the bed is declared with its reason; the declared list is the debt (novox/hq 04-ISSUES/073).
This commit is contained in:
@@ -38,7 +38,7 @@ import { loadScenario } from "../../src/declaration/parse.ts";
|
||||
import { raise } from "../../src/lifecycle/raise.ts";
|
||||
import { destroy, exec } from "../../src/lifecycle/operate.ts";
|
||||
import { hostBinaryPath, HOST_PATH } from "../../src/lifecycle/place.ts";
|
||||
import { labIsUsable, destroyAll, foundationBundle, onTheMachine, deriveTheFilterOn } from "./harness.ts";
|
||||
import { labIsUsable, destroyAll, foundationBundle, onTheMachine, deriveTheFilterOn, catalogueModule, catalogueIsPresent } from "./harness.ts";
|
||||
import type { HeldImage } from "../../src/pinning.ts";
|
||||
|
||||
const capability = await labIsUsable();
|
||||
@@ -51,7 +51,7 @@ const skip = !capability.usable
|
||||
? "MESH_LAB_HOST_BINARY is not set to a built mesh-host"
|
||||
: !bundle || !existsSync(bundle)
|
||||
? "MESH_LAB_BUNDLE is not set to a foundation bundle (mesh-host examples/)"
|
||||
: false;
|
||||
: catalogueIsPresent();
|
||||
|
||||
const SCENARIO = "model-usage-bed";
|
||||
/** The node that carries the postgres provider and the model-usage consumer. anchor carries only the
|
||||
@@ -190,7 +190,9 @@ test("usage events are upserted into model-usage's store — latest-per-key, bot
|
||||
}, async () => {
|
||||
// ================================================================================================
|
||||
// THE MANIFESTS — postgres verbatim from two-node-db (its server publishes 5432 so the consumer
|
||||
// reaches it), and model-usage the committed catalogue shape with its images pinned.
|
||||
// reaches it): a SECOND postgres beside the foundation's store, which the catalogue's postgres would
|
||||
// instead claim and adopt in place. Still an inline copy, declared in beds-read-the-catalogue.test.ts
|
||||
// (novox/hq 04-ISSUES/073). model-usage is the catalogue's.
|
||||
// ================================================================================================
|
||||
const postgresManifest = JSON.stringify({
|
||||
module: "postgres",
|
||||
@@ -233,45 +235,12 @@ test("usage events are upserted into model-usage's store — latest-per-key, bot
|
||||
],
|
||||
});
|
||||
|
||||
// --- model-usage: requires postgres-database, owns a provisioned store, consumes module.*.usage.*,
|
||||
// runs a run-once migrate then the long-lived event consumer. Both containers on the host network so
|
||||
// they reach the granted postgres (at the provider's address the mesh writes) and the broker. ------
|
||||
const modelUsageManifest = JSON.stringify({
|
||||
module: "model-usage",
|
||||
version: "1",
|
||||
// `mesh_laptop_model-usage` is 23 chars, over the 20 an S3 access key keeps (ADR 0049); a short
|
||||
// slug makes the consumer identity `mesh_laptop_usage` (17). db/role/`as` all derive from it.
|
||||
slug: "usage",
|
||||
capabilities: ["container-runtime"],
|
||||
requires: ["postgres-database"],
|
||||
contributes: { "postgres-database": { name: "model_usage" } },
|
||||
binds: { "postgres-database": "/var/lib/model-usage/database.json" },
|
||||
secrets: { "postgres-database": "/var/lib/model-usage/database.secret" },
|
||||
consumes: ["module.*.usage.*"],
|
||||
"own-secrets": { broker: "/var/lib/mesh/model-usage/broker" },
|
||||
resources: [
|
||||
{ id: "mesh-state", type: "directory", path: "/var/lib/mesh/model-usage", mode: "0700" },
|
||||
{ id: "state", type: "directory", path: "/var/lib/model-usage", mode: "0700" },
|
||||
// The connection string carries the password, so it reaches the runtime as a file the mesh
|
||||
// templates (novox/hq ADR 0086), the shape the catalogue's manifest has.
|
||||
{
|
||||
id: "database-url", type: "file", path: "/var/lib/model-usage/database.url", mode: "0600",
|
||||
content:
|
||||
"postgresql://${bound:postgres-database:as}:${secret:postgres-database}@" +
|
||||
"${bound:postgres-database:at}:${bound:postgres-database:port}/${bound:postgres-database:as}\n",
|
||||
},
|
||||
{
|
||||
id: "runtime", type: "container", name: "mesh-model-usage",
|
||||
image: pinned("mesh-runtime-model-usage"), network: "host",
|
||||
volumes: [
|
||||
"/var/lib/mesh/model-usage/broker:/run/secrets/broker:ro",
|
||||
"/var/lib/model-usage:/run/state",
|
||||
"/var/lib/model-usage/database.url:/run/secrets/database-url:ro",
|
||||
],
|
||||
env: { MESH_BROKER_FILE: "/run/secrets/broker", DATABASE_URL_FILE: "/run/secrets/database-url" },
|
||||
},
|
||||
],
|
||||
});
|
||||
// --- model-usage: the catalogue's own manifest (novox/hq 04-ISSUES/073). It requires
|
||||
// postgres-database, owns a provisioned store, consumes module.*.usage.*, and its runtime is on the
|
||||
// host network so it reaches the granted postgres (at the provider's address the mesh writes) and
|
||||
// the broker. Its slug keeps the consumer identity under the 20 characters an S3 access key allows
|
||||
// (ADR 0049). ------------------------------------------------------------------------------------
|
||||
const modelUsageManifest = catalogueModule("model-usage", held);
|
||||
|
||||
async function addIssueAssign(name: string, manifest: string): Promise<void> {
|
||||
await must("anchor", `printf %s ${quote(manifest)} > /tmp/${name}.json && docker cp /tmp/${name}.json mesh-controller:/${name}.json`);
|
||||
|
||||
Reference in New Issue
Block a user