From af346f60665da3a23934c2dfd95f0d76476d86ca Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 3 Oct 2026 23:33:51 +0200 Subject: [PATCH] grafana: its handlers and tools run in the node's runtime (hq ADR 0198) The mesh-grafana container goes with its Dockerfile, build bases and bus credential; its env becomes the bundle's words with mount targets folded back to host paths. --- modules/grafana/Dockerfile | 24 ----------------- modules/grafana/module.json | 52 ++++++++++++------------------------- 2 files changed, 16 insertions(+), 60 deletions(-) delete mode 100644 modules/grafana/Dockerfile diff --git a/modules/grafana/Dockerfile b/modules/grafana/Dockerfile deleted file mode 100644 index 9ff34c1..0000000 --- a/modules/grafana/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# grafana's runtime: the tool runtime, carrying this module's compiled code. -# -# **Built from this module's own directory and nothing else.** The sdk and the tool runtime are in -# the base images, published like any other artifact — which is what makes this buildable by the -# mesh from a repository and a path (novox/hq ADR 0069) rather than only on a workstation that -# happens to have the siblings. -# -# Two bases, named rather than pinned (novox/hq issue 044): the image this is COMPILED in and the -# image it RUNS in — the second must not carry a compiler. Declared in module.json's `build.on`. -ARG BUILD_BASE -ARG RUNTIME_BASE - -FROM ${BUILD_BASE} AS build -WORKDIR /app/modules/grafana -COPY . . -RUN node /app/node_modules/typescript/bin/tsc client.ts index.ts tools/index.ts \ - --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist - -FROM ${RUNTIME_BASE} -COPY --from=build /app/modules/grafana/dist /app/modules/grafana/dist -# Every serve-time entrypoint, loaded by the runtime in serve mode: tools and events serve, and a -# provider's provisioner runs its reconcile loop in the same process, with the broker connected — -# the convention novox/hq issues 060/061 settled. -ENV MESH_TOOL_MODULES=/app/modules/grafana/dist/index.js,/app/modules/grafana/dist/tools/index.js diff --git a/modules/grafana/module.json b/modules/grafana/module.json index 023e5dd..7645f6b 100644 --- a/modules/grafana/module.json +++ b/modules/grafana/module.json @@ -5,8 +5,7 @@ "alert.firing" ], "own-secrets": { - "admin": "${dir:mesh-state}/admin", - "broker": "${dir:mesh-state}/broker" + "admin": "${dir:mesh-state}/admin" }, "capabilities": [ "container-runtime" @@ -112,25 +111,6 @@ "mode": "0600", "content": "{\n \"user\": \"admin\",\n \"password\": \"${secret:admin}\"\n}\n", "merge": "json" - }, - { - "id": "runtime", - "type": "container", - "name": "mesh-grafana", - "network": "host", - "volumes": [ - "${dir:mesh-state}/broker:/run/secrets/broker:ro", - "${dir:mesh-state}/config.json:/run/config/config.json:ro" - ], - "env": { - "MESH_BROKER_FILE": "/run/secrets/broker", - "MESH_GRAFANA_URL": "http://127.0.0.1:${port:3000}", - "MESH_GRAFANA_CONFIG_FILE": "/run/config/config.json" - }, - "restart-on": [ - "runtime-config" - ], - "artifact": "runtime" } ], "requires": [ @@ -162,23 +142,23 @@ "influxdb-api": "${dir:mesh-state}/influxdb-api" }, "build": { - "on": [ - { - "arg": "BUILD_BASE", - "module": "mesh-tools", - "artifact": "build" - }, - { - "arg": "RUNTIME_BASE", - "module": "mesh-tools", - "artifact": "runtime" - } - ], "artifacts": [ { - "name": "runtime", - "kind": "image", - "from": "Dockerfile" + "name": "code", + "kind": "bundle", + "language": "typescript", + "entrypoints": [ + "index.js", + "tools/index.js" + ], + "loads": [ + "index.js", + "tools/index.js" + ], + "env": { + "MESH_GRAFANA_URL": "http://127.0.0.1:${port:3000}", + "MESH_GRAFANA_CONFIG_FILE": "${dir:mesh-state}/config.json" + } } ] }