Roll out the tool runtime to the remaining tools+events modules (ADR 0052/0051)

Nineteen modules gain a broker-bound runtime container that serves the module's
tools under its own scoped account: bazarr, gitea, grafana, home-assistant,
icecast, influxdb, jackett, keycloak, mailu, nextcloud, nodered, nzbget, ombi,
photos, portainer, qbittorrent, searxng, tautulli, verdaccio.

Config is the assignment's, not the manifest's (ADR 0051): each client's fromEnv
overlays a settings-merged config file (MESH_<M>_CONFIG_FILE) over its env
fallbacks, so URL and credentials come from `settings set`, with the URL defaulting
to the server on the node. nextcloud and mailu also mount the docker socket for
their exec-based tools.

Proven in the mesh-lab: assigned-grafana green — settings deliver the URL and token,
the runtime reads the merged config and serves grafana's tools under the scoped
account, with nothing in the manifest. Two gaps this surfaced are filed as hq
issues 008 (a provider runtime's seal key) and 009 (a settings change does not
restart a container runtime).

Claude-Session: https://claude.ai/code/session_01LrgweAeERJYBg88c5cKDzF
This commit is contained in:
2026-09-04 23:08:40 +02:00
parent 7b55e834e9
commit 9e156a5b9e
38 changed files with 668 additions and 51 deletions
+11 -1
View File
@@ -3,6 +3,8 @@
// merged results. Its JSON API (`/search?q=...&format=json`) is what makes a `searxng_search` tool
// useful; the client speaks only that. No credential — the instance is reached inside the mesh.
import { readFileSync } from "node:fs";
export interface SearxResult {
title: string;
url: string;
@@ -26,6 +28,13 @@ export interface SearxOptions {
pageno?: number;
}
/** The settings-merged config the mesh delivers (novox/hq ADR 0051): { url, apiKey, token, password, user, ... }. */
function meshConfig(file?: string): Record<string, string> {
if (!file) return {};
try { return JSON.parse(readFileSync(file, "utf8")) as Record<string, string>; }
catch { return {}; }
}
export class SearxngClient {
readonly baseUrl: string;
@@ -36,7 +45,8 @@ export class SearxngClient {
/** Build from the module's environment. No key: SearXNG's search API is open on the mesh, so a URL
* is all it takes — defaulting to the container's own listen port. */
static fromEnv(env: NodeJS.ProcessEnv = process.env): SearxngClient {
const url = env.MESH_SEARXNG_URL ?? `http://127.0.0.1:${env.SEARXNG_PORT ?? "8080"}`;
const cfg = meshConfig(env.MESH_SEARXNG_CONFIG_FILE);
const url = cfg.url ?? (env.MESH_SEARXNG_URL ?? `http://127.0.0.1:${env.SEARXNG_PORT ?? "8080"}`);
return new SearxngClient(url);
}
+32 -1
View File
@@ -5,7 +5,8 @@
"container-runtime"
],
"own-secrets": {
"secret": "/var/lib/searxng-module/secret.secret"
"secret": "/var/lib/searxng-module/secret.secret",
"broker": "/var/lib/mesh/searxng/broker"
},
"listens": [
{
@@ -16,6 +17,12 @@
}
],
"resources": [
{
"id": "mesh-state",
"type": "directory",
"path": "/var/lib/mesh/searxng",
"mode": "0700"
},
{
"id": "state",
"type": "directory",
@@ -64,6 +71,30 @@
"ports": [
"8080"
]
},
{
"id": "config",
"type": "file",
"path": "/var/lib/mesh/searxng/config.json",
"mode": "0600",
"content": "{}\n",
"merge": "json"
},
{
"id": "runtime",
"type": "container",
"name": "mesh-searxng",
"image": "mesh-runtime-searxng@sha256:0000000000000000000000000000000000000000000000000000000000000000",
"network": "host",
"volumes": [
"/var/lib/mesh/searxng/broker:/run/secrets/broker:ro",
"/var/lib/mesh/searxng/config.json:/run/config/config.json:ro"
],
"env": {
"MESH_BROKER_FILE": "/run/secrets/broker",
"MESH_SEARXNG_URL": "http://127.0.0.1:8080",
"MESH_SEARXNG_CONFIG_FILE": "/run/config/config.json"
}
}
]
}