Mirrors the proven catalog patterns field-for-field: - lidarr -> the Servarr twin of radarr/sonarr (API v1, artist content); no provisioner (it is a consumer app). - mongodb -> postgres shape: mongodb-database provider, provisioner mints a per-consumer db+user (ADR 0053), client shells to mongosh (no npm driver, the psql convention). - mssql -> postgres shape: mssql-database provider, sqlcmd client. - mosquitto -> redis shape: mqtt-topic provider via the Dynamic Security plugin, deliberately avoiding hal's password_file (that file is nox issue 011 exactly); provisioner mints a per-consumer MQTT client+role. All four typecheck (strict, NodeNext) against the built @novox/mesh-sdk, and their service images are digest-pinned to resolved registry digests. The mesh-runtime-<mod> images keep the all-zeros placeholder the pipeline pins, as postgres/redis do, and must bundle each module's CLI (mongosh/sqlcmd/ mosquitto_ctrl) as mesh-runtime-postgres bundles psql. Not yet lab-verified: each module lists in-code what an integration test must prove (auth model, provisioner reconcile, mosquitto dynsec bootstrap ordering). Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
// mssql's events entrypoint, loaded by the per-node tool host (the provisioner container runs
|
|
// ./provisioner separately). The database lifecycle events are EMITTED from the provisioner, where
|
|
// the lifecycle actually happens (novox/hq ADR 0046/0047):
|
|
// module.mssql.database.provisioned — a consumer's database + login/user was created
|
|
// module.mssql.database.deprovisioned — that database was removed
|
|
// Here in the tool host we react to them, keeping a lightweight audit trail of who was granted a
|
|
// database and who lost one — observability the provider itself is best placed to log.
|
|
|
|
import { on } from "@novox/mesh-sdk/events";
|
|
|
|
interface DatabaseEvent {
|
|
consumer: string;
|
|
database: string;
|
|
user?: string;
|
|
}
|
|
|
|
await on<DatabaseEvent>("module.mssql.database.provisioned", async (e) => {
|
|
console.log(`[mssql] database provisioned for ${e.body.consumer} (db ${e.body.database})`);
|
|
});
|
|
|
|
await on<DatabaseEvent>("module.mssql.database.deprovisioned", async (e) => {
|
|
console.log(`[mssql] database deprovisioned for ${e.body.consumer} (db ${e.body.database})`);
|
|
});
|
|
|
|
console.log("[mssql] auditing database lifecycle events");
|