Over-corrected: taking the port out of listens as well as serves made the module declare it listens on nothing, and the parser said so. ADR 0038 splits it. A module names the port its own software listens on, because that is a fact about the software and it knows it. The mesh assigns the machine-side number, because only the mesh knows what else is on the machine, and it is the mesh that fills the assigned number into serves so a consumer is told one number rather than three that agree by luck. So what was wrong was writing a port into serves, not into listens. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx
74 lines
3.1 KiB
JSON
74 lines
3.1 KiB
JSON
{
|
|
"module": "showcase",
|
|
"version": "1",
|
|
"slug": "show",
|
|
|
|
"capabilities": ["container-runtime"],
|
|
|
|
"provides": [{ "name": "greeting", "scope": "mesh" }],
|
|
"serves": { "greeting": { "path": "/greeting" } },
|
|
"requires": ["postgres-database"],
|
|
"binds": { "postgres-database": "/var/lib/showcase/database.json" },
|
|
"secrets": { "postgres-database": "/var/lib/showcase/database.secret" },
|
|
"own-secrets": { "broker": "/var/lib/mesh/showcase/broker" },
|
|
|
|
"claims": [{ "name": "the-showcase", "scope": "node" }],
|
|
|
|
"emits": ["module.showcase.acknowledged"],
|
|
"consumes": ["module.showcase.greeted"],
|
|
|
|
"listens": [
|
|
{ "port": 8080, "protocol": "tcp", "from": "mesh",
|
|
"why": "the port the daemon itself listens on. The mesh assigns the machine-side number and tells consumers that one (ADR 0038)" }
|
|
],
|
|
|
|
"build": {
|
|
"artifacts": [
|
|
{ "name": "code", "kind": "bundle", "language": "typescript",
|
|
"entrypoints": ["index.js", "tools/index.js", "provisioner/index.js",
|
|
"daemon/index.js", "step/index.js", "report/index.js"] },
|
|
{ "name": "files", "kind": "archive", "from": "files" },
|
|
{ "name": "helper", "kind": "upstream",
|
|
"from": "alpine@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b" }
|
|
]
|
|
},
|
|
|
|
"resources": [
|
|
{ "id": "account", "type": "user", "name": "showcase", "shell": "/usr/bin/nologin",
|
|
"home": "/var/lib/showcase" },
|
|
|
|
{ "id": "logs", "type": "access", "path": "/var/log", "mode": "0755" },
|
|
|
|
{ "id": "mesh-state", "type": "directory", "path": "/var/lib/mesh/showcase", "mode": "0700" },
|
|
{ "id": "state", "type": "directory", "path": "/var/lib/showcase", "mode": "0755" },
|
|
|
|
{ "id": "settings", "type": "file", "path": "/var/lib/showcase/showcase.env", "mode": "0600",
|
|
"content": "SHOWCASE_GREETING=hello\nSHOWCASE_EVERY_SECONDS=30\nSHOWCASE_STATE=/var/lib/showcase\nSHOWCASE_DATABASE=${bound:postgres-database:at}\n" },
|
|
|
|
{ "id": "packed", "type": "archive", "path": "/opt/showcase", "artifact": "files" },
|
|
|
|
{ "id": "net", "type": "network", "name": "showcase" },
|
|
|
|
{ "id": "tooling", "type": "package", "package": "jq" },
|
|
|
|
{ "id": "migrate", "type": "process", "name": "showcase-migrate", "artifact": "code",
|
|
"run": ["node", "step/index.js"], "run-once": true,
|
|
"env-file": ["/var/lib/showcase/showcase.env"] },
|
|
|
|
{ "id": "server", "type": "process", "name": "showcase", "artifact": "code",
|
|
"run": ["node", "daemon/index.js"], "user": "showcase",
|
|
"env-file": ["/var/lib/showcase/showcase.env"],
|
|
"restart-on": ["settings"] },
|
|
|
|
{ "id": "reporting", "type": "process", "name": "showcase-report", "artifact": "code",
|
|
"run": ["node", "report/index.js"], "schedule": "0 3 * * *",
|
|
"env-file": ["/var/lib/showcase/showcase.env"] },
|
|
|
|
{ "id": "tools", "type": "container", "name": "mesh-showcase", "artifact": "helper",
|
|
"network": "showcase",
|
|
"volumes": ["/var/lib/mesh/showcase/broker:/run/secrets/broker:ro"],
|
|
"env": { "MESH_BROKER_FILE": "/run/secrets/broker" },
|
|
"args": ["sleep", "infinity"] }
|
|
]
|
|
}
|