Compare commits

..
Author SHA1 Message Date
jschoubben 3728b07d20 Leave gitea's 222:22 to its own decision
A controller test holds git-over-ssh at 222 as the mesh's fixed convention
when no node says otherwise (TestTheForgesSshPortIsTheMeshsFixedConvention
ByDefault): without a setting, the short form would publish 22:22 and
collide with the machine's own sshd. Changing that is a decision, not part
of this sweep.
2026-09-30 12:36:24 +02:00
jschoubben a49f598a4e Manifests publish software ports; the machine side is the assignment's
postgres, distribution, gitea, mailu, only-office and portainer published
long-form mappings (5432:5432, 222:22, 7080:80, 9090:9000 …): a machine port
in a definition (ADR 0038, the migration note). Each now publishes the
software's port and names it in listens (mailu's web/web-tls and
only-office's and portainer's web said the machine number); mailu's env
says ${port:80}/${port:443} instead of 7080/7443.

Nothing moves on novox. postgres, distribution and gitea already have their
machine ports as novox settings (6852, 5100, 222); mailu, only-office and
portainer need theirs set BEFORE this rolls out:
  settings set mailu {"ports":{"80":7080,"443":7443}} --node novox
  settings set only-office {"ports":{"80":9070}} --node novox
  settings set portainer {"ports":{"9000":9090,"9443":9443}} --node novox
Those pins are accepted by today's manifests too (GivenPorts answers to the
container port), so setting them first changes nothing either.

Verified with the controller's own publishedOn/portInto/GivenPorts on
novox's settings (+ the three pins): every container's published ports and
mailu's env file render byte-identical before and after — mesh-store
6852:5432, mesh-registry 5100:5000, gitea 222:22, mailu-front 7080:80
7443:443 (+ mail ports), only-office 9070:80, portainer 9090:9000 9443:9443.

