From 35ef72081fb6bc06961a826fe54f57436af7c6db Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 4 Oct 2026 00:36:40 +0200 Subject: [PATCH] route-adapter: its step is a run-once process (hq ADR 0198) The mesh-route-adapter container goes with its Dockerfile and build bases. The step runs node on the bundle as a run-once process, reading what the mesh contributed and its config where the mesh writes them and writing the proxy's dynamic directory at the path the container used to mount; it still runs again when a route or its config changes. --- modules/route-adapter/Dockerfile | 24 ------------------ modules/route-adapter/module.json | 42 +++++++++++-------------------- 2 files changed, 14 insertions(+), 52 deletions(-) delete mode 100644 modules/route-adapter/Dockerfile diff --git a/modules/route-adapter/Dockerfile b/modules/route-adapter/Dockerfile deleted file mode 100644 index d65de80..0000000 --- a/modules/route-adapter/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# route-adapter'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/route-adapter -COPY . . -RUN node /app/node_modules/typescript/bin/tsc adapter.ts index.ts \ - --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist - -FROM ${RUNTIME_BASE} -COPY --from=build /app/modules/route-adapter/dist /app/modules/route-adapter/dist -# **No MESH_TOOL_MODULES, deliberately.** This module serves no tool and consumes no event: it is a -# step the host runs to completion, named by the container's `args` as `mesh-tools run …`. Setting a -# serve-time entrypoint here would give the image a second way to be started — one that connects to -# the broker and never exits. diff --git a/modules/route-adapter/module.json b/modules/route-adapter/module.json index 658b8db..e7501b2 100644 --- a/modules/route-adapter/module.json +++ b/modules/route-adapter/module.json @@ -47,23 +47,18 @@ }, { "id": "adapt", - "type": "container", - "name": "mesh-route-adapter", - "artifact": "runtime", - "run-once": true, - "volumes": [ - "${dir:routes-dir}/mesh.json:${dir:routes-dir}/mesh.json:ro", - "${dir:state}/config.json:/run/config/config.json:ro", - "${access:dynamic}:/services/traefik/dynamic" + "type": "process", + "name": "route-adapter", + "artifact": "code", + "run": [ + "node", + "index.js" ], + "run-once": true, "env": { "MESH_RECEIVES": "${dir:routes-dir}/mesh.json", - "MESH_ROUTE_ADAPTER_CONFIG": "/run/config/config.json" + "MESH_ROUTE_ADAPTER_CONFIG": "${dir:state}/config.json" }, - "args": [ - "run", - "/app/modules/route-adapter/dist/index.js" - ], "restart-on": [ "received-route", "config" @@ -71,23 +66,14 @@ } ], "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" + ] } ] }