plex, redis: module runtime containers + declare self-consumed events (ADR 0052/0046)
plex gains a broker-bound tools/events runtime container (mesh-runtime-plex) alongside its server, and a never-throwing plex_reachable health probe. redis and postgres subscribe to their own lifecycle events in index.ts but declared no consumes — so the substrate never made the queue the runtime binds and it crashed on start (404). Declare the consume, as ADR 0046 requires. Proven end-to-end in the mesh-lab: assigned-plex and assigned-redis both green. Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
// redis's events entrypoint, loaded by the per-node tool host (the provisioner container runs
|
||||
// ./provisioner separately). The cache lifecycle events are EMITTED from the provisioner, where the
|
||||
// lifecycle actually happens (novox/hq ADR 0046/0047):
|
||||
// module.redis.cache.provisioned — a consumer's ACL user + keyspace was created
|
||||
// module.redis.cache.deprovisioned — that user was removed
|
||||
// Here in the tool host we react to them, keeping a lightweight audit trail of who was granted a
|
||||
// cache and who lost one — observability the provider itself is best placed to log.
|
||||
|
||||
import { on } from "@novox/mesh-sdk/events";
|
||||
|
||||
interface CacheEvent {
|
||||
consumer: string;
|
||||
username: string;
|
||||
keyspacePrefix?: string;
|
||||
}
|
||||
|
||||
await on<CacheEvent>("module.redis.cache.provisioned", async (e) => {
|
||||
console.log(`[redis] cache provisioned for ${e.body.consumer} (user ${e.body.username})`);
|
||||
});
|
||||
|
||||
await on<CacheEvent>("module.redis.cache.deprovisioned", async (e) => {
|
||||
console.log(`[redis] cache deprovisioned for ${e.body.consumer} (user ${e.body.username})`);
|
||||
});
|
||||
|
||||
console.log("[redis] auditing cache lifecycle events");
|
||||
@@ -14,6 +14,10 @@
|
||||
"module.redis.cache.provisioned",
|
||||
"module.redis.cache.deprovisioned"
|
||||
],
|
||||
"consumes": [
|
||||
"module.redis.cache.provisioned",
|
||||
"module.redis.cache.deprovisioned"
|
||||
],
|
||||
"serves": {
|
||||
"redis-cache": {}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user