Not included: nats publishes 127.0.0.1:8222:8222 — a loopback bind, which a
short form cannot express; its monitor port needs its own change.
2026-09-30 12:35:58 +02:00
7 changed files with 26 additions and 78 deletions
+1 -1
View File
@@ -55,7 +55,7 @@
"name": "mesh-registry",
"image": "registry@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373",
"ports": [
"5000:5000"
"5000"
],
"volumes": [
"/var/lib/mesh-registry:/var/lib/registry"
+5 -5
View File
@@ -117,14 +117,14 @@
},
{
"name": "web",
"port": 7080,
"port": 80,
"protocol": "tcp",
"from": "mesh",
"why": "the web front over http; only the ACME HTTP-01 passthrough is routed here \u2014 everything else 301s to https and would loop a proxy"
},
{
"name": "web-tls",
"port": 7443,
"port": 443,
"protocol": "tcp",
"from": "mesh",
"why": "the web front over its own TLS (admin, webmail, API); the public name mail.novox.be is a route grant reaching it here"
@@ -168,7 +168,7 @@
"type": "file",
"path": "${dir:state}/mailu.env",
"mode": "0644",
"content": "ADMIN_ADDRESS=mailu-admin\nANTISPAM_ADDRESS=mailu-antispam\nANTIVIRUS_ADDRESS=mailu-antivirus\nIMAP_ADDRESS=mailu-imap\nSMTP_ADDRESS=mailu-smtp\nFRONT_ADDRESS=mailu-front\nWEBMAIL_ADDRESS=mailu-webmail\nWEBDAV_ADDRESS=mailu-webdav\nREDIS_ADDRESS=mailu-redis\nPORTS=25,80,443,465,993,995,4190,110,143,587\nDOMAIN=novox.be\nHOSTNAMES=mail.novox.be\nPOSTMASTER=admin\nSITENAME=Novox\nWEBSITE=https://novox.be\nTLS_FLAVOR=letsencrypt\nSUBNET=192.168.203.0/24\nCOMPOSE_PROJECT_NAME=mailu\nANTIVIRUS=clamav\nWEBMAIL=roundcube\nWEBDAV=radicale\nFETCHMAIL_ENABLED=True\nFETCHMAIL_DELAY=600\nADMIN=true\nWEB_ADMIN=/admin\nWEB_WEBMAIL=/webmail\nWEBROOT_REDIRECT=/webmail\nAPI=true\nWEB_API=/api\nAUTH_RATELIMIT_IP=6000/hour\nAUTH_RATELIMIT_USER=1000/day\nCREDENTIAL_ROUNDS=12\nPASSWORD_SCHEME=PBKDF2\nDISABLE_STATISTICS=True\nMESSAGE_SIZE_LIMIT=50000000\nMESSAGE_RATELIMIT=200/day\nRECIPIENT_DELIMITER=+\nPOSTFIX_MYNETWORKS=127.0.0.0/8 [::1]/128\nRELAYNETS=\nRELAYHOST=\nREJECT_UNLISTED_RECIPIENT=\nDB_FLAVOR=postgresql\nINITIAL_ADMIN_ACCOUNT=admin\nINITIAL_ADMIN_DOMAIN=novox.be\nINITIAL_ADMIN_MODE=ifmissing\nSMTP_PORT=25\nSMTPS_PORT=465\nSUBMISSION_PORT=587\nPOP3_PORT=110\nPOP3S_PORT=995\nIMAP_PORT=143\nIMAPS_PORT=993\nHTTP_PORT=7080\nHTTPS_PORT=7443\nAUTOMX_PORT=4243\nAMX_SMTP_ADDRESS=mail.novox.be\nAMX_SMTP_PORT=587\nAMX_IMAP_ADDRESS=mail.novox.be\nAMX_IMAP_PORT=143\nAMX_MAIL_DOMAINS=novox.be\nDMARC_RUA=admin\nDMARC_RUF=admin\nLETSENCRYPT_SHORTCHAIN=True\nTZ=Etc/UTC\nLOG_LEVEL=INFO\nWELCOME=false\nREAL_IP_HEADER=X-Real-IP\nREAL_IP_FROM=142.132.152.141\nCOMPRESSION=\nCOMPRESS_LEVEL=\nCOMPRESSION_LEVEL=\nBIND_ADDRESS4=127.0.0.1\nBIND_ADDRESS6=::1\nMAILU_VERSION=1.9\nDOCKER_ORG=mailu\nDOCKER_PREFIX=\nWELCOME_SUBJECT=Welcome to your new email account\nWELCOME_BODY=Welcome to your new email account, if you can read this, then it is configured properly!\n"
"content": "ADMIN_ADDRESS=mailu-admin\nANTISPAM_ADDRESS=mailu-antispam\nANTIVIRUS_ADDRESS=mailu-antivirus\nIMAP_ADDRESS=mailu-imap\nSMTP_ADDRESS=mailu-smtp\nFRONT_ADDRESS=mailu-front\nWEBMAIL_ADDRESS=mailu-webmail\nWEBDAV_ADDRESS=mailu-webdav\nREDIS_ADDRESS=mailu-redis\nPORTS=25,80,443,465,993,995,4190,110,143,587\nDOMAIN=novox.be\nHOSTNAMES=mail.novox.be\nPOSTMASTER=admin\nSITENAME=Novox\nWEBSITE=https://novox.be\nTLS_FLAVOR=letsencrypt\nSUBNET=192.168.203.0/24\nCOMPOSE_PROJECT_NAME=mailu\nANTIVIRUS=clamav\nWEBMAIL=roundcube\nWEBDAV=radicale\nFETCHMAIL_ENABLED=True\nFETCHMAIL_DELAY=600\nADMIN=true\nWEB_ADMIN=/admin\nWEB_WEBMAIL=/webmail\nWEBROOT_REDIRECT=/webmail\nAPI=true\nWEB_API=/api\nAUTH_RATELIMIT_IP=6000/hour\nAUTH_RATELIMIT_USER=1000/day\nCREDENTIAL_ROUNDS=12\nPASSWORD_SCHEME=PBKDF2\nDISABLE_STATISTICS=True\nMESSAGE_SIZE_LIMIT=50000000\nMESSAGE_RATELIMIT=200/day\nRECIPIENT_DELIMITER=+\nPOSTFIX_MYNETWORKS=127.0.0.0/8 [::1]/128\nRELAYNETS=\nRELAYHOST=\nREJECT_UNLISTED_RECIPIENT=\nDB_FLAVOR=postgresql\nINITIAL_ADMIN_ACCOUNT=admin\nINITIAL_ADMIN_DOMAIN=novox.be\nINITIAL_ADMIN_MODE=ifmissing\nSMTP_PORT=25\nSMTPS_PORT=465\nSUBMISSION_PORT=587\nPOP3_PORT=110\nPOP3S_PORT=995\nIMAP_PORT=143\nIMAPS_PORT=993\nHTTP_PORT=${port:80}\nHTTPS_PORT=${port:443}\nAUTOMX_PORT=4243\nAMX_SMTP_ADDRESS=mail.novox.be\nAMX_SMTP_PORT=587\nAMX_IMAP_ADDRESS=mail.novox.be\nAMX_IMAP_PORT=143\nAMX_MAIL_DOMAINS=novox.be\nDMARC_RUA=admin\nDMARC_RUF=admin\nLETSENCRYPT_SHORTCHAIN=True\nTZ=Etc/UTC\nLOG_LEVEL=INFO\nWELCOME=false\nREAL_IP_HEADER=X-Real-IP\nREAL_IP_FROM=142.132.152.141\nCOMPRESSION=\nCOMPRESS_LEVEL=\nCOMPRESSION_LEVEL=\nBIND_ADDRESS4=127.0.0.1\nBIND_ADDRESS6=::1\nMAILU_VERSION=1.9\nDOCKER_ORG=mailu\nDOCKER_PREFIX=\nWELCOME_SUBJECT=Welcome to your new email account\nWELCOME_BODY=Welcome to your new email account, if you can read this, then it is configured properly!\n"
},
{
"id": "secret-env",
@@ -456,8 +456,8 @@
"587",
"993",
"995",
"7080:80",
"7443:443"
"80",
"443"
],
"volumes": [
"${dir:data-certs}:/certs",
+2 -20
View File
@@ -48,20 +48,6 @@ function meshConfig(file?: string): Record<string, string> {
catch { return {}; }
}
/** One key of nzbget's own nzbget.conf, from the config directory the mesh mounts read-only
* (MESH_NZBGET_CONFIG_DIR). The software's file is the truth about who may log in, so the tools
* ask it rather than a setting that could disagree. Absent, unreadable or unset yields undefined. */
function confValue(dir: string | undefined, key: string): string | undefined {
if (!dir) return undefined;
try {
const line = readFileSync(`${dir.replace(/\/$/, "")}/nzbget.conf`, "utf8")
.split("\n")
.find((l) => l.startsWith(`${key}=`));
const value = line?.slice(key.length + 1).trim();
return value ? value : undefined;
} catch { return undefined; }
}
/** Read a secret the mesh mounted at a file path (an own-secret delivered by `secret accept`);
* absent or unreadable yields undefined so callers fall back rather than crash. */
function readSecret(file?: string): string | undefined {
@@ -83,9 +69,7 @@ export class NzbgetClient {
* Build from the module's resolved environment. URL and password are read from MESH_NZBGET_URL
* and MESH_NZBGET_PASSWORD; both must be present — an unconfigured NZBGet throws rather than
* pretend to be reachable, so the tools/events simply do not load (the harness treats the throw
* as "exposes nothing"). The password file is the same own-secret the server container is started
* with (FILE__NZBGET_PASS), so the two cannot disagree. The control username is read from
* nzbget.conf, falling back to "nzbget", NZBGet's own default.
* as "exposes nothing"). The control username defaults to "nzbget", NZBGet's own default.
*/
static fromEnv(env: NodeJS.ProcessEnv = process.env): NzbgetClient {
const cfg = meshConfig(env.MESH_NZBGET_CONFIG_FILE);
@@ -94,9 +78,7 @@ export class NzbgetClient {
if (!url || !password) {
throw new Error("NZBGet not configured — set MESH_NZBGET_URL and MESH_NZBGET_PASSWORD");
}
// The control username: a setting or the environment if one says so, else whatever
// nzbget.conf holds (an adopted machine keeps its own, e.g. not "nzbget"), else NZBGet's default.
const user = cfg.user ?? env.MESH_NZBGET_USER ?? confValue(env.MESH_NZBGET_CONFIG_DIR, "ControlUsername") ?? "nzbget";
const user = cfg.user ?? env.MESH_NZBGET_USER ?? "nzbget";
return new NzbgetClient(url, user, password);
}
+11 -45
View File
@@ -19,7 +19,7 @@
"port": 6789,
"protocol": "tcp",
"from": "mesh",
"why": "the download client's pages, and the JSON-RPC API its consumers and its own tools call"
"why": "the download client's pages"
}
],
"accesses": [
@@ -35,15 +35,10 @@
"path": "/var/lib/mesh/nzbget",
"mode": "0700"
},
{
"id": "state",
"type": "directory",
"mode": "0700",
"place": "."
},
{
"id": "config",
"type": "directory",
"path": "/services/nzbget/config",
"mode": "0700",
"owner": "1000:1000"
},
@@ -51,29 +46,24 @@
"id": "server",
"type": "container",
"name": "nzbget",
"image": "lscr.io/linuxserver/nzbget@sha256:ec3ef0ae7dc410084086a7fdd447deda4747531154aa1cc5c7c48ac60794e277",
"image": "lscr.io/linuxserver/nzbget@sha256:5f3d3fa71029004156eff2cbf4ef4455ce4ce59517cf13fa7d1d7c8a4cd2c8a4",
"env": {
"PUID": "1000",
"PGID": "1000",
"TZ": "Etc/UTC",
"FILE__NZBGET_PASS": "/run/secrets/password"
"TZ": "Etc/UTC"
},
"ports": [
"6789"
],
"volumes": [
"${dir:config}:/config",
"/services/media/downloads:/downloads",
"/var/lib/mesh/nzbget/password:/run/secrets/password:ro"
],
"restart-on": [
"needs-password"
"/services/nzbget/config:/config",
"/services/media/downloads:/downloads"
]
},
{
"id": "runtime-config",
"type": "file",
"path": "${dir:state}/config.json",
"path": "/var/lib/mesh/nzbget/config.json",
"mode": "0600",
"content": "{}\n",
"merge": "json"
@@ -86,46 +76,22 @@
"volumes": [
"/var/lib/mesh/nzbget/broker:/run/secrets/broker:ro",
"/var/lib/mesh/nzbget/password:/run/secrets/password:ro",
"${dir:state}/config.json:/run/config/config.json:ro",
"${dir:config}:/var/lib/nzbget/config:ro"
"/var/lib/mesh/nzbget/config.json:/run/config/config.json:ro",
"/services/nzbget/config:/var/lib/nzbget/config:ro"
],
"env": {
"MESH_BROKER_FILE": "/run/secrets/broker",
"MESH_NZBGET_URL": "http://127.0.0.1:${port:6789}",
"MESH_NZBGET_URL": "http://127.0.0.1:6789",
"MESH_NZBGET_PASSWORD_FILE": "/run/secrets/password",
"MESH_NZBGET_CONFIG_FILE": "/run/config/config.json",
"MESH_NZBGET_CONFIG_DIR": "/var/lib/nzbget/config"
},
"restart-on": [
"runtime-config",
"needs-password"
"runtime-config"
],
"artifact": "runtime"
}
],
"provides": [
"nzbget-api"
],
"serves": {
"nzbget-api": {
"scheme": "http",
"port": 6789,
"url-base": "",
"username": "nzbget"
}
},
"requires": [
"route"
],
"contributes": {
"route": {
"label": "nzbget",
"endpoint": "web"
}
},
"binds": {
"route": "${dir:state}/route.json"
},
"build": {
"on": [
{
+2 -2
View File
@@ -23,7 +23,7 @@
"listens": [
{
"name": "web",
"port": 9070,
"port": 80,
"protocol": "tcp",
"from": "mesh",
"why": "the document server over http; the public name office.novox.be is a route grant, and route-proxy reaches it on this published port"
@@ -93,7 +93,7 @@
"${dir:state}/server.env"
],
"ports": [
"9070:80"
"80"
],
"volumes": [
"${dir:logs}:/var/log/onlyoffice",
+4 -4
View File
@@ -8,10 +8,10 @@
"listens": [
{
"name": "web",
"port": 9090,
"port": 9000,
"protocol": "tcp",
"from": "mesh",
"why": "the dashboard over http; portainer.novox.be is a route grant and the proxy reaches it here \u2014 the machine side of 9090:9000, the predecessor's number"
"why": "the dashboard over http; routed, so the proxy reaches it here"
},
{
"name": "web-tls",
@@ -39,8 +39,8 @@
"name": "portainer",
"image": "portainer/portainer-ce@sha256:4d616db18cfeb5dd41a69c0958bc825c84483ea9cde1106eb82a5d26f3bd8b0e",
"ports": [
"9090:9000",
"9443:9443"
"9000",
"9443"
],
"volumes": [
"${dir:data}:/data",
+1 -1
View File
@@ -87,7 +87,7 @@
"PGDATA": "/var/lib/postgresql/data/pgdata"
},
"ports": [
"5432:5432"
"5432"
],
"volumes": [
"/var/lib/mesh-store:/var/lib/postgresql/data",