Capture mesh-catalog at feat/r4g (2246ccc4) with the templates its manifests name and its predefined.json, and lay the copy out as a repository's root
The catalogue's manifests moved their content into template files and fall back to predefined keys, so a copy of module.json alone no longer passes the catalogue's own check; the bus's Dockerfile is gone from the catalogue.
This commit is contained in:
@@ -1,47 +0,0 @@
|
||||
# nats's server image: the upstream server, plus an entrypoint that reloads it in place when the
|
||||
# mesh rewrites its configuration. See entrypoint.sh for why that belongs here and not in the host.
|
||||
#
|
||||
# **Pinned to the multi-architecture index digest, not a platform's.** `docker manifest inspect`
|
||||
# reports a platform manifest per architecture and the index that lists them; pinning a platform's
|
||||
# digest builds on this workstation and fails on any node of another architecture, with an error
|
||||
# that names a manifest rather than the mistake. This is the index — `docker pull` reports the same
|
||||
# one, and `RepoDigests` confirms it.
|
||||
#
|
||||
# **The release the digest is, said here because a digest does not say it:**
|
||||
#
|
||||
# upstream: nats 2.11.17-alpine
|
||||
#
|
||||
# Kept equal to the server version cmd/nats-tools tests against (its go.mod), and a test there fails
|
||||
# when they differ: that test is what says the server delivers every message to a consumer with
|
||||
# several filters. 2.10.29 did not — it moved such a consumer past a message now and then without
|
||||
# handing it over, and the controller never heard of a merge (novox/hq issue 266).
|
||||
#
|
||||
# Unlike every other module's Dockerfile, this builds no TypeScript and uses no mesh base image:
|
||||
# the module's code is the server, which upstream already built. There is no BUILD_BASE here on
|
||||
# purpose — the server is not compiled; only the snapshot program below is. The upstream image is
|
||||
# declared in the manifest under build.on and arrives as NATS_BASE, like every other base the mesh
|
||||
# copies into its own store before a build (novox/hq ADR 0097); the digest above is the index one
|
||||
# for the reason given. So does GO_BASE, the toolchain the snapshot program is built with.
|
||||
#
|
||||
# **One thing is compiled: the bus's snapshot program** (novox/hq ADR 0235). The machine's backup
|
||||
# holder runs the module's declared dump — `docker exec` into this container — and the program asks
|
||||
# the server for each stream through the snapshot API, writing a tar on stdout. It is here, beside
|
||||
# the server, for two reasons: the dump runs where the server is without mounting anything into it,
|
||||
# and a restore needs nats-server itself — the very binary this image already carries — to fill a new
|
||||
# store. Its own Go module (snapshot/go.mod), so this build fetches only public modules.
|
||||
ARG NATS_BASE
|
||||
ARG GO_BASE
|
||||
FROM ${GO_BASE} AS snapshot
|
||||
WORKDIR /src
|
||||
COPY snapshot/go.mod snapshot/go.sum ./
|
||||
RUN go mod download
|
||||
COPY snapshot/*.go ./
|
||||
RUN CGO_ENABLED=0 go build -trimpath -ldflags '-s -w' -o /mesh-nats-snapshot .
|
||||
|
||||
FROM ${NATS_BASE}
|
||||
|
||||
COPY entrypoint.sh /usr/local/bin/mesh-nats-entrypoint
|
||||
RUN chmod 0755 /usr/local/bin/mesh-nats-entrypoint
|
||||
COPY --from=snapshot /mesh-nats-snapshot /usr/local/bin/mesh-nats-snapshot
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/mesh-nats-entrypoint"]
|
||||
@@ -0,0 +1,46 @@
|
||||
# The nats module's own server settings. Declared by the module, because a port, a TLS path
|
||||
# and a store directory are properties of the container this module raises: they live in its
|
||||
# image and its mounts and change when it does.
|
||||
#
|
||||
# The mesh writes accounts.conf beside this one and nothing else. A controller that wrote the
|
||||
# whole file would have to be kept in step with a Dockerfile it never sees.
|
||||
|
||||
port: 4222
|
||||
# Monitoring on every interface *inside* the container, so the publish below can reach it; the publish
|
||||
# is 127.0.0.1:8222 on the machine, so nothing beyond the machine reaches it, and the module guards 8222
|
||||
# too. Bound to the container's own loopback until 2026-10-04, the published port answered nothing
|
||||
# (connection reset), and the only way in was `docker exec`.
|
||||
http: 0.0.0.0:8222
|
||||
|
||||
# The mesh's own broker certificate — the one every machine already pins by fingerprint and the
|
||||
# controller already trusts (MESH_BROKER_CERTIFICATE). Serving the new bus with it means no
|
||||
# machine's pin changes when it moves, and no second certificate exists to be wrong about.
|
||||
tls {
|
||||
cert_file: "/tls/tls.crt"
|
||||
key_file: "/tls/tls.key"
|
||||
}
|
||||
|
||||
# **No `verify`, deliberately, and it was `verify: true` until a probe ran this image.** That
|
||||
# setting makes the server demand a *client* certificate, and nothing in the mesh presents one: a
|
||||
# host pins this server's exact certificate and authenticates with the password the mesh minted
|
||||
# (novox/hq ADR 0004, design 25 §4), and so does a module's runtime. With it on, every connection
|
||||
# in the mesh is refused at the TLS handshake, before any password is looked at — and the error is
|
||||
# "client didn't provide a certificate", which reads as a client fault.
|
||||
#
|
||||
# TLS is still required: a tls block is what makes it required, and verify only decides whether
|
||||
# client certificates are checked. What is given up is a second factor the mesh has no machinery
|
||||
# to issue or rotate — a certificate per module per node — and what is kept is stronger than a
|
||||
# name check in both directions: an exact pin outward, a per-user password inward.
|
||||
|
||||
jetstream {
|
||||
store_dir: "/data"
|
||||
}
|
||||
|
||||
# Every user of the mesh, composed by the controller and rewritten whenever a module is
|
||||
# assigned, a node enrols or a person's access changes.
|
||||
#
|
||||
# **Relative, and in this same directory, because it has to be.** An absolute include path is
|
||||
# resolved relative to the including file's directory, not from the root: nats-server given
|
||||
# `include /etc/nats/accounts.conf` from /etc/nats-server/nats.conf looks for
|
||||
# /etc/nats-server/etc/nats/accounts.conf and refuses to start. Verified against the server.
|
||||
include accounts.conf
|
||||
+67
-22
@@ -44,7 +44,8 @@
|
||||
"nats_backlog",
|
||||
"nats_buckets",
|
||||
"nats_users",
|
||||
"nats_user_can"
|
||||
"nats_user_can",
|
||||
"nats_snapshot_verify"
|
||||
],
|
||||
"guards": [
|
||||
8222
|
||||
@@ -57,7 +58,7 @@
|
||||
"class": "valuable",
|
||||
"active": "1d",
|
||||
"backup": {
|
||||
"dump": "docker exec -i mesh-broker-nats mesh-nats-snapshot snapshot < ${dir:mesh-state}/broker > ${dir:snapshots}/bus.tar.partial && mv ${dir:snapshots}/bus.tar.partial ${dir:snapshots}/bus.tar || { rm -f ${dir:snapshots}/bus.tar.partial; exit 1; }",
|
||||
"dump": "docker exec -i mesh-broker-nats /opt/mesh/mesh-nats-snapshot snapshot < ${dir:mesh-state}/broker > ${dir:snapshots}/bus.tar.partial && mv ${dir:snapshots}/bus.tar.partial ${dir:snapshots}/bus.tar || { rm -f ${dir:snapshots}/bus.tar.partial; exit 1; }",
|
||||
"into": "snapshots"
|
||||
},
|
||||
"why": "the bus's streams and key-value buckets: the hand-act log, conditions, every module's state; written all the time, so copied by the server's own snapshot of each stream (novox/hq ADR 0235), never as live files"
|
||||
@@ -75,32 +76,57 @@
|
||||
"id": "jetstream-data",
|
||||
"type": "directory",
|
||||
"path": "/var/lib/mesh-broker-nats",
|
||||
"mode": "0700"
|
||||
"mode": "0700",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "conf-dir",
|
||||
"type": "directory",
|
||||
"path": "/var/lib/nats-module/conf",
|
||||
"mode": "0700"
|
||||
"mode": "0700",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "snapshots",
|
||||
"type": "directory",
|
||||
"mode": "0700"
|
||||
"mode": "0700",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "mesh-state",
|
||||
"type": "directory",
|
||||
"mode": "0700",
|
||||
"place": "mesh"
|
||||
"place": "mesh",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "server-conf",
|
||||
"type": "file",
|
||||
"path": "/var/lib/nats-module/conf/nats.conf",
|
||||
"content": "# The nats module's own server settings. Declared by the module, because a port, a TLS path\n# and a store directory are properties of the container this module raises: they live in its\n# image and its mounts and change when it does.\n#\n# The mesh writes accounts.conf beside this one and nothing else. A controller that wrote the\n# whole file would have to be kept in step with a Dockerfile it never sees.\n\nport: 4222\n# Monitoring on every interface *inside* the container, so the publish below can reach it; the publish\n# is 127.0.0.1:8222 on the machine, so nothing beyond the machine reaches it, and the module guards 8222\n# too. Bound to the container's own loopback until 2026-10-04, the published port answered nothing\n# (connection reset), and the only way in was `docker exec`.\nhttp: 0.0.0.0:8222\n\n# The mesh's own broker certificate — the one every machine already pins by fingerprint and the\n# controller already trusts (MESH_BROKER_CERTIFICATE). Serving the new bus with it means no\n# machine's pin changes when it moves, and no second certificate exists to be wrong about.\ntls {\n cert_file: \"/tls/tls.crt\"\n key_file: \"/tls/tls.key\"\n}\n\n# **No `verify`, deliberately, and it was `verify: true` until a probe ran this image.** That\n# setting makes the server demand a *client* certificate, and nothing in the mesh presents one: a\n# host pins this server's exact certificate and authenticates with the password the mesh minted\n# (novox/hq ADR 0004, design 25 §4), and so does a module's runtime. With it on, every connection\n# in the mesh is refused at the TLS handshake, before any password is looked at — and the error is\n# \"client didn't provide a certificate\", which reads as a client fault.\n#\n# TLS is still required: a tls block is what makes it required, and verify only decides whether\n# client certificates are checked. What is given up is a second factor the mesh has no machinery\n# to issue or rotate — a certificate per module per node — and what is kept is stronger than a\n# name check in both directions: an exact pin outward, a per-user password inward.\n\njetstream {\n store_dir: \"/data\"\n}\n\n# Every user of the mesh, composed by the controller and rewritten whenever a module is\n# assigned, a node enrols or a person's access changes.\n#\n# **Relative, and in this same directory, because it has to be.** An absolute include path is\n# resolved relative to the including file's directory, not from the root: nats-server given\n# `include /etc/nats/accounts.conf` from /etc/nats-server/nats.conf looks for\n# /etc/nats-server/etc/nats/accounts.conf and refuses to start. Verified against the server.\ninclude accounts.conf\n",
|
||||
"template": "files/nats.conf",
|
||||
"mode": "0644"
|
||||
},
|
||||
{
|
||||
"id": "state",
|
||||
"type": "directory",
|
||||
"mode": "0700",
|
||||
"place": ".",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "program-snapshot",
|
||||
"type": "archive",
|
||||
"path": "${dir:state}/snapshot",
|
||||
"artifact": "snapshot",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "program-entrypoint",
|
||||
"type": "archive",
|
||||
"path": "${dir:state}/entrypoint",
|
||||
"artifact": "entrypoint",
|
||||
"unknown": "program"
|
||||
},
|
||||
{
|
||||
"id": "server",
|
||||
"type": "container",
|
||||
@@ -112,9 +138,19 @@
|
||||
"volumes": [
|
||||
"/var/lib/mesh-broker-nats:/data",
|
||||
"/var/lib/nats-module/conf:/etc/nats:ro",
|
||||
"${access:tls}:/tls:ro"
|
||||
"${access:tls}:/tls:ro",
|
||||
"${dir:state}/snapshot:/opt/mesh:ro",
|
||||
"${dir:state}/entrypoint:/opt/mesh-entrypoint:ro"
|
||||
],
|
||||
"artifact": "server"
|
||||
"args": [
|
||||
"sh",
|
||||
"/opt/mesh-entrypoint/entrypoint.sh"
|
||||
],
|
||||
"artifact": "server",
|
||||
"restart-on": [
|
||||
"program-snapshot",
|
||||
"program-entrypoint"
|
||||
]
|
||||
}
|
||||
],
|
||||
"accesses": [
|
||||
@@ -125,21 +161,24 @@
|
||||
}
|
||||
],
|
||||
"build": {
|
||||
"on": [
|
||||
{
|
||||
"arg": "NATS_BASE",
|
||||
"image": "nats@sha256:e4bf19f15fd3218814a4e3c9e0064e1334bd8aa20d5984b9f1a0afd084f8cc00"
|
||||
},
|
||||
{
|
||||
"arg": "GO_BASE",
|
||||
"image": "golang@sha256:8ac98ca534ac3f51e1f420a1dd2c15e74c75cfa0f23f3ad27eb5d7236c349a0c"
|
||||
}
|
||||
],
|
||||
"artifacts": [
|
||||
{
|
||||
"name": "server",
|
||||
"kind": "image",
|
||||
"from": "Dockerfile"
|
||||
"kind": "upstream",
|
||||
"from": "nats:2.11.17-alpine@sha256:e4bf19f15fd3218814a4e3c9e0064e1334bd8aa20d5984b9f1a0afd084f8cc00"
|
||||
},
|
||||
{
|
||||
"name": "snapshot",
|
||||
"kind": "bundle",
|
||||
"language": "go",
|
||||
"system": "alpine",
|
||||
"from": "cmd/mesh-nats-snapshot",
|
||||
"binary": "mesh-nats-snapshot"
|
||||
},
|
||||
{
|
||||
"name": "entrypoint",
|
||||
"kind": "archive",
|
||||
"from": "program"
|
||||
},
|
||||
{
|
||||
"name": "tools",
|
||||
@@ -154,8 +193,14 @@
|
||||
"env": {
|
||||
"MESH_NATS_MONITOR": "http://127.0.0.1:8222",
|
||||
"MESH_NATS_CONTAINER": "mesh-broker-nats",
|
||||
"MESH_NATS_USERS_FILE": "/etc/nats/accounts.conf"
|
||||
"MESH_NATS_USERS_FILE": "/etc/nats/accounts.conf",
|
||||
"MESH_NATS_SNAPSHOTS_DIR": "${dir:snapshots}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "files",
|
||||
"kind": "archive",
|
||||
"from": "files"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user