diff --git a/modules/mesh-delivery-indexer/internal/index/manifests_test.go b/modules/mesh-delivery-indexer/internal/index/manifests_test.go index f2c92a6fd..8566583f0 100644 --- a/modules/mesh-delivery-indexer/internal/index/manifests_test.go +++ b/modules/mesh-delivery-indexer/internal/index/manifests_test.go @@ -9,7 +9,8 @@ import ( ) // The manifests these tests carry are real files, copied unchanged into testdata: the module.json of modules of -// mesh-catalog at its main commit a67f01963f0d9ef0913a63720b89e573ca7a16ef (testdata/catalogue-a67f0196-.module.json) +// mesh-catalog at its main commit a67f01963f0d9ef0913a63720b89e573ca7a16ef (testdata/catalogue-a67f0196-.module.json), +// at 30a3e665e0070ae5b0ebfede985da5759af8affd for those that claim a seat (testdata/catalogue-30a3e665-.module.json) // and of build-agent from mesh-controller at its main commit f2d7bc94 (testdata/controller-f2d7bc94-build-agent.module.json). func fixture(t *testing.T, name string) string { t.Helper() @@ -20,8 +21,14 @@ func fixture(t *testing.T, name string) string { return string(b) } +// catalogueManifest is a module's captured module.json of mesh-catalog: ca-trust's at 30a3e665, the group's catalogue head +// of design 47 H2 (it claims a seat, so it names its class, §810, §814; H-A-430 (3)), every other at a67f0196. func catalogueManifest(t *testing.T, module string) string { - return fixture(t, "catalogue-a67f0196-"+module) + at := "a67f0196" + if module == "ca-trust" { + at = "30a3e665" + } + return fixture(t, "catalogue-"+at+"-"+module) } // avahiGoSum is the sha256 of modules/avahi/go.sum in mesh-catalog at a67f0196 (sha256sum of that file). diff --git a/modules/mesh-delivery-indexer/internal/index/predefined_test.go b/modules/mesh-delivery-indexer/internal/index/predefined_test.go index a08ad11d3..2a30782b2 100644 --- a/modules/mesh-delivery-indexer/internal/index/predefined_test.go +++ b/modules/mesh-delivery-indexer/internal/index/predefined_test.go @@ -7,10 +7,10 @@ import ( // Issue 1751: a manifest whose config value falls back to a predefined key (novox/hq ADR 0348) is read by the indexer, so // the module gets its new-form inputs. The manifests are claude-code's, dunst's and xterm's module.json from mesh-catalog -// at 835bf22b. +// at 30a3e665. func TestAManifestFallingBackToAPredefinedKeyIsRead(t *testing.T) { // 1751 for _, module := range []string{"claude-code", "dunst", "xterm"} { - raw := fixture(t, "catalogue-835bf22b-"+module) + raw := fixture(t, "catalogue-30a3e665-"+module) if !strings.Contains(raw, `"predefined"`) { t.Fatalf("%s: the fixture names no predefined key", module) } @@ -20,7 +20,7 @@ func TestAManifestFallingBackToAPredefinedKeyIsRead(t *testing.T) { // 1751 } } // A predefined key of another type than its value is still refused: the read judges what it can. - raw := strings.Replace(fixture(t, "catalogue-835bf22b-xterm"), `"predefined": "font-size"`, `"predefined": "font-size", "trusted": "yes"`, 1) + raw := strings.Replace(fixture(t, "catalogue-30a3e665-xterm"), `"predefined": "font-size"`, `"predefined": "font-size", "trusted": "yes"`, 1) if in := inputsOf("xterm", raw, "newtree", nil, func(string) (string, string) { return "", "none" }); in.Kept != nil { t.Errorf("inputs = %+v, want a manifest the catalogue refuses still refused", in) } diff --git a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-a67f0196-ca-trust.module.json b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-ca-trust.module.json similarity index 96% rename from modules/mesh-delivery-indexer/internal/index/testdata/catalogue-a67f0196-ca-trust.module.json rename to modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-ca-trust.module.json index b3c9dc930..eed1faf32 100644 --- a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-a67f0196-ca-trust.module.json +++ b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-ca-trust.module.json @@ -1,6 +1,7 @@ { "module": "ca-trust", - "version": "1", + "version": "0.1", + "class": "core", "slug": "catrust", "capabilities": [ "service-manager" diff --git a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-claude-code.module.json b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-claude-code.module.json similarity index 79% rename from modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-claude-code.module.json rename to modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-claude-code.module.json index 3b62d219b..fd0a9fc56 100644 --- a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-claude-code.module.json +++ b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-claude-code.module.json @@ -1,6 +1,7 @@ { "module": "claude-code", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "slug": "agent", "capabilities": [ @@ -11,6 +12,25 @@ { "name": "gitea-read", "optional": true + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + }, + { + "name": "findings", + "storage": "key-value", + "template": "state" } ], "binds": { @@ -22,6 +42,31 @@ "uses": [ "operator-channel" ], + "invokes": [ + "seat:mesh-hand-acts.warranted", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-catalog.seat-definitions", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-delivery.source", + "mesh-delivery-assigner.assigner_read_assignments", + "seat:anthropic-licence-manager.bindings", + "seat:anthropic-licence-manager.current", + "seat:mesh-vault.get", + "seat:operator-channel.notify" + ], + "consumes": [ + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-delivery-assigner.views.assignments", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed", + "mesh-conditions.findings-asked", + "claude-licence-manager.holdings.asked", + "claude-licence-manager.binding.changed.*", + "mesh-vault.secret-changed" + ], "state": [ "servers", "holdings", @@ -31,13 +76,13 @@ "memory", "waits" ], - "reads": [ - "claude-licence-manager.bindings" + "emits": [ + "judged", + "holdings-changed" ], "tools": [ "claude_code_status", "claude_code_render", - "claude_code_guard", "claude_code_pull", "claude_code_grant", "claude_code_add_api_key", @@ -83,7 +128,11 @@ "claude_code_home_removed", "claude_code_home_restore", "claude_code_judge", - "claude_code_judged" + "claude_code_judged", + "claude_code_first_views", + "claude_code_first_view_again", + "claude_code_seat_list", + "claude_code_seat_list_again" ], "data": { "own": [ @@ -210,7 +259,16 @@ "path": "${dir:state}/settings.json", "mode": "0600", "owner": "${machine:account}", - "takes-config": ["role", "mcp_servers", "managed_settings", "instructions", "output_styles", "skills", "commands", "agents"], + "takes-config": [ + "role", + "mcp_servers", + "managed_settings", + "instructions", + "output_styles", + "skills", + "commands", + "agents" + ], "merge": "json", "template": "files/settings.json" } @@ -236,7 +294,8 @@ "env": { "MESH_CLAUDE_CODE_STATE": "${dir:state}", "MESH_CLAUDE_CODE_FACTS": "${dir:state}/facts.json", - "MESH_CLAUDE_CODE_SETTINGS": "${dir:state}/settings.json" + "MESH_CLAUDE_CODE_SETTINGS": "${dir:state}/settings.json", + "MESH_CLAUDE_CODE_FORGE": "${dir:state}/gitea-read.secret" } }, { diff --git a/modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-dunst.module.json b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-dunst.module.json similarity index 98% rename from modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-dunst.module.json rename to modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-dunst.module.json index 0c6983b4d..7821e3f9d 100644 --- a/modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-dunst.module.json +++ b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-dunst.module.json @@ -1,6 +1,7 @@ { "module": "dunst", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-xterm.module.json b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-xterm.module.json similarity index 99% rename from modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-xterm.module.json rename to modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-xterm.module.json index b65be8eb9..195510057 100644 --- a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-xterm.module.json +++ b/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-30a3e665-xterm.module.json @@ -1,6 +1,7 @@ { "module": "xterm", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/judge/rules_test.go b/modules/mesh-delivery-indexer/judge/rules_test.go index a82cdca43..433413f0a 100644 --- a/modules/mesh-delivery-indexer/judge/rules_test.go +++ b/modules/mesh-delivery-indexer/judge/rules_test.go @@ -4147,12 +4147,16 @@ func caseNodeBuildAgentIsRetiredForTheBuildSeats(t *testing.T) { if !s.Yields { t.Errorf("%s does not yield (ADR 0553)", name) } + // The seat's definition is the catalogue's (mesh-contracts'), and it serves more than these since (drop, + // kept-artifact, steps, output, answer): the retirement holds current, pause and resume among them. var verbs []string for _, v := range s.Serves { verbs = append(verbs, v.Name) } - if strings.Join(verbs, ",") != "current,pause,resume" { - t.Errorf("%s serves %v", name, verbs) + for _, want := range []string{"current", "pause", "resume"} { + if !slices.Contains(verbs, want) { + t.Errorf("%s serves %v, without %s", name, verbs, want) + } } } // The build seats are the seats that yield, and no other (ADR 0553 §1). @@ -4302,13 +4306,13 @@ func caseOnlyChannelAndIntakeAreKinded(t *testing.T) { } // The indexer and the builder hold no published list of predefined keys; a manifest whose config values fall back to -// one (claude-code, dunst, xterm at mesh-catalog 835bf22b) is still read for its build's and fingerprint's inputs +// one (claude-code, dunst, xterm at mesh-catalog 30a3e665) is still read for its build's and fingerprint's inputs // (issue 1751). func caseParseManifestForInputsReadsAValueFallingBackToAPredefinedKey(t *testing.T) { // issue 1751 was := catalogue.ReplacePublished(nil) // the indexer's and the builder's case: no published list defer catalogue.ReplacePublished(was) for _, module := range []string{"claude-code", "dunst", "xterm"} { - raw, err := os.ReadFile("testdata/catalogue-835bf22b-" + module + ".module.json") + raw, err := os.ReadFile("testdata/catalogue-30a3e665-" + module + ".module.json") if err != nil { t.Fatal(err) } diff --git a/modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-claude-code.module.json b/modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-claude-code.module.json similarity index 79% rename from modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-claude-code.module.json rename to modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-claude-code.module.json index 3b62d219b..fd0a9fc56 100644 --- a/modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-claude-code.module.json +++ b/modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-claude-code.module.json @@ -1,6 +1,7 @@ { "module": "claude-code", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "slug": "agent", "capabilities": [ @@ -11,6 +12,25 @@ { "name": "gitea-read", "optional": true + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + }, + { + "name": "findings", + "storage": "key-value", + "template": "state" } ], "binds": { @@ -22,6 +42,31 @@ "uses": [ "operator-channel" ], + "invokes": [ + "seat:mesh-hand-acts.warranted", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-catalog.seat-definitions", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-delivery.source", + "mesh-delivery-assigner.assigner_read_assignments", + "seat:anthropic-licence-manager.bindings", + "seat:anthropic-licence-manager.current", + "seat:mesh-vault.get", + "seat:operator-channel.notify" + ], + "consumes": [ + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-delivery-assigner.views.assignments", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed", + "mesh-conditions.findings-asked", + "claude-licence-manager.holdings.asked", + "claude-licence-manager.binding.changed.*", + "mesh-vault.secret-changed" + ], "state": [ "servers", "holdings", @@ -31,13 +76,13 @@ "memory", "waits" ], - "reads": [ - "claude-licence-manager.bindings" + "emits": [ + "judged", + "holdings-changed" ], "tools": [ "claude_code_status", "claude_code_render", - "claude_code_guard", "claude_code_pull", "claude_code_grant", "claude_code_add_api_key", @@ -83,7 +128,11 @@ "claude_code_home_removed", "claude_code_home_restore", "claude_code_judge", - "claude_code_judged" + "claude_code_judged", + "claude_code_first_views", + "claude_code_first_view_again", + "claude_code_seat_list", + "claude_code_seat_list_again" ], "data": { "own": [ @@ -210,7 +259,16 @@ "path": "${dir:state}/settings.json", "mode": "0600", "owner": "${machine:account}", - "takes-config": ["role", "mcp_servers", "managed_settings", "instructions", "output_styles", "skills", "commands", "agents"], + "takes-config": [ + "role", + "mcp_servers", + "managed_settings", + "instructions", + "output_styles", + "skills", + "commands", + "agents" + ], "merge": "json", "template": "files/settings.json" } @@ -236,7 +294,8 @@ "env": { "MESH_CLAUDE_CODE_STATE": "${dir:state}", "MESH_CLAUDE_CODE_FACTS": "${dir:state}/facts.json", - "MESH_CLAUDE_CODE_SETTINGS": "${dir:state}/settings.json" + "MESH_CLAUDE_CODE_SETTINGS": "${dir:state}/settings.json", + "MESH_CLAUDE_CODE_FORGE": "${dir:state}/gitea-read.secret" } }, { diff --git a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-dunst.module.json b/modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-dunst.module.json similarity index 98% rename from modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-dunst.module.json rename to modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-dunst.module.json index 0c6983b4d..7821e3f9d 100644 --- a/modules/mesh-delivery-indexer/internal/index/testdata/catalogue-835bf22b-dunst.module.json +++ b/modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-dunst.module.json @@ -1,6 +1,7 @@ { "module": "dunst", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-xterm.module.json b/modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-xterm.module.json similarity index 99% rename from modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-xterm.module.json rename to modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-xterm.module.json index b65be8eb9..195510057 100644 --- a/modules/mesh-delivery-indexer/judge/testdata/catalogue-835bf22b-xterm.module.json +++ b/modules/mesh-delivery-indexer/judge/testdata/catalogue-30a3e665-xterm.module.json @@ -1,6 +1,7 @@ { "module": "xterm", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/CAPTURED b/modules/mesh-delivery-indexer/testdata/beside/CAPTURED index 2b692aa87..755ff6d8e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/CAPTURED +++ b/modules/mesh-delivery-indexer/testdata/beside/CAPTURED @@ -8,15 +8,12 @@ private addresses. That is acceptable while mesh-sdk is private; if it ever goes a second place to clean besides the catalogue itself. Only what go/catalogue's tests read is captured (R4b, issue 1379), copied here from mesh-sdk with the judge's tests -(issue 1585). mesh-host refreshed 2026-11-01 from its main, the catalogue 2026-10-21 from its main; before that it +(issue 1585). mesh-host refreshed 2026-11-01 from its main, the catalogue 2026-11-22 from its feat/47-H2 (milestone 47/H2's group); before that it was mesh-controller's copy, which still held two modules that had left the catalogue. -mesh-catalog b5dbfbb784507e211372a7c9640d91f7d6dadd84 modules/*/module.json, modules/*/files/**, modules/*/templates/**, predefined.json +mesh-catalog 30a3e665e0070ae5b0ebfede985da5759af8affd (feat/47-H2, the delivery group's catalogue head; design 47 H2 + H-A-428, H-A-430 (3)) modules/*/module.json, modules/*/files/**, modules/*/templates/**, predefined.json mesh-host 233bb23bbcb1a829ce2a6164a31a5c5cc4f3d950 internal/apply/placement_guard.go -mesh-catalog 2d5358b8 (milestone 47/G's AM-K1) modules/zsh/module.json alone: the login shell uses operator-channel for - its seat's marked execute (design 46 approval mark §21), which the validator requires (§4) -mesh-catalog cd3b8fe8 (restic's secrets-owner, ADR 0680) modules/restic/module.json and modules/restic/files/** alone: its - processes run as the operator account, so the validator (ADR 0680 §3) needs the secrets-owner it names To move them, from mesh-delivery's modules/mesh-delivery-indexer directory, with the two repositories checked out beside mesh-delivery: diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/adwaita/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/adwaita/module.json.captured index bf81c8331..44bbe78dd 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/adwaita/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/adwaita/module.json.captured @@ -1,6 +1,7 @@ { "module": "adwaita", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/files/store-address b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/files/store-address new file mode 100644 index 000000000..71418ef2a --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/files/store-address @@ -0,0 +1 @@ +${seat:container-image-registry:reach} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/module.json.captured index 208329cd5..26622f54e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/artifact-store-tools/module.json.captured @@ -1,26 +1,64 @@ { "module": "artifact-store-tools", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds": "0.1" + }, + "claims": [ + { + "name": "mesh-artifact-sweep", + "scope": "mesh", + "serves": [ + "artifacts", + "held", + "collect", + "mirrors", + "images" + ] + } + ], "invokes": [ - "seat:mesh-controller.artifacts", - "seat:mesh-controller.collect", - "mesh-catalog.catalog_modules", - "mesh-catalog.catalog_module" + "seat:mesh-hand-acts.hand-act", + "seat:mesh-catalog.modules", + "seat:mesh-catalog.module", + "mesh-delivery-assigner.assigner_read_wants", + "mesh-delivery-indexer.indexer_read_manifests", + "seat:oci-artifact-registry.hold", + "seat:oci-artifact-registry.release", + "seat:oci-artifact-registry.remove", + "seat:container-image-registry.hold", + "seat:container-image-registry.release", + "seat:container-image-registry.remove", + "seat:container-image-registry.list", + "seat:oci-artifact-registry.list" + ], + "reads": [ + "mesh-delivery-builder.builds", + "mesh-delivery-builder.build-log", + "node-engine.have" + ], + "consumes": [ + "mesh-delivery-assigner.views.wants", + "mesh-delivery-indexer.views.manifests", + "mesh-conditions.findings-asked" ], "tools": [ "artifact_store_repositories", "artifact_store_usage", "artifact_store_references", - "artifact_store_collect" + "artifact_store_collect", + "artifact_store_first_views", + "artifact_store_first_view_again" ], - "config": { - "older-store-names": { - "type": "string", - "description": "The names the artifact store had before, as host names or host:port separated by spaces, or none when it had no other. artifact_store_references reads every definition under these as well as under the store's current name, so an image a definition pins under one is said to be named by a definition (novox/hq issue 323).", - "pattern": "none|[A-Za-z0-9.:-]+( [A-Za-z0-9.:-]+)*", - "default": "none" - } - }, + "config": { + "older-store-names": { + "type": "string", + "description": "The names the artifact store had before, as host names or host:port separated by spaces, or none when it had no other. artifact_store_references reads every definition under these as well as under the store's current name, so an image a definition pins under one is said to be named by a definition (novox/hq issue 323).", + "pattern": "none|[A-Za-z0-9.:-]+( [A-Za-z0-9.:-]+)*", + "default": "none" + } + }, "resources": [ { "id": "state", @@ -36,6 +74,14 @@ "mode": "0600", "trusted": false, "template": "files/store-names" + }, + { + "id": "store-address", + "type": "file", + "path": "${dir:state}/store-address", + "mode": "0600", + "trusted": false, + "template": "files/store-address" } ], "build": { @@ -51,8 +97,8 @@ "artifact-store-tools" ], "env": { - "MESH_ARTIFACT_STORE_CONTAINER": "mesh-registry", - "MESH_ARTIFACT_STORE_NAMES_FILE": "${dir:state}/store-names" + "MESH_ARTIFACT_STORE_NAMES_FILE": "${dir:state}/store-names", + "MESH_ARTIFACT_STORE_ADDRESS_FILE": "${dir:state}/store-address" } }, { @@ -61,5 +107,29 @@ "from": "files" } ] - } + }, + "requires": [ + { + "name": "findings", + "storage": "key-value", + "template": "state", + "options": { + "max-mib": 8 + } + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/asus-zephyrus-g14/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/asus-zephyrus-g14/module.json.captured index d1ee8d3b8..4055b81cd 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/asus-zephyrus-g14/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/asus-zephyrus-g14/module.json.captured @@ -1,6 +1,7 @@ { "module": "asus-zephyrus-g14", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "templates": "templates", "capabilities": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/audit-logger/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/audit-logger/module.json.captured index 122b94e75..4314b5af2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/audit-logger/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/audit-logger/module.json.captured @@ -1,6 +1,7 @@ { "module": "audit-logger", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "audit", "consumes": [ "**" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/avahi/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/avahi/module.json.captured index de99c7c9c..b73cbcca7 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/avahi/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/avahi/module.json.captured @@ -1,6 +1,7 @@ { "module": "avahi", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/baserow/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/baserow/module.json.captured index 811962180..ef7de33b6 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/baserow/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/baserow/module.json.captured @@ -1,6 +1,7 @@ { "module": "baserow", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/accounts.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/accounts.json deleted file mode 100644 index e182cc3d4..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/accounts.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "accounts": {} -} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/betterbird b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/betterbird deleted file mode 100755 index 3ce088a86..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/betterbird +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# Betterbird's start, written by the mesh (module betterbird, novox/hq ADR 0316). Replaced at every push. -# -# Before Betterbird starts, the module's tools place its user.js in the profile (the settings prefs, accounts, identities, calendars, -# address-books and tags) and write what Betterbird rewrites itself: the account lists and each declared account's filters. They do -# it only while no Betterbird of this account runs, because Betterbird rewrites its saved preferences when it quits; a -# second start while one runs only hands over to it. What the preparation could not do it says here, and -# betterbird_check says it too. Betterbird starts either way: its configuration never holds the mail back. -/usr/local/lib/mesh-betterbird/betterbird-tools prepare || echo "betterbird: the mesh's preparation did not complete; betterbird_check says why" >&2 -exec /opt/betterbird/betterbird "$@" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/configuration.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/configuration.json deleted file mode 100644 index 702044623..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/configuration.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "identities": {}, - "calendars": {}, - "address-books": {}, - "filters": {} -} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/eu.betterbird.Betterbird.desktop b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/eu.betterbird.Betterbird.desktop deleted file mode 100644 index e409fcf82..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/eu.betterbird.Betterbird.desktop +++ /dev/null @@ -1,25 +0,0 @@ -[Desktop Entry] -Version=1.0 -Type=Application -Name=Betterbird -GenericName=Mail Client -Comment=Send and receive mail with Betterbird -Exec=/usr/local/bin/betterbird %u -Icon=/opt/betterbird/chrome/icons/default/default128.png -Terminal=false -Categories=Network;Email; -MimeType=message/rfc822;x-scheme-handler/mailto;application/x-xpinstall;application/x-extension-ics;text/calendar;text/vcard;text/x-vcard;x-scheme-handler/webcal;x-scheme-handler/webcals;x-scheme-handler/mid; -StartupNotify=true -StartupWMClass=eu.betterbird.Betterbird -Keywords=Email;E-mail;Calendar;Thunderbird; -Actions=ComposeMessage;OpenAddressBook; -# Written by the mesh (module betterbird, novox/hq ADR 0316 §3), in place of the community package's entry: -# it starts Betterbird through the module's start, and names the icon in the installation, with no link. - -[Desktop Action ComposeMessage] -Name=Write new message -Exec=/usr/local/bin/betterbird -compose - -[Desktop Action OpenAddressBook] -Name=Open address book -Exec=/usr/local/bin/betterbird -addressbook diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/prefs.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/prefs.json deleted file mode 100644 index 45fd9732c..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/prefs.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "prefs": {} -} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/tags.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/tags.json deleted file mode 100644 index 4772f099f..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/files/tags.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "tags": {} -} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/module.json.captured deleted file mode 100644 index 891f88322..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/betterbird/module.json.captured +++ /dev/null @@ -1,253 +0,0 @@ -{ - "module": "betterbird", - "version": "1", - "upgrade": { - "policy": "record", - "why": "a new build may remove the community package betterbird-bin and replaces the installation in /opt/betterbird, which a running Betterbird has open: the switch on each node and every upgrade wait for the operator, who quits Betterbird first and then pushes (novox/hq ADR 0316 §4, §5)" - }, - "requires": [ - "x11-display" - ], - "invokes": [ - "seat:mesh-controller.settings", - "seat:mesh-controller.nodes", - "seat:mesh-controller.node", - "betterbird.betterbird_derive" - ], - "tools": [ - "betterbird_status", - "betterbird_prefs", - "betterbird_config", - "betterbird_config_apply", - "betterbird_user_js", - "betterbird_log", - "betterbird_restart", - "betterbird_check", - "betterbird_accounts", - "betterbird_identities", - "betterbird_calendars", - "betterbird_address_books", - "betterbird_filters", - "betterbird_tags", - "betterbird_derive", - "betterbird_drift", - "betterbird_reminder_test" - ], - "config": { - "prefs": { - "type": "object", - "description": "Betterbird's preferences the operator sets, by their own names (mailnews.*, calendar.* and the like), laid into prefs.json; an account's, a server's and a tag's are refused, as accounts, the four kinds and tags own them (novox/hq ADR 0329 §6).", - "trusted": true, - "default": {} - }, - "accounts": { - "type": "object", - "description": "The mail accounts Betterbird is set up with, each by a name of the operator's: its address, its sender's name and its incoming and outgoing servers; no password, token or cookie (novox/hq ADR 0329 §2).", - "trusted": true, - "default": {} - }, - "identities": { - "type": "object", - "description": "The identities beside an account's own, each by a name of the operator's: the address and name it sends as, its signature as a list of lines, and the profile's key to adopt on a node.", - "trusted": true, - "default": {} - }, - "calendars": { - "type": "object", - "description": "The calendars Betterbird shows, each by a name of the operator's: where it is and how it is reached, and the profile's key to adopt on a node.", - "trusted": true, - "default": {} - }, - "address-books": { - "type": "object", - "description": "The address books Betterbird uses, each by a name of the operator's: where it is and how it is reached, and the profile's key to adopt on a node.", - "trusted": true, - "default": {} - }, - "filters": { - "type": "object", - "description": "The message filters of each account, by account: what each matches and what it does with the mail.", - "trusted": true, - "default": {} - }, - "tags": { - "type": "object", - "description": "The tags Betterbird offers, each by its own key: its name, colour and order; trusted since issue 751, so a change to it is the operator's to approve.", - "trusted": true, - "default": {} - } - }, - "resources": [ - { - "id": "configuration-dir", - "type": "directory", - "path": "${machine:account-home}/.config/betterbird", - "owner": "${machine:account}", - "mode": "0755", - "unknown": "move-out", - "knows": ["accounts-record.json", "configuration-record.json", "kept/"] - }, - { - "id": "prefs", - "type": "file", - "path": "${machine:account-home}/.config/betterbird/prefs.json", - "owner": "${machine:account}", - "mode": "0644", - "merge": "json", - "takes-config": [ - "prefs" - ], - "template": "files/prefs.json", - "trusted": true - }, - { - "id": "accounts", - "type": "file", - "path": "${machine:account-home}/.config/betterbird/accounts.json", - "owner": "${machine:account}", - "mode": "0600", - "merge": "json", - "takes-config": [ - "accounts" - ], - "template": "files/accounts.json", - "trusted": true - }, - { - "id": "configuration", - "type": "file", - "path": "${machine:account-home}/.config/betterbird/configuration.json", - "owner": "${machine:account}", - "mode": "0600", - "merge": "json", - "takes-config": [ - "identities", - "calendars", - "address-books", - "filters" - ], - "template": "files/configuration.json", - "trusted": true - }, - { - "id": "tags", - "type": "file", - "path": "${machine:account-home}/.config/betterbird/tags.json", - "owner": "${machine:account}", - "mode": "0644", - "merge": "json", - "takes-config": [ - "tags" - ], - "template": "files/tags.json", - "trusted": true - }, - { - "id": "community-package", - "type": "package", - "package": "betterbird-bin", - "absent": true - }, - { - "id": "installation", - "type": "archive", - "path": "/opt/betterbird", - "artifact": "archive", - "unknown": "program" - }, - { - "id": "owl", - "type": "archive", - "path": "/opt/betterbird/owl", - "artifact": "owl", - "unknown": "program" - }, - { - "id": "policies", - "type": "archive", - "path": "/opt/betterbird/distribution", - "artifact": "distribution", - "unknown": "program" - }, - { - "id": "spelling", - "type": "archive", - "path": "/opt/betterbird/defaults/pref", - "artifact": "defaults", - "unknown": "program" - }, - { - "id": "preparation", - "type": "archive", - "path": "/usr/local/lib/mesh-betterbird", - "artifact": "tools", - "unknown": "program" - }, - { - "id": "start", - "type": "file", - "path": "/usr/local/bin/betterbird", - "mode": "0755", - "template": "files/betterbird" - }, - { - "id": "launcher", - "type": "file", - "path": "/usr/local/share/applications/eu.betterbird.Betterbird.desktop", - "mode": "0644", - "template": "files/eu.betterbird.Betterbird.desktop" - } - ], - "build": { - "artifacts": [ - { - "name": "tools", - "kind": "bundle", - "language": "go", - "system": "arch", - "from": "cmd/betterbird-tools", - "binary": "betterbird-tools", - "loads": [ - "betterbird-tools" - ] - }, - { - "name": "archive", - "kind": "archive", - "url": "https://www.betterbird.eu/downloads/LinuxArchive/betterbird-153.4.0esr-bb10.en-US.linux-x86_64.tar.xz", - "sha256": "38dd24890a66b4cf9a45bc24e15192e00c26b929e1bb8df7974c16a4539129e2", - "version": "153.4.0esr-bb10", - "within": "betterbird", - "names-on-purpose": { - "www.betterbird.eu": "Betterbird's project publishes its Linux release there; the build seat fetches it once, by its pinned sha256 (novox/hq ADR 0316 §2)" - } - }, - { - "name": "owl", - "kind": "archive", - "url": "https://www.beonex.com/owl/owl.xpi", - "sha256": "a54cc3d52113b34f97942ee19190947dee23561e2217f18db3d80ac023991221", - "version": "1.5.6.1", - "file": "owl.xpi", - "names-on-purpose": { - "www.beonex.com": "Owl's vendor publishes its xpi there; the build seat fetches it once, by its pinned sha256 (novox/hq ADR 0316 §6)" - } - }, - { - "name": "distribution", - "kind": "archive", - "from": "install/distribution" - }, - { - "name": "defaults", - "kind": "archive", - "from": "install/defaults-pref" - }, - { - "name": "files", - "kind": "archive", - "from": "files" - } - ] - } -} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/blueman/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/blueman/module.json.captured index 73a764068..c896e7afb 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/blueman/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/blueman/module.json.captured @@ -1,6 +1,7 @@ { "module": "blueman", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/bluetooth/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/bluetooth/module.json.captured index dfaabf10a..8d908e6b5 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/bluetooth/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/bluetooth/module.json.captured @@ -1,6 +1,7 @@ { "module": "bluetooth", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/files/bucket.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/files/bucket.json new file mode 100644 index 000000000..b72b23313 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/files/bucket.json @@ -0,0 +1,3 @@ +{ + "bucket": "${bound:s3-bucket:bucket}" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/files/fetch.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/files/fetch.json new file mode 100644 index 000000000..abef425fc --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/files/fetch.json @@ -0,0 +1,3 @@ +{ + "mesh-range": "${machine:mesh-range}" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/module.json.captured index 57559d56c..158ea6898 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/brother/module.json.captured @@ -1,8 +1,22 @@ { "module": "brother", - "version": "1", + "version": "0.1", + "class": "core", "requires": [ - "s3-bucket" + { + "name": "s3-bucket", + "shares": [ + { + "to": "seat:node-files", + "methods": [ + "put" + ] + } + ] + } + ], + "invokes": [ + "seat:node-files.upload" ], "binds": { "s3-bucket": "${dir:state}/store-binding.json" @@ -199,6 +213,21 @@ "mode": "0600", "template": "files/store.json" }, + { + "id": "bucket", + "type": "file", + "path": "${dir:state}/bucket.json", + "mode": "0644", + "template": "files/bucket.json" + }, + { + "id": "fetch", + "type": "file", + "path": "${dir:state}/fetch.json", + "owner": "brother-device", + "mode": "0600", + "template": "files/fetch.json" + }, { "id": "device", "type": "process", @@ -213,11 +242,13 @@ "BROTHER_SETTINGS": "${dir:state}/settings.json", "BROTHER_ADMIN_PASSWORD": "${dir:state}/admin-password.secret", "BROTHER_BROKER": "${dir:state}/broker-device.secret", - "BROTHER_STORE": "${dir:state}/store.json" + "BROTHER_STORE": "${dir:state}/store.json", + "BROTHER_FETCH": "${dir:state}/fetch.json" }, "restart-on": [ "settings", - "store" + "store", + "fetch" ], "bus": { "queues": [ @@ -228,6 +259,9 @@ ], "emits": [ "scan.added" + ], + "invokes": [ + "seat:document-converter.convert" ] }, "health": { @@ -267,7 +301,8 @@ "brother" ], "env": { - "BROTHER_SETTINGS": "${dir:state}/settings.json" + "BROTHER_SETTINGS": "${dir:state}/settings.json", + "BROTHER_BUCKET": "${dir:state}/bucket.json" } }, { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/buildah/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/buildah/module.json.captured new file mode 100644 index 000000000..4f2cdad59 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/buildah/module.json.captured @@ -0,0 +1,25 @@ +{ + "module": "buildah", + "version": "0.1", + "class": "leaf", + "capabilities": [ + "package-manager", + "user-namespaces" + ], + "provides": [ + { + "name": "rootless-image-build", + "reach": "machine", + "credential": { + "form": "none" + } + } + ], + "resources": [ + { + "id": "buildah", + "type": "package", + "package": "buildah" + } + ] +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ca-trust/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ca-trust/module.json.captured index b3c9dc930..eed1faf32 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ca-trust/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ca-trust/module.json.captured @@ -1,6 +1,7 @@ { "module": "ca-trust", - "version": "1", + "version": "0.1", + "class": "core", "slug": "catrust", "capabilities": [ "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/files/claude-agent b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/files/claude-agent index e3d330f2b..0281cdb39 100755 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/files/claude-agent +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/files/claude-agent @@ -5,9 +5,5 @@ agent='${machine:agent-account}' if [ "$(id -un)" = "$agent" ]; then exec claude "$@" fi -# Another account, the operator's, becomes the agent's through its own sudo: the person is the authority. The -# operator's override of the guard travels only when it is set in this shell, as it would reach claude. -if [ -n "$MESH_GUARD_OVERRIDE" ]; then - exec sudo -iu "$agent" env MESH_GUARD_OVERRIDE="$MESH_GUARD_OVERRIDE" claude "$@" -fi +# Another account, the operator's, becomes the agent's through its own sudo: the person is the authority. exec sudo -iu "$agent" claude "$@" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/module.json.captured index b869d0124..fd0a9fc56 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-code/module.json.captured @@ -1,6 +1,7 @@ { "module": "claude-code", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "slug": "agent", "capabilities": [ @@ -11,6 +12,25 @@ { "name": "gitea-read", "optional": true + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + }, + { + "name": "findings", + "storage": "key-value", + "template": "state" } ], "binds": { @@ -22,21 +42,47 @@ "uses": [ "operator-channel" ], + "invokes": [ + "seat:mesh-hand-acts.warranted", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-catalog.seat-definitions", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-delivery.source", + "mesh-delivery-assigner.assigner_read_assignments", + "seat:anthropic-licence-manager.bindings", + "seat:anthropic-licence-manager.current", + "seat:mesh-vault.get", + "seat:operator-channel.notify" + ], + "consumes": [ + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-delivery-assigner.views.assignments", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed", + "mesh-conditions.findings-asked", + "claude-licence-manager.holdings.asked", + "claude-licence-manager.binding.changed.*", + "mesh-vault.secret-changed" + ], "state": [ "servers", "holdings", "config", "proposals", "questions", - "memory" + "memory", + "waits" ], - "reads": [ - "claude-licence-manager.bindings" + "emits": [ + "judged", + "holdings-changed" ], "tools": [ "claude_code_status", "claude_code_render", - "claude_code_guard", "claude_code_pull", "claude_code_grant", "claude_code_add_api_key", @@ -67,6 +113,7 @@ "claude_code_proposals", "claude_code_ask", "claude_code_answer", + "claude_code_wait", "claude_code_settings_get", "claude_code_settings_set", "claude_code_settings_clear", @@ -81,7 +128,11 @@ "claude_code_home_removed", "claude_code_home_restore", "claude_code_judge", - "claude_code_judged" + "claude_code_judged", + "claude_code_first_views", + "claude_code_first_view_again", + "claude_code_seat_list", + "claude_code_seat_list_again" ], "data": { "own": [ @@ -208,7 +259,16 @@ "path": "${dir:state}/settings.json", "mode": "0600", "owner": "${machine:account}", - "takes-config": ["role", "mcp_servers", "managed_settings", "instructions", "output_styles", "skills", "commands", "agents"], + "takes-config": [ + "role", + "mcp_servers", + "managed_settings", + "instructions", + "output_styles", + "skills", + "commands", + "agents" + ], "merge": "json", "template": "files/settings.json" } @@ -234,7 +294,8 @@ "env": { "MESH_CLAUDE_CODE_STATE": "${dir:state}", "MESH_CLAUDE_CODE_FACTS": "${dir:state}/facts.json", - "MESH_CLAUDE_CODE_SETTINGS": "${dir:state}/settings.json" + "MESH_CLAUDE_CODE_SETTINGS": "${dir:state}/settings.json", + "MESH_CLAUDE_CODE_FORGE": "${dir:state}/gitea-read.secret" } }, { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/database.url b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/database.url deleted file mode 100644 index dc59da9a2..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/database.url +++ /dev/null @@ -1 +0,0 @@ -postgresql://${bound:postgres-database:as}:${secret:postgres-database}@${bound:postgres-database:at}:${bound:postgres-database:port}/${bound:postgres-database:as} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/settings.json index 5d4aed520..fc6df9b3a 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/settings.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/files/settings.json @@ -3,5 +3,11 @@ "floor_minutes": 60, "failures_to_notify": 3, "cooldown_hours": 24, - "refresh_warn_days": 3 + "refresh_warn_days": 3, + "switch_auto": true, + "switch_at_pct": 99, + "room_below_pct": 90, + "warn_at_pct": 90, + "usage_minutes": 5, + "usage_stale_minutes": 15 } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/module.json.captured index a55da31e2..5b6c70668 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/claude-licence-manager/module.json.captured @@ -1,29 +1,86 @@ { "module": "claude-licence-manager", - "version": "1", + "version": "0.1", + "class": "core", "slug": "licmgr", + "runs-as": "claude-licence-manager", "requires": [ - "postgres-database", - "secret" + { + "name": "licences", + "storage": "key-value", + "template": "state", + "options": { + "history": 1 + } + }, + { + "name": "bindings", + "storage": "key-value", + "template": "state", + "options": { + "history": 8 + } + }, + { + "name": "leases", + "storage": "key-value", + "template": "state", + "options": { + "history": 1, + "key-ttl": true + } + }, + { + "name": "offered", + "storage": "key-value", + "template": "state", + "options": { + "history": 1, + "key-ttl": true + } + }, + { + "name": "carried", + "storage": "key-value", + "template": "state", + "options": { + "history": 1 + } + }, + { + "name": "conditions", + "storage": "key-value", + "template": "state", + "options": { + "history": 1 + } + } ], - "contributes": { - "postgres-database": { - "name": "claude_licences", - "readable": [ - "audit", - "binding" - ] - } - }, - "binds": { - "postgres-database": "${dir:state}/database.json" - }, - "secrets": { - "postgres-database": "${dir:state}/database.secret", - "secret": { - "grant-key": "${dir:state}/grant.key" + "logs": [ + { + "name": "usage", + "max-age-days": 35, + "max-mib": 256 + }, + { + "name": "audit", + "max-mib": 64 } + ], + "own-secrets": { + "broker": "${dir:state}/broker" }, + "secrets-owner": "claude-licence-manager", + "uses": [ + "operator-channel" + ], + "invokes": [ + "seat:operator-channel.tell", + "seat:mesh-vault.licence-put", + "seat:mesh-vault.get", + "seat:mesh-config.config", + "claude-code.claude_code_grant" + ], "seats": [ { "name": "anthropic-licence-manager", @@ -63,18 +120,14 @@ "emits": [ "licence.adopted", "licence.refused", - "licence.bound", "licence.switched", - "licence.released", - "licence.rotated", "licence.failing", - "usage.read" + "usage.read", + "binding.changed", + "holdings.asked" ], - "state": [ - "bindings" - ], - "reads": [ - "claude-code.holdings" + "consumes": [ + "claude-code.holdings-changed" ], "config": { "cadence_minutes": { @@ -111,69 +164,130 @@ "minimum": 0, "trusted": true, "default": 3 + }, + "switch_auto": { + "type": "boolean", + "description": "Whether the manager moves every consumer off a licence whose weekly usage reaches switch_at_pct, to the licence with the most room; off, it still raises its no-room and near-limit conditions.", + "trusted": true, + "default": true + }, + "switch_at_pct": { + "type": "number", + "description": "The weekly usage of a licence, in percent, at which its consumers are moved to the licence with the most room.", + "minimum": 1, + "maximum": 100, + "trusted": true, + "default": 99 + }, + "room_below_pct": { + "type": "number", + "description": "What the weekly usage of a licence must be below, in percent, for it to be a target of a switch.", + "minimum": 1, + "maximum": 100, + "trusted": true, + "default": 90 + }, + "warn_at_pct": { + "type": "number", + "description": "The weekly usage of a licence with consumers, in percent, at which it is warned about once.", + "minimum": 1, + "maximum": 100, + "trusted": true, + "default": 90 + }, + "usage_minutes": { + "type": "number", + "description": "How often each subscription's usage is read, in minutes.", + "minimum": 1, + "maximum": 60, + "trusted": true, + "default": 5 + }, + "usage_stale_minutes": { + "type": "number", + "description": "How old a subscription's last successful usage reading may grow before its room is not known and it is said, in minutes.", + "minimum": 5, + "maximum": 180, + "trusted": true, + "default": 15 } }, "resources": [ + { + "id": "account", + "type": "user", + "name": "claude-licence-manager", + "shell": "/usr/bin/nologin", + "home": "/var/lib/claude-licence-manager" + }, { "id": "state", "type": "directory", "mode": "0700", + "owner": "claude-licence-manager", "place": ".", "unknown": "program" }, - { - "id": "database-url", - "type": "file", - "path": "${dir:state}/database.url", - "mode": "0600", - "template": "files/database.url" - }, { "id": "settings", "type": "file", "path": "${dir:state}/settings.json", "mode": "0600", - "takes-config": ["cadence_minutes", "floor_minutes", "failures_to_notify", "cooldown_hours", "refresh_warn_days"], + "owner": "claude-licence-manager", + "takes-config": [ + "cadence_minutes", + "floor_minutes", + "failures_to_notify", + "cooldown_hours", + "refresh_warn_days", + "switch_auto", + "switch_at_pct", + "room_below_pct", + "warn_at_pct", + "usage_minutes", + "usage_stale_minutes" + ], "merge": "json", "template": "files/settings.json" - }, - { - "id": "prepare", - "type": "process", - "name": "claude-licence-manager-prepare", - "artifact": "code", - "run": [ - "./claude-licence-manager", - "prepare" - ], - "run-once": true, - "env": { - "DATABASE_URL_FILE": "${dir:state}/database.url" - }, - "restart-on": [ - "database-url" - ] } ], + "tools": [ + "licences_switches", + "licences_read_usage", + "licences_switch_now", + "licences_settings", + "licences_kept", + "licences_resync", + "licences_conditions" + ], "build": { "artifacts": [ { - "name": "code", + "name": "manager", "kind": "bundle", "language": "go", "system": "arch", - "from": "cmd/claude-licence-manager", + "from": "cmd/manager", "binary": "claude-licence-manager", "loads": [ "claude-licence-manager" ], "env": { - "DATABASE_URL_FILE": "${dir:state}/database.url", "MESH_LICENCE_STATE": "${dir:state}", - "MESH_LICENCE_KEY_FILE": "${dir:state}/grant.key", "MESH_LICENCE_SETTINGS": "${dir:state}/settings.json" } }, + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/tools", + "binary": "claude-licence-manager-tools", + "loads": [ + "claude-licence-manager-tools" + ] + }, { "name": "files", "kind": "archive", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/clipmenu/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/clipmenu/module.json.captured index 30ec9c0cf..168f925de 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/clipmenu/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/clipmenu/module.json.captured @@ -1,6 +1,7 @@ { "module": "clipmenu", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/confluence/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/confluence/module.json.captured index caa0d1be2..26dbb3333 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/confluence/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/confluence/module.json.captured @@ -1,6 +1,7 @@ { "module": "confluence", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "confl", "own-secrets": { "token": "${dir:state}/token" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/cups/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/cups/module.json.captured index 01a482288..2156e3bbc 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/cups/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/cups/module.json.captured @@ -1,6 +1,7 @@ { "module": "cups", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dbus/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dbus/module.json.captured index c0e28b3e4..9bdd57ba8 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dbus/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dbus/module.json.captured @@ -1,6 +1,7 @@ { "module": "dbus", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/desk-channel/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/desk-channel/module.json.captured index 115ce6202..bf8b4487a 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/desk-channel/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/desk-channel/module.json.captured @@ -1,6 +1,7 @@ { "module": "desk-channel", - "version": "1", + "version": "0.1", + "class": "core", "slug": "desk", "runs-as": "desk-channel", "claims": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dev-tools/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dev-tools/module.json.captured index 094f83363..754963765 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dev-tools/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dev-tools/module.json.captured @@ -1,6 +1,7 @@ { "module": "dev-tools", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/disk-load/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/disk-load/module.json.captured index e50253e6e..f19a46849 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/disk-load/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/disk-load/module.json.captured @@ -1,12 +1,17 @@ { "module": "disk-load", - "version": "1", + "version": "0.1", + "class": "leaf", "tools": [ "disk_load", "disk_top", "disk_filesystems", + "disk_folders", "disk_devices", - "cpu_top" + "cpu_top", + "disk_readings", + "disk_round", + "disk_measure" ], "build": { "artifacts": [ @@ -20,7 +25,26 @@ "loads": [ "disk-load" ] + }, + { + "name": "diskreadings", + "kind": "package", + "language": "go", + "paths": [ + "diskreadings" + ], + "series": "0.1" } ] - } + }, + "state": [ + "readings", + { + "name": "rounds", + "per-machine": true + } + ], + "reads": [ + "mesh-host.data" + ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/distribution/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/distribution/module.json.captured index eb9f7c246..6941af2d1 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/distribution/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/distribution/module.json.captured @@ -1,36 +1,96 @@ { "module": "distribution", - "version": "1", + "version": "0.1", + "class": "core", "provides": [ { "name": "artifact-store", - "scope": "mesh" + "scope": "mesh", + "credential": { + "form": "none" + } } ], + "serves": { + "artifact-store": { + "port": 5100 + } + }, "claims": [ + { + "name": "container-image-registry", + "scope": "mesh", + "serves": [ + "hold", + "list", + "mirror", + "publish", + "publish-part", + "release", + "remove", + "tags", + "versions" + ] + }, + { + "name": "oci-artifact-registry", + "scope": "mesh", + "serves": [ + "hold", + "list", + "publish", + "publish-part", + "release", + "remove", + "versions" + ] + }, { "name": "mesh-artifact-store", "scope": "mesh" } ], + "tools": [ + "registry_direct_writes", + "registry_health", + "registry_holds", + "registry_incoming", + "registry_mirrors", + "registry_old_name" + ], + "invokes": [ + "seat:mesh-builds.reserved", + "mesh-delivery-view.node_haves", + "seat:node-engine.manifest-reads", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-catalog.entry", + "seat:mesh-catalog.registrations", + "seat:mesh-catalog.revision", + "seat:mesh-delivery.source", + "seat:mesh-module-assigner.assignments" + ], + "consumes": [ + "mesh-delivery-view.delivered", + "node-engine.manifest-reads-changed", + "mesh-conditions.findings-asked", + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved" + ], "capabilities": [ "container-runtime" ], "own-secrets": { "broker": "/var/lib/mesh/registry/broker" }, - "serves": { - "artifact-store": { - "port": 5000 - } - }, + "secrets-owner": "distribution", "listens": [ { "name": "registry", - "port": 5000, + "port": 5100, "protocol": "tcp", "from": "mesh", - "why": "every machine pulls images and artifacts from here" + "why": "every machine pulls images and artifacts from here; distribution's program serves it in front of the store" } ], "data": { @@ -46,19 +106,28 @@ ] }, "resources": [ + { + "id": "account", + "type": "user", + "name": "distribution", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh/registry" + }, { "id": "state", "type": "directory", "path": "/var/lib/mesh/registry", "mode": "0700", - "unknown": "program" + "unknown": "program", + "owner": "distribution" }, { "id": "registry-data", "type": "directory", "path": "/var/lib/mesh-registry", "mode": "0700", - "unknown": "program" + "unknown": "program", + "owner": "distribution" }, { "id": "store", @@ -66,13 +135,47 @@ "name": "mesh-registry", "image": "registry@sha256:a3d8aaa63ed8681a604f1dea0aa03f100d5895b6a58ace528858a7b332415373", "ports": [ - "5000:5000" + "127.0.0.1:5001:5001" ], "volumes": [ "/var/lib/mesh-registry:/var/lib/registry" ], "env": { + "REGISTRY_HTTP_ADDR": ":5001", "REGISTRY_STORAGE_DELETE_ENABLED": "true" + }, + "health": { + "kind": "http", + "endpoint": "registry", + "path": "/v2/", + "status": 200, + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "90s" + } + }, + { + "id": "program", + "type": "process", + "name": "distribution", + "artifact": "program", + "run": [ + "./distribution" + ], + "env": { + "MESH_BROKER_FILE": "/var/lib/mesh/registry/broker", + "MESH_REGISTRY_LOOPBACK": "http://127.0.0.1:5001", + "MESH_REGISTRY_LISTEN": ":5100" + }, + "user": "distribution", + "health": { + "kind": "tool", + "tool": "registry_health", + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "90s" } }, { @@ -92,5 +195,99 @@ "store" ] } - ] + ], + "build": { + "artifacts": [ + { + "name": "program", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/distribution", + "binary": "distribution" + }, + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/distribution-tools", + "binary": "distribution-tools", + "loads": [ + "distribution-tools" + ], + "env": { + "MESH_REGISTRY_CONTAINER": "mesh-registry" + } + } + ] + }, + "streams": [ + { + "name": "distribution-findings", + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 16 + }, + { + "name": "distribution-events", + "events": [ + "old-name-closed", + "direct-writes-closed" + ], + "max-age-days": 7, + "max-mib": 16 + } + ], + "objects": [ + { + "name": "incoming", + "max-mib": 8192 + } + ], + "state": [ + { + "name": "transfers", + "max-mib": 8 + }, + { + "name": "idle", + "key-ttl": true, + "max-mib": 8 + }, + { + "name": "holds", + "max-mib": 8 + }, + { + "name": "windows", + "max-mib": 8 + }, + { + "name": "mirrors", + "max-mib": 8 + }, + { + "name": "findings", + "max-mib": 8 + }, + { + "name": "taken", + "key-ttl": true, + "max-mib": 8 + } + ], + "config": { + "ask-taken-bound": { + "type": "string", + "description": "How long the registry keeps the id of a publish ask it took, as a duration such as 10m (design 47 H2 §775): a publish given again with that id within it acts not again but answers the transfer as it stands. The largest caller's bound, the pipeline runner's ask-unanswered-bound, by default.", + "trusted": false, + "runtime": true, + "default": "10m" + } + } } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dmenu/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dmenu/module.json.captured index aeeb3ce09..71d0c4172 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dmenu/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dmenu/module.json.captured @@ -1,6 +1,7 @@ { "module": "dmenu", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/dnsmasq.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/dnsmasq.conf index 10f3926af..0169182e3 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/dnsmasq.conf +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/dnsmasq.conf @@ -57,12 +57,12 @@ listen-address=127.0.0.1 # upstreams would find itself, and every query it could not answer locally would # loop until its receive queue filled. That is not theoretical: it filled with # 15KB of queries and every lookup on the machine hung. no-resolv makes that loop -# impossible: the upstreams are the two lines below, and nothing on the machine +# impossible: the upstreams are the two lines below (the module's settings upstream-resolver-first and -second), and nothing on the machine # can redirect them. The mesh's own names never reach them: the local= line in # the file above stops them here, answered or refused. no-resolv -server=1.1.1.1 -server=8.8.8.8 +server=${config:upstream-resolver-first} +server=${config:upstream-resolver-second} # Both upstreams validate DNSSEC and say so with the Authenticated Data bit, # and this passes that bit down rather than dropping it, which dnsmasq does diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/mesh.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/mesh.conf index 96d8d7d61..7f86d122e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/mesh.conf +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/files/mesh.conf @@ -1,14 +1,15 @@ # Written by the mesh (module dnsmasq, novox/hq issue 348). Replaced on every push. # # The resolver binds its addresses once, at start (bind-interfaces), so it starts only once this -# machine's private address is there: it waits up to 80 seconds for it, and a start that found it -# missing is tried again every ten seconds rather than left failed. +# machine's private address is there: a start that finds it missing fails after at most two seconds and +# is tried again every ten seconds (Restart=on-failure, no start limit) until the tunnel has brought it. +# It does not order itself After= or Wants= network-online.target, and its wait is short: the packaged +# unit is Before= network-online.target and nss-lookup.target, and the tunnel is ordered after them, so +# a long wait would hold the tunnel back and a drop-in ordering would be a cycle (issue 1126). [Unit] -After=network-online.target -Wants=network-online.target StartLimitIntervalSec=0 [Service] -ExecStartPre=/usr/bin/sh -c 'for i in $(seq 1 80); do ip -4 -o addr show to ${machine:address} | grep -q . && exit 0; sleep 1; done; echo "${machine:address} is not on this machine" >&2; exit 1' +ExecStartPre=/usr/bin/sh -c 'for i in $(seq 1 2); do ip -4 -o addr show to ${machine:address} | grep -q . && exit 0; sleep 1; done; echo "${machine:address} is not on this machine" >&2; exit 1' Restart=on-failure RestartSec=10s diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/module.json.captured index 58cc0da56..8516bb620 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dnsmasq/module.json.captured @@ -1,6 +1,7 @@ { "module": "dnsmasq", - "version": "1", + "version": "0.1", + "class": "core", "upgrade": { "policy": "record", "why": "the mesh's resolver: a build that breaks it can stop a machine resolving the bus, and then neither the gate's rollback nor a push reaches it (hq ADR 0236, issue 260)" @@ -9,7 +10,10 @@ { "name": "wildcard-resolution", "scope": "mesh", - "identity": false + "identity": false, + "credential": { + "form": "none" + } } ], "requires": [ @@ -35,6 +39,22 @@ "dnsmasq_names", "dnsmasq_resolve" ], + "config": { + "upstream-resolver-first": { + "type": "string", + "description": "The first public resolver this resolver forwards to for every name that is not the mesh's own, as an IP address. It is placed as a server line beside no-resolv, so it must never be an address that resolves through this machine; both upstreams should validate DNSSEC, since the authenticated-data bit is passed down (ADR 0194, ADR 0223). Set per node or for the whole mesh.", + "trusted": false, + "pattern": "^[0-9A-Fa-f.:]+$", + "default": "1.1.1.1" + }, + "upstream-resolver-second": { + "type": "string", + "description": "The second public resolver this resolver forwards to, as an IP address, tried beside the first so one upstream being down does not stop name resolution. The same rules as upstream-resolver-first.", + "trusted": false, + "pattern": "^[0-9A-Fa-f.:]+$", + "default": "8.8.8.8" + } + }, "listens": [ { "name": "dns-udp", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker-compose/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker-compose/module.json.captured index 2f576b4ba..92caf5835 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker-compose/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker-compose/module.json.captured @@ -1,6 +1,7 @@ { "module": "docker-compose", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/files/daemon.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/files/daemon.json index 83750f4bd..c8fb9c7ee 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/files/daemon.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/files/daemon.json @@ -1 +1 @@ -{"live-restore": true, "insecure-registries": ["${seat:mesh-artifact-store:reach}"], "log-driver": "json-file", "log-opts": {"max-size": "${config:log-max-size}", "max-file": "${config:log-max-file}"}} +{"live-restore": true, "insecure-registries": ["${seat:container-image-registry:reach}"], "log-driver": "json-file", "log-opts": {"max-size": "${config:log-max-size}", "max-file": "${config:log-max-file}"}} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/module.json.captured index a3a75e090..c4be0284b 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/docker/module.json.captured @@ -1,13 +1,14 @@ { "module": "docker", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "package-manager", "service-manager", "privileged" ], "invokes": [ - "seat:mesh-controller.images" + "seat:mesh-artifact-sweep.images" ], "claims": [ { @@ -33,6 +34,7 @@ "docker_disk_usage", "docker_networks", "docker_volumes", + "docker_volumes_remove_anonymous", "docker_events", "docker_daemon_config", "docker_unlabelled", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dunst/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dunst/module.json.captured index 0c6983b4d..7821e3f9d 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dunst/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/dunst/module.json.captured @@ -1,6 +1,7 @@ { "module": "dunst", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fail2ban/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fail2ban/module.json.captured index 446395f2c..1fe831870 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fail2ban/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fail2ban/module.json.captured @@ -1,6 +1,7 @@ { "module": "fail2ban", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "firewall" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/files/fehbg b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/files/fehbg index a3159bbb3..a78c8b9cf 100755 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/files/fehbg +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/files/fehbg @@ -1,6 +1,6 @@ #!/bin/sh -# The wallpaper (module feh, novox/hq ADR 0208). Owned by the mesh: replaced at every push. The +# The wallpaper (module feh, novox/hq ADR 0208). Owned by the mesh: replaced at every delivery. The # session's start runs it, and so may anything that wants the declared wallpaper back. The image is # the module's own, in ~/.local/share/feh/wallpapers. feh_set changes the wallpaper for a session -# without touching this file. +# without touching this file (design 47 H1, proof 1 (second run): delivered by its pipeline, 2026-11-21). feh --no-fehbg --bg-fill "$HOME/.local/share/feh/wallpapers/default.jpg" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/module.json.captured index d6e44073b..49dada45b 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/feh/module.json.captured @@ -1,6 +1,7 @@ { "module": "feh", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/flatpak/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/flatpak/module.json.captured index 76d47213d..da3d6ae04 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/flatpak/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/flatpak/module.json.captured @@ -1,6 +1,7 @@ { "module": "flatpak", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fonts/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fonts/module.json.captured index b2958da8a..14b7463c2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fonts/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/fonts/module.json.captured @@ -1,6 +1,7 @@ { "module": "fonts", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/forticlient/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/forticlient/module.json.captured index 631d3faf7..c849b0fe4 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/forticlient/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/forticlient/module.json.captured @@ -1,6 +1,7 @@ { "module": "forticlient", - "version": "1", + "version": "0.1", + "class": "leaf", "upgrade": { "policy": "record", "why": "its adapter routes the company's domains on the machine a person works on: a build that breaks it cuts the person off from work names until a person pushes the next (hq ADR 0236, ADR 0247)" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/config.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/config.json index 0967ef424..7ee627f89 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/config.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/config.json @@ -1 +1 @@ -{} +{"main-mergers": ["jschoubben"]} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/repositories.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/repositories.json index 36626ccc9..a8293008f 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/repositories.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/repositories.json @@ -1 +1 @@ -{"repositories": ${config:repositories}} +{"repositories": ${config:repositories}, "keep-main-rules": ${config:keep-main-rules}} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/server.env b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/server.env index 8cb88e22e..164b0c40b 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/server.env +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/files/server.env @@ -5,3 +5,8 @@ GITEA__database__NAME=${bound:postgres-database:as} GITEA__database__USER=${bound:postgres-database:as} GITEA__database__PASSWD=${secret:postgres-database} GITEA__webhook__ALLOWED_HOST_LIST=172.17.0.1 +# Issue 1966: cap the forge's own pool; the store's 100 connections are shared by every module on this machine. +# SSH git operations go through the forge's private API, so this pool carries them. +GITEA__database__MAX_OPEN_CONNS=${config:database-max-open-connections} +GITEA__database__MAX_IDLE_CONNS=${config:database-max-idle-connections} +GITEA__database__CONN_MAX_LIFETIME=${config:database-connection-lifetime} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/module.json.captured index 118224cd6..04d479f64 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitea/module.json.captured @@ -1,6 +1,7 @@ { "module": "gitea", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "requires": [ "postgres-database", @@ -41,14 +42,9 @@ "emits": [ "repo.created", "issue.opened", - "pull.merged", - "pull.updated", - "pull.closed", "forge.push", "forge.create", - "forge.delete", "forge.fork", - "forge.status", "forge.pull-request.opened", "forge.pull-request.reopened", "forge.pull-request.synchronized", @@ -85,10 +81,6 @@ "forge.wiki.changed", "forge.other" ], - "consumes": [ - "mesh-controller.checked", - "node-build-agent.started" - ], "listens": [ { "name": "web", @@ -122,24 +114,61 @@ "git": { "scheme": "http", "port": 3000 + }, + "go-package-registry": { + "scheme": "http", + "port": 3000, + "go-path": "/api/packages/novox/go" } }, - "receives": { - "npm-package-registry": "${dir:grants}/npm.json" - }, - "grants": { - "npm-package-registry": "${dir:grants}" - }, "claims": [ { "name": "npm-package-registry", - "scope": "mesh" + "scope": "mesh", + "serves": [ + "publish", + "publish-part", + "remove", + "versions" + ] + }, + { + "name": "go-package-registry", + "scope": "mesh", + "serves": [ + "publish", + "publish-part", + "remove", + "versions" + ] }, { "name": "git", - "scope": "mesh" + "scope": "mesh", + "serves": [ + "pull", + "branch", + "open-pulls", + "tags", + "trees", + "file", + "contains", + "statuses", + "status", + "comment", + "view", + "note", + "merge-pull", + "tag" + ] } ], + "uses": [ + "operator-channel" + ], + "needs-approval": [ + "gitea_branch_protection_loosen" + ], "data": { "own": [ { @@ -148,16 +177,29 @@ "class": "valuable", "why": "every repository, its issues and attachments, and the package registry" } - ], - "consumers": { - "npm-package-registry": { - "class": "rebuildable", - "in": "data", - "why": "a consumer's packages are published again from its source" - } - } + ] }, "config": { + "database-max-open-connections": { + "type": "number", + "description": "The most connections the forge's own database pool holds open to the store. The store's 100 connections are shared by every module on its machine, and the forge's git operations over ssh go through the forge's private API, which this pool carries: 40 leaves room for the others.", + "trusted": false, + "minimum": 1, + "default": 40 + }, + "database-max-idle-connections": { + "type": "number", + "description": "The connections the forge's database pool keeps idle, ready for the next request. They count against the store's 100 connections, shared on its machine, so keep this well under the open-connection cap.", + "trusted": false, + "minimum": 0, + "default": 10 + }, + "database-connection-lifetime": { + "type": "string", + "description": "How long the forge's database pool keeps one connection before it closes and reopens it, as a duration such as 5m. A shorter lifetime gives back connections of the store's 100 connections, shared on its machine, sooner.", + "trusted": false, + "default": "5m" + }, "url": { "type": "string", "description": "The address the module's tools reach the forge at, as a URL; unset, the code falls back to its environment, else this machine's gitea on its port.", @@ -170,11 +212,53 @@ "trusted": true, "default": {} }, + "call-retention": { + "type": "number", + "description": "How many days the forge module keeps a merge call in its state calls (design 47 H §766): a call older than this is deleted when a new call is written, oldest first.", + "trusted": false, + "minimum": 1, + "default": 30 + }, + "keep-main-rules": { + "type": "boolean", + "description": "Whether the module keeps main's branch protection as the mesh wants it. True: when the tools' account's token is minted, main's rule in every repository of the organisation novox is put to no push and the tools' account alone merging, and each apply of the `repositories` value narrows the main rule of the repositories it lists, requiring no status. False (the default): the module changes no existing repository's branch protection, whoever set it at the forge, but takes away a required status it finds on a rule covering main, once (ADR 0534 §1); a repository listed in `repositories` that does not exist is still made, with its first protection.", + "trusted": true, + "default": false + }, "repositories": { "type": "object", - "description": "The repositories of the organisation novox the mesh holds (ADR 0428): each by name, {\"\": {\"private\": true, \"description\": \"...\"}}. One that does not exist is made by the module's setup login under its own account, its main protected and given a first commit (a README naming the description and a merge-check.sh), its rule narrowed to no push and the tools' merge requiring mesh/repo-check and mesh/merge-gate, and only then moved into the organisation; one that exists only has main's rule put right, its statuses kept. A repository taken out of the value is never touched.", + "description": "The repositories of the organisation novox the mesh holds (ADR 0428): each by name, {\"\": {\"private\": true, \"description\": \"...\"}}. One that does not exist is made by the module's setup login under its own account, its main protected and given a first commit (a README naming the description ), its rule narrowed to no push, the tools' account and main-mergers alone merging, and no status required (ADR 0534), and only then moved into the organisation; one that exists only has main's rule put right so. Every other repository has the statuses its main requires taken off; nothing else of a repository out of the value is touched. With keep-main-rules false a listed repository that exists likewise has only its required statuses taken off, once.", "trusted": true, "default": {} + }, + "main-mergers": { + "type": "list", + "description": "The forge logins that may merge into main beside the tools' account, on every repository of the organisation (ADR 0534 §2): the operator's own, so the operator can always merge by hand at the forge. The tools' account is always on main's merge whitelist; no agent's account belongs here.", + "trusted": true, + "default": [ + "jschoubben" + ] + }, + "ask-taken-bound": { + "type": "string", + "description": "How long the forge module keeps the id of an act of the seat git it took, as a duration such as 10m (design 47 H2 §775): an act given again with that id within it acts not again but answers what the forge holds of it. The largest caller's bound, the pipeline runner's ask-unanswered-bound, by default.", + "trusted": false, + "runtime": true, + "default": "10m" + }, + "token-ttl": { + "type": "string", + "description": "How old the forge module's token of an account may grow, as a duration such as 24h (design 47 H2 \u00a7808): a token the vault has kept longer than this, by its changed-at, is minted again, one process at a time, and the one it replaces is deleted at the forge.", + "trusted": false, + "runtime": true, + "default": "24h" + }, + "mint-lease": { + "type": "string", + "description": "How long one process of the forge module may hold the lease to mint a token, as a duration such as 60s (design 47 H2 \u00a7808): the lease key mint in the state token-lease lives this long, so a process that died holding it is replaced after it, and a process that finds it taken waits at most this long.", + "trusted": false, + "runtime": true, + "default": "60s" } }, "facts": { @@ -213,12 +297,6 @@ "place": ".", "unknown": "program" }, - { - "id": "grants", - "type": "directory", - "mode": "0700", - "unknown": "program" - }, { "id": "server-env", "type": "file", @@ -236,6 +314,9 @@ { "id": "server", "type": "container", + "restart-on": [ + "server-env" + ], "health": { "kind": "http", "endpoint": "web", @@ -248,7 +329,8 @@ "env": { "DB_TYPE": "postgres", "USER_UID": "1000", - "USER_GID": "1000" + "USER_GID": "1000", + "SSH_MAX_STARTUPS": "100:30:200" }, "env-file": [ "${dir:state}/server.env" @@ -303,7 +385,10 @@ "template": "files/config.json", "merge": "json", "takes-config": [ - "url" + "url", + "keep-main-rules", + "main-mergers", + "call-retention" ] }, { @@ -366,24 +451,35 @@ "MESH_GITEA_ADMIN_PASSWORD_FILE": "${dir:state}/admin.secret", "MESH_GITEA_TOOLS_USER": "mesh-tools", "MESH_REPOSITORIES_FILE": "${dir:mesh-state}/repositories.json", - "MESH_REPOSITORIES_OUTCOME": "${dir:runtime-state}/repositories-outcome.json" + "MESH_REPOSITORIES_OUTCOME": "${dir:runtime-state}/repositories-outcome.json", + "MESH_GITEA_CONFIG_FILE": "${dir:mesh-state}/config.json" }, "restart-on": [ - "repositories-file" + "repositories-file", + "runtime-config" ] } ], "provides": [ { "name": "npm-package-registry", - "scope": "mesh", - "identity": { - "max": 40, - "in": "a Gitea user name" - } + "credential": { + "form": "none" + }, + "scope": "mesh" + }, + { + "name": "go-package-registry", + "credential": { + "form": "none" + }, + "scope": "mesh" }, { "name": "git", + "credential": { + "form": "none" + }, "scope": "mesh" }, { @@ -396,7 +492,11 @@ }, { "name": "forge-account", - "scope": "mesh" + "credential": { + "form": "none" + }, + "scope": "mesh", + "answered-by": "helper" } ], "build": { @@ -405,15 +505,16 @@ "name": "code", "kind": "bundle", "language": "typescript", + "needs": [ + "mesh-delivery-assigner:program" + ], "entrypoints": [ "index.js", - "tools/index.js", - "provisioner/index.js" + "tools/index.js" ], "loads": [ "index.js", - "tools/index.js", - "provisioner/index.js" + "tools/index.js" ], "env": { "MESH_GITEA_URL": "http://127.0.0.1:${port:3000}", @@ -422,26 +523,25 @@ "MESH_GITEA_ADMIN_PASSWORD_FILE": "${dir:state}/admin.secret", "MESH_GITEA_TOOLS_USER": "mesh-tools", "MESH_GITEA_STATE_DIR": "${dir:runtime-state}", - "MESH_RECEIVES": "${dir:grants}/npm.json", "MESH_GITEA_HOOK_URL": "http://172.17.0.1:3047", "MESH_GITEA_HOOK_PORT": "3047", "MESH_GITEA_HOOK_HOST": "172.17.0.1" } }, { - "name": "npm-registry", + "name": "package-registry", "kind": "bundle", "language": "go", "system": "arch", - "from": "cmd/npm-registry", - "binary": "npm-registry", + "from": "cmd/package-registry", + "binary": "package-registry", "loads": [ - "npm-registry" + "package-registry" ], "env": { "MESH_GITEA_URL": "http://127.0.0.1:${port:3000}", - "MESH_GITEA_ADMIN_USER": "mesh-admin", - "MESH_GITEA_ADMIN_PASSWORD_FILE": "${dir:state}/admin.secret", + "MESH_GITEA_TOOLS_USER": "mesh-tools", + "MESH_GITEA_PACKAGES_USER": "mesh-packages", "MESH_NPM_OWNER": "novox" } }, @@ -458,7 +558,6 @@ "env": { "MESH_GITEA_URL": "http://127.0.0.1:${port:3000}", "MESH_GITEA_TOOLS_USER": "mesh-tools", - "MESH_GITEA_TOKEN_FILE": "${dir:runtime-state}/token", "MESH_GITEA_PATCH_DIR": "${dir:forge-patches}" } }, @@ -522,6 +621,7 @@ "MESH_GITEA_ADMIN_PASSWORD_FILE": "${dir:state}/admin.secret", "MESH_GITEA_ORIGINS_FILE": "${dir:mesh-state}/origins", "MESH_GITEA_SSH_PORT": "222", + "MESH_GITEA_HOST_KEY_FILE": "${dir:data}/ssh/ssh_host_ed25519_key.pub", "MESH_FORGE_HOST_FILE": "/etc/gitea/forge-host" } } @@ -535,13 +635,96 @@ } ], "state": [ - "bound", - "announced" + { + "name": "bound", + "max-mib": 8 + }, + { + "name": "announced", + "max-mib": 8 + }, + { + "name": "findings", + "max-mib": 8 + }, + { + "name": "first-views", + "history": 1, + "max-mib": 8 + }, + { + "name": "transfers", + "max-mib": 8 + }, + { + "name": "idle", + "key-ttl": true, + "max-mib": 8 + }, + { + "name": "failed-steps", + "history": 1, + "max-mib": 8 + }, + { + "name": "calls", + "history": 1, + "max-mib": 8 + }, + { + "name": "taken", + "key-ttl": true, + "max-mib": 8 + }, + { + "name": "token-lease", + "key-ttl": true, + "max-mib": 1 + } ], "reads": [ - "mesh-controller.assignments", + "mesh-provisioner.plans", + "mesh-provisioner.provisions", "ssh-client.keys", "mesh-build-go.keys", - "mesh-build-node.keys" + "mesh-build-node.keys", + "mesh-build-image.keys" + ], + "invokes": [ + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-builds.reserved", + "seat:mesh-vault.own-put", + "seat:mesh-vault.get" + ], + "consumes": [ + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-pipeline-runner.step-ended.*.*.*", + "git.branch-moved", + "git.pull-updated", + "git.pull-closed", + "git.pull-merged", + "mesh-conditions.findings-asked", + "mesh-vault.secret-changed" + ], + "streams": [ + { + "name": "gitea-findings", + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + ], + "objects": [ + { + "name": "incoming", + "max-mib": 2048 + } ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitlab/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitlab/module.json.captured index 3cb33fb27..7bded31ca 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitlab/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gitlab/module.json.captured @@ -1,6 +1,7 @@ { "module": "gitlab", - "version": "1", + "version": "0.1", + "class": "leaf", "own-secrets": { "token": "${dir:state}/token" }, diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gnome-keyring/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gnome-keyring/module.json.captured index 9f75b9ff4..a7b663deb 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gnome-keyring/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/gnome-keyring/module.json.captured @@ -1,6 +1,7 @@ { "module": "gnome-keyring", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/go/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/go/module.json.captured index 48a6bf57e..10cb723e5 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/go/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/go/module.json.captured @@ -1,13 +1,17 @@ { "module": "go", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], "provides": [ { "name": "go-toolchain", - "reach": "machine" + "reach": "machine", + "credential": { + "form": "none" + } } ], "resources": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/grafana/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/grafana/module.json.captured index 1cbf995fd..8acd7b622 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/grafana/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/grafana/module.json.captured @@ -1,6 +1,7 @@ { "module": "grafana", - "version": "1", + "version": "0.1", + "class": "leaf", "emits": [ "alert.firing" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hello-web/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hello-web/module.json.captured index 005578cd5..d6cf28b03 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hello-web/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hello-web/module.json.captured @@ -1,7 +1,8 @@ { "module": "hello-web", "slug": "hello", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/home-assistant/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/home-assistant/module.json.captured index 9c4f99db9..fad6eec97 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/home-assistant/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/home-assistant/module.json.captured @@ -1,6 +1,7 @@ { "module": "home-assistant", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "hass", "capabilities": [ "container-runtime" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hostname/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hostname/module.json.captured index e84e7be25..dc9a84014 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hostname/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/hostname/module.json.captured @@ -1,6 +1,7 @@ { "module": "hostname", - "version": "1", + "version": "0.1", + "class": "core", "claims": [ { "name": "node-hostname", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3/module.json.captured index 1ec924268..315b77deb 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3/module.json.captured @@ -1,6 +1,7 @@ { "module": "i3", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3status-rust/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3status-rust/module.json.captured index 1e07556b1..4e85779f9 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3status-rust/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/i3status-rust/module.json.captured @@ -1,6 +1,7 @@ { "module": "i3status-rust", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/icecast/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/icecast/module.json.captured index 6f9ab549e..ca6de7876 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/icecast/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/icecast/module.json.captured @@ -1,6 +1,7 @@ { "module": "icecast", - "version": "1", + "version": "0.1", + "class": "leaf", "requires": [ "route", "secret" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/influxdb/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/influxdb/module.json.captured index 53389a5f5..80d2f225a 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/influxdb/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/influxdb/module.json.captured @@ -1,12 +1,16 @@ { "module": "influxdb", - "version": "1", + "version": "0.1", + "class": "leaf", "provides": [ { "name": "influxdb-api", "scope": "mesh", "identity": { "in": "an InfluxDB v1 authorization" + }, + "credential": { + "form": "pair" } } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/invoicing/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/invoicing/module.json.captured index 29670a3e6..f56e75359 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/invoicing/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/invoicing/module.json.captured @@ -1,6 +1,7 @@ { "module": "invoicing", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "invoice", "capabilities": [ "container-runtime" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/jira/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/jira/module.json.captured index 9f98dd835..3d48f9f63 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/jira/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/jira/module.json.captured @@ -1,6 +1,7 @@ { "module": "jira", - "version": "1", + "version": "0.1", + "class": "leaf", "own-secrets": { "token": "${dir:state}/token" }, diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/90-mesh-kernel-boot-entries.hook b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/90-mesh-kernel-boot-entries.hook new file mode 100644 index 000000000..d671caaf1 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/90-mesh-kernel-boot-entries.hook @@ -0,0 +1,13 @@ +# Module kernel, novox/hq ADR 0508 §9, issue 1841. After a kernel image is installed, upgraded or removed, the +# fallback kernel's boot entry (or the GRUB menu) is placed again. Written by the mesh; change the module. +[Trigger] +Operation = Install +Operation = Upgrade +Operation = Remove +Type = Path +Target = usr/lib/modules/*/vmlinuz + +[Action] +Description = Placing the fallback kernel on the boot menu +When = PostTransaction +Exec = ${dir:state}/boot-entries run diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/boot-entries.sh b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/boot-entries.sh new file mode 100644 index 000000000..ed174906b --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/boot-entries.sh @@ -0,0 +1,133 @@ +#!/bin/sh +# The fallback kernel's place on this machine's boot menu (module kernel, novox/hq ADR 0508 §9 and §10, +# issue 1841). Written by the mesh and run as root by mesh-kernel-boot-entries.service at boot and when the +# module is applied, and by the pacman hook 90-mesh-kernel-boot-entries.hook after a kernel is installed, +# upgraded or removed. Replaced on every push; change the module, never this file. +# +# boot-entries run [ [ []]] +# +# The three are arguments only so the module's tests can run this against a stand-in tree. +# +# It reads from the machine which loader booted it, never from a setting: +# systemd-boot the EFI variable LoaderEntrySelected is present: the entry mesh-linux-lts.conf is written +# from the command line the machine booted with. +# GRUB /boot/grub/grub.cfg exists and that variable does not: the menu is generated again, only +# when the set of kernels in /boot differs from the menu's. +# neither it fails loudly. The default entry is never touched. +# And a pacman hook of someone else's that copies kernel images to one fixed name in /boot is moved into this +# module's state first (ADR 0508 §10): it would put the fallback kernel in the default kernel's place. +set -eu + +root=/ +state='${dir:state}' +[ $# -ge 2 ] && root=$(printf '%s' "$2" | sed 's|/$||') +[ $# -ge 3 ] && state=$3 +boot=$root/boot +hooks=$root/etc/pacman.d/hooks +efivar=$root/sys/firmware/efi/efivars/LoaderEntrySelected-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f +ours=90-mesh-kernel-boot-entries.hook +# The fallback kernel and its initramfs are about 72 MB in /boot (issue 1836): less room fails the unit +# before a package writes half of them. +need_kib=98304 +[ $# -ge 4 ] && need_kib=$4 + +[ $# -ge 1 ] && [ "$1" = run ] || { + echo "usage: boot-entries run [ [ []]]" >&2 + exit 2 +} + +# A hook that is not ours, triggered by kernel images, whose action copies to one fixed name in /boot. +copies_kernels() { + grep -Eqi '^[[:space:]]*Target[[:space:]]*=.*(vmlinuz|usr/lib/modules)' "$1" && + grep -Eq '^[[:space:]]*Exec[[:space:]]*=.*(cp|install|ln|rsync)[[:space:]].*/boot/[A-Za-z0-9._+-]+([^A-Za-z0-9._+/%$*-]|$)' "$1" +} + +if [ -d "$hooks" ]; then + for hook in "$hooks"/*.hook; do + [ -f "$hook" ] || continue + [ "$(basename "$hook")" = "$ours" ] && continue + copies_kernels "$hook" || continue + mkdir -p "$state/taken-over" + mv -f "$hook" "$state/taken-over/$(basename "$hook")" + echo "taken over: the pacman hook $(basename "$hook") copied kernel images to one fixed name in /boot; moved to $state/taken-over/ so each kernel keeps its own package's name" + done +fi + +if [ -e "$efivar" ]; then + loader=systemd-boot +elif [ -f "$boot/grub/grub.cfg" ]; then + loader=grub +else + echo "no boot loader found: the machine was not booted by systemd-boot (no LoaderEntrySelected variable) and there is no $boot/grub/grub.cfg; the fallback kernel has no menu to be placed on" >&2 + exit 1 +fi + +# Room first, only while the fallback kernel is not in /boot yet. +if [ ! -e "$boot/vmlinuz-linux-lts" ]; then + free=$(df -Pk "$boot" | awk 'NR==2 {print $4}') + [ -n "$free" ] || free=0 + if [ "$free" -lt "$need_kib" ]; then + echo "$boot has $free KiB free and the fallback kernel needs $need_kib KiB: free room there before the kernel is installed" >&2 + exit 1 + fi +fi + +case "$loader" in +systemd-boot) + entries=$boot/loader/entries + cmdline=$(sed -e 's/BOOT_IMAGE=[^ ]*//g' -e 's/initrd=[^ ]*//g' "$root/proc/cmdline" | tr -s ' \n' ' ' | sed -e 's/^ //' -e 's/ $//') + [ -n "$cmdline" ] || { + echo "$root/proc/cmdline holds no command line to boot the fallback kernel with" >&2 + exit 1 + } + want=$( + echo "title Arch Linux (linux-lts, fallback)" + echo "linux /vmlinuz-linux-lts" + for ucode in intel-ucode.img amd-ucode.img; do + [ -e "$boot/$ucode" ] && echo "initrd /$ucode" + done + echo "initrd /initramfs-linux-lts.img" + echo "options $cmdline" + ) + mkdir -p "$entries" + if [ "$(cat "$entries/mesh-linux-lts.conf" 2>/dev/null || true)" = "$want" ]; then + echo "systemd-boot: mesh-linux-lts.conf, as it was" + else + printf '%s\n' "$want" >"$entries/mesh-linux-lts.conf" + echo "systemd-boot: wrote $entries/mesh-linux-lts.conf from the command line the machine booted with; the default entry is as it was" + fi + ;; +grub) + cfg=$boot/grub/grub.cfg + menu=$(sed -n 's|^[[:space:]]*linux[[:space:]]*\(/boot\)\{0,1\}/\(vmlinuz-[^[:space:]]*\).*|\2|p' "$cfg" | sort -u) + have=$(cd "$boot" && ls -d vmlinuz-* 2>/dev/null | sort -u || true) + if [ "$menu" = "$have" ]; then + echo "grub: the menu lists the kernels in /boot, left as it is" + else + # GRUB lists kernels in reverse version order, so the fallback kernel would come first and become the + # default entry: the kernel the machine booted is put first (GRUB_TOP_LEVEL; /etc/default/grub still + # overrides it when it sets one), the fallback kernel never. + top=$(tr ' ' '\n' <"$root/proc/cmdline" | sed -n 's|^BOOT_IMAGE=\(.*\)$|\1|p' | head -n 1) + top=$(printf '%s' "$top" | sed 's|.*/||') + case "$top" in + vmlinuz-linux-lts | "") top= ;; + esac + [ -n "$top" ] && [ -e "$boot/$top" ] || top= + if [ -z "$top" ]; then + if [ -e "$boot/vmlinuz-linux" ]; then + top=vmlinuz-linux + else + top=$(printf '%s\n' $have | grep -v '^vmlinuz-linux-lts$' | head -n 1 || true) + fi + fi + if [ -n "$top" ]; then + GRUB_TOP_LEVEL=/boot/$top grub-mkconfig -o "$cfg" + else + grub-mkconfig -o "$cfg" + fi + first=$top + [ -n "$first" ] || first="the menu's own order" + echo "grub: the kernels in /boot changed ($(echo $have | tr '\n' ' ')); the menu is generated again with $first first; the default entry is as it was" + fi + ;; +esac diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/initramfs.sh b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/initramfs.sh new file mode 100644 index 000000000..d7d82c185 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/initramfs.sh @@ -0,0 +1,71 @@ +#!/bin/sh +# The initramfs images as the mesh builds them (module kernel, novox/hq issue 1977). Run by +# mesh-kernel-initramfs.service: +# +# initramfs apply [ [ [ []]]] +# +# `apply` builds every image again (mkinitcpio -P) when the drop-in differs from the one the images were last built +# with, kept in the state as `initramfs-built`, and records the drop-in only after mkinitcpio succeeded. Later +# kernel upgrades build the images through the distribution's own hook, with the drop-in in place. +# +# A preset that names the default configuration (ALL_config="/etc/mkinitcpio.conf") makes mkinitcpio pass -c and skip +# mkinitcpio.conf.d, so the drop-in is never read: before building, that line is taken out of the preset, a copy of +# the preset kept in the state's taken-over directory (novox/hq ADR 0508 §10's way with a file the mesh did not +# write); any other ALL_config is left and named. After building, every image must hold microcode in its first +# 64 KiB (the early uncompressed archive), else the unit fails and records nothing. The arguments are only for the +# module's tests. +set -eu + +dropin=/etc/mkinitcpio.conf.d/mesh-microcode.conf +state='${dir:state}' +[ $# -ge 2 ] && dropin=$2 +[ $# -ge 3 ] && state=$3 +presets=/etc/mkinitcpio.d +boot=/boot +[ $# -ge 4 ] && presets=$4 +[ $# -ge 5 ] && boot=$5 + +[ $# -ge 1 ] && [ "$1" = apply ] || { + echo "usage: initramfs apply [ []]" >&2 + exit 2 +} +[ -f "$dropin" ] || { + echo "initramfs: $dropin is not there, so the images cannot be built with the microcode hook" >&2 + exit 1 +} +if [ -f "$state/initramfs-built" ] && cmp -s "$dropin" "$state/initramfs-built"; then + echo "initramfs: the images were built with this drop-in, as it was" + exit 0 +fi +for preset in "$presets"/*.preset; do + [ -f "$preset" ] || continue + if grep -qx 'ALL_config="/etc/mkinitcpio.conf"' "$preset"; then + mkdir -p "$state/taken-over" + cp "$preset" "$state/taken-over/$(basename "$preset")" + grep -vx 'ALL_config="/etc/mkinitcpio.conf"' "$preset" >"$preset.new" || true + cat "$preset.new" >"$preset" + rm -f "$preset.new" + echo "initramfs: $preset named the default configuration, which skips mkinitcpio.conf.d; that line is taken out, a copy is in $state/taken-over" + elif grep -q '^ALL_config=' "$preset"; then + echo "initramfs: $preset sets $(grep '^ALL_config=' "$preset" | head -n 1), so the microcode drop-in may not be read; left as it is" + fi +done +if ! mkinitcpio -P; then + echo "initramfs: mkinitcpio failed; nothing recorded, the next start tries again" >&2 + exit 1 +fi +missing= +for img in "$boot"/initramfs-*.img; do + [ -e "$img" ] || continue + if ! head -c 65536 "$img" >"$state/image-head.tmp" || ! grep -aq 'kernel/x86/microcode/' "$state/image-head.tmp"; then + missing="$missing $(basename "$img")" + fi +done +rm -f "$state/image-head.tmp" +if [ -n "$missing" ]; then + echo "initramfs: mkinitcpio ran, but no microcode is in the early archive of:$missing; nothing recorded" >&2 + exit 1 +fi +cp "$dropin" "$state/initramfs-built.new" +mv "$state/initramfs-built.new" "$state/initramfs-built" +echo "initramfs: the images are built with the microcode drop-in" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-kernel-boot-entries.service b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-kernel-boot-entries.service new file mode 100644 index 000000000..56cfa3194 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-kernel-boot-entries.service @@ -0,0 +1,22 @@ +[Unit] +Description=The fallback kernel's place on this machine's boot menu +# Module kernel, novox/hq ADR 0508 §9, issue 1841. Starting this unit reads which loader booted the machine and +# places the fallback kernel's boot entry (systemd-boot) or generates the menu again (GRUB); it fails, and says +# why, when there is no loader or the boot partition has no room. The kernel packages are declared after this +# unit, so the entry is in place before they are installed. +After=local-fs.target +Wants=local-fs.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=${dir:state}/boot-entries run +# It writes the boot partition, the pacman hook directory and its own state, and nothing else. +ProtectSystem=strict +ReadWritePaths=/boot ${dir:state} /etc/pacman.d/hooks +ProtectHome=yes +PrivateNetwork=yes +NoNewPrivileges=yes + +[Install] +WantedBy=multi-user.target diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-kernel-initramfs.service b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-kernel-initramfs.service new file mode 100644 index 000000000..c1a2515c3 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-kernel-initramfs.service @@ -0,0 +1,22 @@ +[Unit] +Description=The initramfs images with the CPU's current microcode +# Module kernel, novox/hq issue 1977. Starting this unit builds the images again when the microcode drop-in +# changed since they were last built; a failed mkinitcpio fails the unit. The microcode packages are declared +# before this unit. +After=local-fs.target +Wants=local-fs.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=${dir:state}/initramfs apply +# It writes the boot partition, the presets and its own state; mkinitcpio keeps its work in a private /tmp. +ProtectSystem=strict +ReadWritePaths=/boot /etc/mkinitcpio.d ${dir:state} +PrivateTmp=yes +ProtectHome=yes +PrivateNetwork=yes +NoNewPrivileges=yes + +[Install] +WantedBy=multi-user.target diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-microcode.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-microcode.conf new file mode 100644 index 000000000..a718205b7 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/mesh-microcode.conf @@ -0,0 +1,8 @@ +# Module kernel, novox/hq issue 1977. mkinitcpio reads this after /etc/mkinitcpio.conf: it adds the microcode +# hook, which puts the CPU's current microcode (amd-ucode) at the front of every initramfs, so +# every boot entry loads it, the default one too. HOOKS that name it already are left as they are. +# Written by the mesh; change the module. +case "$(declare -p HOOKS)" in +*'"microcode"'*) ;; +*) HOOKS+=(microcode) ;; +esac diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/modules-load.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/modules-load.conf new file mode 100644 index 000000000..eccad6ce8 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/files/modules-load.conf @@ -0,0 +1,4 @@ +# Written by the mesh's kernel module (systemd-modules-load reads it at boot). +# tun: buildah's network for a RUN line (pasta) and every other user-space tunnel open /dev/net/tun. +# Loaded at boot, so an upgrade that removes the running kernel's modules cannot keep it out later. +tun diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/module.json.captured index 67d321564..97a21caed 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/kernel/module.json.captured @@ -1,6 +1,7 @@ { "module": "kernel", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "service-manager" ], @@ -13,7 +14,8 @@ } }, "tools": [ - "kernel_huge_pages" + "kernel_huge_pages", + "kernel_boot" ], "resources": [ { @@ -53,6 +55,113 @@ "health": { "kind": "unit" } + }, + { + "id": "boot-entries", + "type": "file", + "path": "${dir:state}/boot-entries", + "mode": "0755", + "trusted": true, + "template": "files/boot-entries.sh" + }, + { + "id": "boot-unit", + "type": "file", + "path": "/etc/systemd/system/mesh-kernel-boot-entries.service", + "mode": "0644", + "template": "files/mesh-kernel-boot-entries.service" + }, + { + "id": "boot-hook", + "type": "file", + "path": "/etc/pacman.d/hooks/90-mesh-kernel-boot-entries.hook", + "mode": "0644", + "template": "files/90-mesh-kernel-boot-entries.hook" + }, + { + "id": "boot-apply", + "type": "service", + "unit": "mesh-kernel-boot-entries.service", + "state": "running", + "boot": "enabled", + "restart-on": [ + "boot-unit", + "boot-entries" + ], + "health": { + "kind": "unit" + } + }, + { + "id": "linux-lts", + "type": "package", + "package": "linux-lts" + }, + { + "id": "linux-lts-headers", + "type": "package", + "package": "linux-lts-headers" + }, + { + "id": "modules-load", + "type": "file", + "path": "/etc/modules-load.d/mesh-kernel.conf", + "mode": "0644", + "template": "files/modules-load.conf" + }, + { + "id": "modules-keep", + "type": "package", + "package": "kernel-modules-hook" + }, + { + "id": "modules-cleanup", + "type": "service", + "unit": "linux-modules-cleanup.service", + "state": "stopped", + "boot": "enabled" + }, + { + "id": "amd-ucode", + "type": "package", + "package": "amd-ucode" + }, + { + "id": "microcode-hook", + "type": "file", + "path": "/etc/mkinitcpio.conf.d/mesh-microcode.conf", + "mode": "0644", + "template": "files/mesh-microcode.conf" + }, + { + "id": "initramfs", + "type": "file", + "path": "${dir:state}/initramfs", + "mode": "0755", + "trusted": true, + "template": "files/initramfs.sh" + }, + { + "id": "initramfs-unit", + "type": "file", + "path": "/etc/systemd/system/mesh-kernel-initramfs.service", + "mode": "0644", + "template": "files/mesh-kernel-initramfs.service" + }, + { + "id": "initramfs-apply", + "type": "service", + "unit": "mesh-kernel-initramfs.service", + "state": "running", + "boot": "enabled", + "restart-on": [ + "initramfs-unit", + "initramfs", + "microcode-hook" + ], + "health": { + "kind": "unit" + } } ], "build": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/keycloak/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/keycloak/module.json.captured index 847d5f4f2..cfad61b60 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/keycloak/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/keycloak/module.json.captured @@ -1,6 +1,7 @@ { "module": "keycloak", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "upgrade": { "policy": "record", @@ -9,6 +10,7 @@ "provides": [ { "name": "oidc-client", + "credential": {"form": "pair"}, "scope": "mesh", "identity": { "max": 255, @@ -240,6 +242,7 @@ "bound" ], "reads": [ - "mesh-controller.assignments" + "mesh-provisioner.plans", + "mesh-provisioner.provisions" ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.gitconfig b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.gitconfig new file mode 100644 index 000000000..d61dc5377 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.gitconfig @@ -0,0 +1,5 @@ +[url "ssh://${bound:forge-account:ssh_alias}/"] + insteadOf = ${bound:forge-account:https_base} + insteadOf = ${config:forge}/ +[core] + sshCommand = ssh -F ${dir:state}/forge.ssh diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.known_hosts b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.known_hosts new file mode 100644 index 000000000..e0df6d811 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.known_hosts @@ -0,0 +1 @@ +${bound:forge-account:ssh_alias} ${bound:forge-account:host_key} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.ssh b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.ssh new file mode 100644 index 000000000..8723cbf2e --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/forge.ssh @@ -0,0 +1,10 @@ +Host ${bound:forge-account:ssh_alias} + HostName ${bound:forge-account:ssh_host} + Port ${bound:forge-account:ssh_port} + HostKeyAlias ${bound:forge-account:ssh_alias} + User git + IdentityFile ~/.ssh/mesh_ed25519 + IdentitiesOnly yes + UserKnownHostsFile ${dir:state}/forge.known_hosts + StrictHostKeyChecking yes + BatchMode yes diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/lab.env b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/lab.env index 35aa1a293..6b0a8e771 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/lab.env +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/files/lab.env @@ -1,3 +1,3 @@ MESH_LAB_FORGE=${config:forge} MESH_LAB_FORGE_BINDING=${dir:state}/package-registry.json -MESH_LAB_FORGE_SECRET=${dir:state}/package-registry.secret +MESH_LAB_FORGE_GIT=${dir:state}/forge.gitconfig diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/module.json.captured index ef82b87c4..0d2f574e2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lab/module.json.captured @@ -1,26 +1,21 @@ { "module": "lab", - "version": "1", + "version": "0.1", + "class": "leaf", + "moved": true, "capabilities": [ "container-runtime", "virtualisation" ], "requires": [ "npm-package-registry", + "forge-account", "go-toolchain", "node-toolchain" ], - "contributes": { - "npm-package-registry": { - "access": "read" - } - }, "binds": { "npm-package-registry": "${dir:state}/package-registry.json" }, - "secrets": { - "npm-package-registry": "${dir:state}/package-registry.secret" - }, "data": { "own": [ { @@ -61,11 +56,37 @@ "mode": "0600", "template": "files/lab.env" }, + { + "id": "forge-git", + "type": "file", + "path": "${dir:state}/forge.gitconfig", + "mode": "0600", + "template": "files/forge.gitconfig" + }, + { + "id": "forge-ssh", + "type": "file", + "path": "${dir:state}/forge.ssh", + "mode": "0600", + "template": "files/forge.ssh" + }, + { + "id": "forge-known-hosts", + "type": "file", + "path": "${dir:state}/forge.known_hosts", + "mode": "0644", + "template": "files/forge.known_hosts" + }, { "id": "git", "type": "package", "package": "git" }, + { + "id": "openssh", + "type": "package", + "package": "openssh" + }, { "id": "make", "type": "package", @@ -108,7 +129,7 @@ "MESH_LAB_WORK": "${dir:work}", "MESH_LAB_ENV_FILE": "${dir:state}/lab.env", "MESH_LAB_FORGE_BINDING": "${dir:state}/package-registry.json", - "MESH_LAB_FORGE_SECRET": "${dir:state}/package-registry.secret" + "MESH_LAB_FORGE_GIT": "${dir:state}/forge.gitconfig" } }, { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lemurs/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lemurs/module.json.captured index 702a9596b..8c143702d 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lemurs/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/lemurs/module.json.captured @@ -1,6 +1,7 @@ { "module": "lemurs", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "package-manager", "service-manager", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/letta/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/letta/module.json.captured index de7baf643..fffb0e5ce 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/letta/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/letta/module.json.captured @@ -1,6 +1,7 @@ { "module": "letta", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/local-model-consumer/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/local-model-consumer/module.json.captured index 730020920..cb35bdcad 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/local-model-consumer/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/local-model-consumer/module.json.captured @@ -1,6 +1,7 @@ { "module": "local-model-consumer", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "local", "requires": [ "model-access" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/localization/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/localization/module.json.captured index 0974ed382..dad52ffbf 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/localization/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/localization/module.json.captured @@ -1,6 +1,7 @@ { "module": "localization", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "service-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/logrotate/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/logrotate/module.json.captured index 8318451b7..4ec39c136 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/logrotate/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/logrotate/module.json.captured @@ -1,6 +1,7 @@ { "module": "logrotate", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mailu/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mailu/module.json.captured index 568be1459..f88907ddd 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mailu/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mailu/module.json.captured @@ -1,6 +1,7 @@ { "module": "mailu", - "version": "1", + "version": "0.1", + "class": "leaf", "upgrade": { "policy": "record", "why": "people's mail: any change to how its containers are declared recreates them together in one send, and the mail is down for everyone until they are up again — a person chooses the moment (hq ADR 0242, issue 295)" @@ -215,12 +216,6 @@ "class": "rebuildable", "why": "certificates, issued again" }, - { - "id": "automx", - "path": "${dir:data-automx}", - "class": "rebuildable", - "why": "client autoconfiguration, written again" - }, { "id": "fetchmail", "path": "${dir:data-fetchmail}", @@ -307,12 +302,6 @@ "mode": "0700", "unknown": "program" }, - { - "id": "data-automx", - "type": "directory", - "mode": "0700", - "unknown": "program" - }, { "id": "config-env", "type": "file", @@ -677,14 +666,35 @@ "path": "${dir:mesh-state}/config.json", "mode": "0600", "template": "files/config.json", - "takes-config": ["domain", "proxy-address", "sitename", "website", "url", "container"], + "takes-config": [ + "domain", + "proxy-address", + "sitename", + "website", + "url", + "container" + ], "merge": "json" }, + { + "id": "program-automx", + "type": "archive", + "path": "${dir:state}/automx", + "artifact": "automx", + "unknown": "program" + }, { "id": "automx", "type": "container", "name": "mailu-automx", - "artifact": "automx", + "artifact": "alpine", + "health": { + "kind": "http", + "endpoint": "autoconfig", + "path": "/", + "status": 200, + "body": "Show Thunderbird-style" + }, "network": "mailu", "env-file": [ "${dir:state}/mailu.env" @@ -693,17 +703,18 @@ "4243" ], "volumes": [ - "${dir:data-automx}:/data" + "${dir:state}/automx:/opt/mesh:ro" + ], + "args": [ + "/opt/mesh/automx" + ], + "restart-on": [ + "program-automx", + "config-env" ] } ], "build": { - "on": [ - { - "arg": "PYTHON_BASE", - "image": "python@sha256:25f3cfeaceca14921366af4d1240b56457ef46273bdb508c7b0e8f469f6fd228" - } - ], "artifacts": [ { "name": "code", @@ -730,8 +741,16 @@ }, { "name": "automx", - "kind": "image", - "from": "automx/Dockerfile" + "kind": "bundle", + "language": "go", + "system": "alpine", + "from": "cmd/automx", + "binary": "automx" + }, + { + "name": "alpine", + "kind": "upstream", + "from": "alpine@sha256:28bd5fe8b56d1bd048e5babf5b10710ebe0bae67db86916198a6eec434943f8b" }, { "name": "files", @@ -747,6 +766,9 @@ "identity": { "max": 64, "in": "a mailbox's local part" + }, + "credential": { + "form": "pair" } } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/marrytts/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/marrytts/module.json.captured index ed242aa32..916c106f2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/marrytts/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/marrytts/module.json.captured @@ -1,6 +1,7 @@ { "module": "marrytts", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/matrix/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/matrix/module.json.captured index 170719ccd..38ff40b06 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/matrix/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/matrix/module.json.captured @@ -1,6 +1,7 @@ { "module": "matrix", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/memory-pressure/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/memory-pressure/module.json.captured index 1af96e30a..c4fc5ffec 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/memory-pressure/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/memory-pressure/module.json.captured @@ -1,6 +1,7 @@ { "module": "memory-pressure", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/files/settings.json new file mode 100644 index 000000000..3b65dd1cb --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/files/settings.json @@ -0,0 +1,5 @@ +{ + "capacity": 0, + "cores-per-step": 6, + "build-hours": "" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/module.json.captured index 9f0fd7fd0..2de4a290b 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-go/module.json.captured @@ -1,38 +1,197 @@ { "module": "mesh-build-go", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds": "0.1", + "git.novox.be/novox/mesh-catalog/modules/ssh-client/sshkeys": "0.1" + }, "moved": true, "runs-as": "mesh-build-go", "capabilities": [ "package-manager", + "seat-settle-delay", "user-namespaces" ], "state": [ - "toolchains", - "keys", - "steps" + { + "name": "toolchains", + "max-mib": 8 + }, + { + "name": "keys", + "max-mib": 8 + }, + { + "name": "pauses", + "max-mib": 8 + } ], + "claims": [ + { + "name": "node-build-go", + "scope": "node", + "serves": [ + "current", + "drop", + "pause", + "resume", + "steps", + "kept-artifact", + "output", + "answer" + ] + } + ], + "consumes": [ + "mesh-conditions.findings-asked", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed" + ], + "invokes": [ + "seat:mesh-hand-acts.hand-act", + "seat:oci-artifact-registry.publish", + "seat:oci-artifact-registry.publish-part", + "seat:go-package-registry.publish", + "seat:go-package-registry.publish-part", + "seat:mesh-catalog.input", + "seat:mesh-wants.input", + "seat:mesh-catalog.module", + "seat:mesh-catalog.seat-definitions", + "seat:mesh-catalog.entry" + ], + "config": { + "capacity": { + "type": "number", + "description": "How many asks of the Go build seat this module runs at once on this node (novox/hq ADR 0525 §5); 0 pulls nothing. It is set per node in the mesh's configuration; a node with no value builds nothing.", + "minimum": 0, + "default": 0 + }, + "build-hours": { + "type": "string", + "description": "When this node may take this module's build asks: one window HH:MM-HH:MM in the node's local time (an end before its start crosses midnight, 18:00-06:00). Outside it the node takes no new step and finishes the ones it runs; an empty value builds at any hour. It is set per node in the mesh's configuration.", + "pattern": "|([01][0-9]|2[0-3]):[0-5][0-9]-([01][0-9]|2[0-3]):[0-5][0-9]", + "default": "" + }, + "cores-per-step": { + "type": "number", + "description": "How many processors one Go step of this module needs (a full check of a large repository takes what it is given: three at about 4 cores each ran past the 30-minute step bound on 2026-10-26). The capacity above is an upper bound: on each node the module runs at most floor(the cores of its build slice's CPU quota / this) steps at once, the quota read live from its cgroup (issue 1806), so a lowered build CPU share never starves its steps. Above 0.", + "minimum": 0.1, + "default": 6 + }, + "again-delays": { + "type": "string", + "description": "The delays a step ask whose fetch or publish met its holder away is given again after: after its first run, then after its second, as durations such as 15s,60s (design 47 H2 §799); a third run met so ends the step failed with why fetch: or publish:.", + "trusted": false, + "runtime": true, + "default": "15s,60s" + }, + "prune-mark": { + "type": "number", + "description": "The fill of mesh-build-go's state detected-steps, in percent of its cap, past which the module prunes it at its own write, oldest first (design 47 H2 §812): below the bus module's raise mark of 75 %.", + "trusted": false, + "runtime": true, + "minimum": 1, + "maximum": 100, + "default": 70 + }, + "prune-target": { + "type": "number", + "description": "The fill, in percent of the cap, a prune of mesh-build-go's state detected-steps takes it down to (design 47 H2 §812); below prune-mark.", + "trusted": false, + "runtime": true, + "minimum": 1, + "maximum": 100, + "default": 50 + } + }, "tools": [ "build_go_fetch", "build_go_test", "build_go_digest", "build_go_build", + "build_go_imports", + "build_go_release", + "build_go_kept", + "build_go_kept_drop", "build_go_step", "build_go_steps", + "build_go_step_end", "build_go_toolchains", "build_go_status", - "build_go_health" - ], - "streams": [ - { - "name": "toolchains-go", - "events": ["toolchain.**"] - } + "build_go_health", + "mesh-build-go_state_keep", + "mesh-build-go_state_prune_now" ], "requires": [ + { + "name": "steps", + "storage": "key-value", + "template": "state", + "options": { + "ttl-seconds": 172800, + "objects-max-mib": 256, + "max-mib": 128 + } + }, + { + "name": "detected-steps", + "storage": "key-value", + "template": "state", + "options": { + "history": 1, + "max-mib": 8 + } + }, + { + "name": "outputs", + "storage": "object-store", + "template": "objects", + "options": { + "max-mib": 1024, + "max-age-days": 7 + } + }, + { + "name": "kept-builds", + "storage": "object-store", + "template": "objects", + "options": { + "max-mib": 1024 + } + }, + "artifact-store", "forge-account", - "go-toolchain" + "go-toolchain", + "go-package-registry", + "node-tools", + { + "name": "findings", + "storage": "key-value", + "template": "state", + "options": { + "max-mib": 8 + } + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } ], + "binds": { + "artifact-store": "${dir:state}/artifact-store.json", + "go-package-registry": "${dir:state}/go-package-registry.json" + }, "own-secrets": { "broker": "${dir:state}/broker" }, @@ -77,6 +236,21 @@ "owner": "mesh-build-go", "unknown": "program" }, + { + "id": "settings", + "trusted": false, + "type": "file", + "path": "${dir:state}/settings.json", + "mode": "0600", + "owner": "mesh-build-go", + "takes-config": [ + "capacity", + "cores-per-step", + "build-hours" + ], + "merge": "json", + "template": "files/settings.json" + }, { "id": "ssh-dir", "type": "directory", @@ -119,6 +293,11 @@ "type": "package", "package": "openssh" }, + { + "id": "bubblewrap", + "type": "package", + "package": "bubblewrap" + }, { "id": "postgresql", "type": "package", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/forge b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/forge new file mode 100644 index 000000000..6bbf4e20e --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/forge @@ -0,0 +1,7 @@ +Host ${bound:forge-account:ssh_alias} + HostName ${bound:forge-account:ssh_host} + Port ${bound:forge-account:ssh_port} + HostKeyAlias ${bound:forge-account:ssh_alias} + User git + IdentityFile ~/.ssh/mesh_ed25519 + IdentitiesOnly yes diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/gitconfig b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/gitconfig new file mode 100644 index 000000000..052523021 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/gitconfig @@ -0,0 +1,2 @@ +[url "ssh://${bound:forge-account:ssh_alias}/"] + insteadOf = ${bound:forge-account:https_base} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/known_hosts b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/known_hosts new file mode 100644 index 000000000..e0df6d811 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/known_hosts @@ -0,0 +1 @@ +${bound:forge-account:ssh_alias} ${bound:forge-account:host_key} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/settings.json new file mode 100644 index 000000000..4a445c342 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/files/settings.json @@ -0,0 +1,5 @@ +{ + "capacity": 0, + "cores-per-step": 2, + "build-hours": "" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/module.json.captured new file mode 100644 index 000000000..4ef6ba7b6 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-image/module.json.captured @@ -0,0 +1,206 @@ +{ + "module": "mesh-build-image", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds": "0.1", + "git.novox.be/novox/mesh-catalog/modules/ssh-client/sshkeys": "0.1" + }, + "moved": true, + "runs-as": "mesh-build-image", + "capabilities": [ + "package-manager", + "seat-settle-delay", + "user-namespaces" + ], + "state": [ + {"name": "keys", "max-mib": 8}, + {"name": "pauses", "max-mib": 8}, + {"name": "mirror-waits", "ttl-seconds": 172800, "max-mib": 8} + ], + "claims": [ + { + "name": "node-build-image", + "scope": "node", + "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"] + } + ], + "config": { + "capacity": { + "type": "number", + "description": "How many asks of the image build seat this module runs at once on this node (novox/hq ADR 0525 §5); 0 pulls nothing. It is set per node in the mesh's configuration; a node with no value builds nothing.", + "minimum": 0, + "default": 0 + }, + "build-hours": { + "type": "string", + "description": "When this node may take this module's build asks: one window HH:MM-HH:MM in the node's local time (an end before its start crosses midnight, 18:00-06:00). Outside it the node takes no new step and finishes the ones it runs; an empty value builds at any hour. It is set per node in the mesh's configuration.", + "pattern": "|([01][0-9]|2[0-3]):[0-5][0-9]-([01][0-9]|2[0-3]):[0-5][0-9]", + "default": "" + }, + "cores-per-step": { + "type": "number", + "description": "How many processors one image step of this module needs (buildah, whose RUN lines are mostly fetches). The capacity above is an upper bound: on each node the module runs at most floor(the cores of its build slice's CPU quota / this) steps at once, the quota read live from its cgroup (issue 1806), so a lowered build CPU share never starves its steps. Above 0.", + "minimum": 0.1, + "default": 2 + }, + "again-delays": { + "type": "string", + "description": "The delays a step ask whose fetch or publish met its holder away is given again after: after its first run, then after its second, as durations such as 15s,60s (design 47 H2 §799); a third run met so ends the step failed with why fetch: or publish:.", + "trusted": false, + "runtime": true, + "default": "15s,60s" + } + }, + "tools": [ + "build_image_fetch", + "build_image_build", + "build_image_copy", + "build_image_mirror_waits", + "build_image_release", + "build_image_step", + "build_image_steps", + "build_image_step_end", + "build_image_status", + "build_image_health" + ], + "requires": [ + {"name": "steps", "storage": "key-value", "template": "state", "options": {"ttl-seconds": 172800, "objects-max-mib": 256, "max-mib": 8}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": {"max-mib": 1024, "max-age-days": 7}}, + "forge-account", + "rootless-image-build", + "node-tools" + ], + "invokes": [ + "seat:mesh-hand-acts.hand-act", + "seat:container-image-registry.publish", + "seat:container-image-registry.publish-part", + "seat:container-image-registry.mirror", + "seat:mesh-catalog.module", + "seat:mesh-catalog.seat-definitions" + ], + "consumes": [ + "container-image-registry.published", + "container-image-registry.refused", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed" + ], + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "mesh-build-image", + "runtime-health": { + "kind": "tool", + "tool": "build_image_health", + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "60s" + }, + "resources": [ + { + "id": "account", + "type": "user", + "name": "mesh-build-image", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh-build-image" + }, + { + "id": "state", + "type": "directory", + "mode": "0700", + "owner": "mesh-build-image", + "place": ".", + "unknown": "program" + }, + { + "id": "settings", + "trusted": false, + "type": "file", + "path": "${dir:state}/settings.json", + "mode": "0600", + "owner": "mesh-build-image", + "takes-config": ["capacity", "cores-per-step", "build-hours"], + "merge": "json", + "template": "files/settings.json" + }, + { + "id": "work", + "type": "directory", + "path": "/var/lib/mesh-build-image-work", + "mode": "0700", + "owner": "mesh-build-image", + "unknown": "program" + }, + { + "id": "store", + "type": "directory", + "path": "/var/lib/mesh-build-image-store", + "mode": "0700", + "owner": "mesh-build-image", + "unknown": "program" + }, + { + "id": "ssh-dir", + "type": "directory", + "path": "${dir:state}/.ssh", + "mode": "0700", + "owner": "mesh-build-image", + "unknown": "program" + }, + { + "id": "ssh-config", + "type": "file", + "path": "${dir:ssh-dir}/config", + "owner": "mesh-build-image", + "mode": "0600", + "template": "files/forge" + }, + { + "id": "known-hosts", + "type": "file", + "path": "${dir:ssh-dir}/known_hosts", + "owner": "mesh-build-image", + "mode": "0644", + "template": "files/known_hosts" + }, + { + "id": "git-config", + "type": "file", + "path": "${dir:state}/.config/git/config", + "owner": "mesh-build-image", + "mode": "0644", + "template": "files/gitconfig" + }, + { + "id": "git", + "type": "package", + "package": "git" + }, + { + "id": "openssh", + "type": "package", + "package": "openssh" + } + ], + "build": { + "artifacts": [ + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-build-image", + "binary": "mesh-build-image", + "loads": [ + "mesh-build-image" + ] + }, + { + "name": "files", + "kind": "archive", + "from": "files" + } + ] + } +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/files/settings.json new file mode 100644 index 000000000..4a445c342 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/files/settings.json @@ -0,0 +1,5 @@ +{ + "capacity": 0, + "cores-per-step": 2, + "build-hours": "" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/module.json.captured index b92212aa7..d3b769eb2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-build-node/module.json.captured @@ -1,51 +1,116 @@ { "module": "mesh-build-node", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-builder/builds": "0.1", + "git.novox.be/novox/mesh-catalog/modules/ssh-client/sshkeys": "0.1" + }, "moved": true, "runs-as": "mesh-build-node", "capabilities": [ "package-manager", + "seat-settle-delay", "user-namespaces" ], "state": [ - "toolchains", - "keys", - "steps" + {"name": "toolchains", "max-mib": 8}, + {"name": "keys", "max-mib": 8}, + {"name": "pauses", "max-mib": 8} ], + "claims": [ + { + "name": "node-build-node", + "scope": "node", + "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"] + } + ], + "consumes": [ + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed" + ], + "config": { + "capacity": { + "type": "number", + "description": "How many asks of the Node build seat this module runs at once on this node (novox/hq ADR 0525 §5); 0 pulls nothing. It is set per node in the mesh's configuration; a node with no value builds nothing.", + "minimum": 0, + "default": 0 + }, + "build-hours": { + "type": "string", + "description": "When this node may take this module's build asks: one window HH:MM-HH:MM in the node's local time (an end before its start crosses midnight, 18:00-06:00). Outside it the node takes no new step and finishes the ones it runs; an empty value builds at any hour. It is set per node in the mesh's configuration.", + "pattern": "|([01][0-9]|2[0-3]):[0-5][0-9]-([01][0-9]|2[0-3]):[0-5][0-9]", + "default": "" + }, + "cores-per-step": { + "type": "number", + "description": "How many processors one Node step of this module needs (tsc, esbuild and a test runner; a median step takes 15 s). The capacity above is an upper bound: on each node the module runs at most floor(the cores of its build slice's CPU quota / this) steps at once, the quota read live from its cgroup (issue 1806), so a lowered build CPU share never starves its steps. Above 0.", + "minimum": 0.1, + "default": 2 + }, + "again-delays": { + "type": "string", + "description": "The delays a step ask whose fetch or publish met its holder away is given again after: after its first run, then after its second, as durations such as 15s,60s (design 47 H2 §799); a third run met so ends the step failed with why fetch: or publish:.", + "trusted": false, + "runtime": true, + "default": "15s,60s" + }, + "prune-mark": { + "type": "number", + "description": "The fill of mesh-build-node's state detected-steps, in percent of its cap, past which the module prunes it at its own write, oldest first (design 47 H2 §812): below the bus module's raise mark of 75 %.", + "trusted": false, + "runtime": true, + "minimum": 1, + "maximum": 100, + "default": 70 + }, + "prune-target": { + "type": "number", + "description": "The fill, in percent of the cap, a prune of mesh-build-node's state detected-steps takes it down to (design 47 H2 §812); below prune-mark.", + "trusted": false, + "runtime": true, + "minimum": 1, + "maximum": 100, + "default": 50 + } + }, "tools": [ "build_node_fetch", "build_node_test", "build_node_build", + "build_node_release", "build_node_step", "build_node_steps", + "build_node_step_end", "build_node_toolchains", "build_node_status", - "build_node_health" - ], - "streams": [ - { - "name": "toolchains-node", - "events": [ - "toolchain.**" - ] - } + "build_node_health", + "mesh-build-node_state_keep", + "mesh-build-node_state_prune_now" ], "requires": [ + {"name": "steps", "storage": "key-value", "template": "state", "options": {"ttl-seconds": 172800, "objects-max-mib": 256, "max-mib": 16}}, + {"name": "detected-steps", "storage": "key-value", "template": "state", "options": {"history": 1, "max-mib": 8}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": {"max-mib": 1024, "max-age-days": 7}}, + "artifact-store", "forge-account", "npm-package-registry", - "node-toolchain" + "node-toolchain", + "node-tools" ], - "contributes": { - "npm-package-registry": { - "access": "read" - } - }, "binds": { + "artifact-store": "${dir:state}/artifact-store.json", "npm-package-registry": "${dir:state}/package-registry.json" }, - "secrets": { - "npm-package-registry": "${dir:state}/package-registry.secret" - }, + "invokes": [ + "seat:mesh-hand-acts.hand-act", + "seat:oci-artifact-registry.publish", + "seat:oci-artifact-registry.publish-part", + "seat:npm-package-registry.publish", + "seat:npm-package-registry.publish-part", + "seat:mesh-catalog.module", + "seat:mesh-catalog.seat-definitions" + ], "own-secrets": { "broker": "${dir:state}/broker" }, @@ -74,6 +139,17 @@ "place": ".", "unknown": "program" }, + { + "id": "settings", + "trusted": false, + "type": "file", + "path": "${dir:state}/settings.json", + "mode": "0600", + "owner": "mesh-build-node", + "takes-config": ["capacity", "cores-per-step", "build-hours"], + "merge": "json", + "template": "files/settings.json" + }, { "id": "work", "type": "directory", @@ -86,7 +162,7 @@ "id": "cache", "type": "directory", "path": "/var/lib/mesh-build-node-cache", - "mode": "0700", + "mode": "0711", "owner": "mesh-build-node", "unknown": "program" }, @@ -139,6 +215,11 @@ "id": "openssh", "type": "package", "package": "openssh" + }, + { + "id": "bubblewrap", + "type": "package", + "package": "bubblewrap" } ], "build": { @@ -152,6 +233,9 @@ "binary": "mesh-build-node", "loads": [ "mesh-build-node" + ], + "check-needs": [ + "node-build-node" ] }, { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-catalog/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-catalog/module.json.captured index 8d8c6599c..421804df1 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-catalog/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-catalog/module.json.captured @@ -1,16 +1,11 @@ { "module": "mesh-catalog", "slug": "catalog", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], - "claims": [ - { - "name": "mesh-catalog", - "scope": "mesh" - } - ], "requires": [ "postgres-database" ], @@ -25,11 +20,7 @@ "secrets": { "postgres-database": "${dir:state}/database.secret" }, - "consumes": [ - "node-build-agent.built", - "mesh-build-machine.built", - "mesh-controller.built-before" - ], + "consumes": [], "emits": [ "registered", "upgraded", @@ -94,5 +85,11 @@ "from": "files" } ] - } + }, + "invokes": [ + "mesh-delivery-builder.builder_builds_since" + ], + "reads": [ + "mesh-delivery-builder.builds" + ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/files/console b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/files/console new file mode 100644 index 000000000..198dbd469 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/files/console @@ -0,0 +1 @@ +http://127.0.0.1:${bound:mcp-endpoint:port}/mcp diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/module.json.captured index 681a3e55e..86325ec23 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-cli/module.json.captured @@ -1,7 +1,11 @@ { "module": "mesh-cli", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, + "requires": [ + "mcp-endpoint" + ], "resources": [ { "id": "program", @@ -9,6 +13,20 @@ "artifact": "program", "path": "/usr/local/bin", "unknown": "program" + }, + { + "id": "console-dir", + "type": "directory", + "path": "/etc/mesh-cli", + "mode": "0755", + "unknown": "program" + }, + { + "id": "console", + "type": "file", + "path": "/etc/mesh-cli/console", + "mode": "0644", + "template": "files/console" } ], "items": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-conditions/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-conditions/module.json.captured new file mode 100644 index 000000000..4bfcc3fe1 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-conditions/module.json.captured @@ -0,0 +1,116 @@ +{ + "module": "mesh-conditions", + "version": "0.1", + "class": "core", + "runs-as": "mesh-conditions", + "claims": [ + { + "name": "mesh-conditions", + "scope": "mesh", + "serves": [ + "conditions", + "silence", + "resync" + ] + } + ], + "invokes": [ + "mesh-delivery-assigner.assigner_read_wants", + "mesh-delivery-assigner.assigner_read_assignments", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-wants.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-catalog.revision", + "seat:mesh-broker.list" + ], + "consumes": [ + "mesh-delivery-assigner.views.wants", + "mesh-delivery-assigner.views.assignments", + "*.finding-written", + "*.finding-cleared", + "*.findings-stated", + "mesh-watchdogs.machine-away", + "mesh-watchdogs.machine-back", + "mesh-wants.assignment-revision", + "mesh-catalog.registration-changed", + "mesh-catalog.catalog-revision", + "mesh-broker.created", + "node-engine.running", + "node-engine.composed", + "node-engine.wait-held", + "node-engine.wait-ended", + "mesh-healers.attempt-changed" + ], + "state": [ + "conditions", + { + "name": "history", + "ttl-seconds": 7776000 + }, + "held", + "findings-views", + { + "name": "bounds", + "key-ttl": true + } + ], + "config": { + "ask-bound-seconds": { + "type": "number", + "description": "How long an observer has to state its findings after an ask, in seconds, before the keeper raises findings-unstated for it: 300 is five minutes.", + "minimum": 1, + "default": 300, + "runtime": true + }, + "owner-handover-seconds": { + "type": "number", + "description": "How long a failed head stays its commit's author's, in seconds, before the keeper hands its condition to the operator: 7200 is two hours.", + "minimum": 1, + "default": 7200, + "runtime": true + }, + "view-waits-seconds": { + "type": "number", + "description": "How long a first view may stay unanswered, in seconds, before the keeper raises view-waits for it: 300 is five minutes.", + "minimum": 1, + "default": 300, + "runtime": true + } + }, + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "mesh-conditions", + "resources": [ + { + "id": "account", + "type": "user", + "name": "mesh-conditions", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh-conditions" + }, + { + "id": "state", + "type": "directory", + "mode": "0700", + "owner": "mesh-conditions", + "place": ".", + "unknown": "program" + } + ], + "build": { + "artifacts": [ + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-conditions", + "binary": "mesh-conditions", + "loads": [ + "mesh-conditions" + ] + } + ] + } +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-config/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-config/module.json.captured index e03e891bf..e6ac9ed63 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-config/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-config/module.json.captured @@ -1,13 +1,15 @@ { "module": "mesh-config", - "version": "1", + "version": "0.1", + "class": "core", "runs-as": "mesh-config", "claims": [ { "name": "mesh-config", "scope": "mesh", "serves": [ - "config" + "config", + "renames" ] } ], @@ -17,20 +19,52 @@ "uses": [ "operator-channel" ], - "invokes": [ - "seat:mesh-controller.hand-act", - "seat:mesh-controller.warranted" + "consumes": [ + "mesh-delivery-view.delivered", + "node-engine.manifest-reads-changed", + "mesh-delivery-indexer.views.predefined", + "mesh-delivery-assigner.views.assignments", + "mesh-delivery-assigner.views.wants", + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-conditions.findings-asked" ], - "reads": [ - "mesh-controller.assignments", - "mesh-controller.declared-config", - "mesh-controller.predefined" + "invokes": [ + "seat:mesh-hand-acts.hand-act", + "seat:mesh-hand-acts.warranted", + "mesh-delivery-view.node_haves", + "seat:node-engine.manifest-reads", + "mesh-delivery-indexer.indexer_config_readers", + "seat:mesh-vault.retire", + "mesh-delivery-indexer.indexer_read_predefined", + "mesh-delivery-assigner.assigner_read_assignments", + "mesh-delivery-assigner.assigner_read_wants", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-catalog.entry", + "seat:mesh-delivery.source" + ], + "tools": [ + "config_declared", + "config_resync", + "config_renames", + "config_rename_again", + "config_rename_close", + "config_retiring", + "config_first_views", + "config_first_view_again", + "config_entry_again" ], "state": [ "values", "resolved", "predefined", - "proposals" + "proposals", + "declared", + "renames", + "retiring", + "findings" ], "logs": [ "history" @@ -70,5 +104,37 @@ ] } ] + }, + "streams": [ + { + "name": "config-events", + "events": [ + "renamed", + "retiring", + "retired" + ], + "retention": "history" + }, + { + "name": "mesh-config-findings", + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 16 + } + ], + "config": { + "deadline-floor-seconds": { + "type": "number", + "description": "the least wait, in seconds, of mesh-config's one deadline timer: it is set for the earliest real deadline it holds (a waiting proposal's end, an unanswered retirement's second ask, a rename window's seven-day held finding) and never sooner than this after a look, so a deadline passed and not settled is tried again, not spun on (lead answer A-490l, ADR 0681).", + "minimum": 1, + "maximum": 3600, + "trusted": false, + "default": 60, + "runtime": true + } } } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/files/settings.json new file mode 100644 index 000000000..63414735c --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/files/settings.json @@ -0,0 +1,4 @@ +{ + "record-retention": 90, + "untaken-bound": 10 +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/module.json.captured index ec8385219..37f784c26 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-delivery-gate/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-delivery-gate", - "version": "1", + "version": "0.1", + "class": "core", "slug": "gate", "claims": [ { @@ -8,81 +9,483 @@ "scope": "mesh", "serves": [ "deliveries", - "times", "show", - "groups", - "what-if", - "checks", - "table", - "stalled", - "recheck", - "release", - "stop", - "close", - "retire-history" + "source", + "recovery", + "stalled" ] } ], "consumes": [ - "gitea.pull.updated", - "gitea.pull.merged", - "gitea.pull.closed", - "gitea.forge.status", - "gitea.forge.pull-request.edited", - "gitea.forge.pull-request.closed", - "mesh-controller.checked", - "mesh-controller.plan-moved", - "mesh-delivery-forge-bridge.forge.**" + "mesh-delivery-forge-bridge.owed.ended", + "git.merge-called.*", + "mesh-delivery-forge-bridge.forge.*.*.*.head-moved", + "mesh-delivery-indexer.take-in.taken", + "mesh-pipeline-runner.pipeline-started.*.*", + "mesh-pipeline-runner.pipeline-ended.*.*", + "mesh-pipeline-runner.wait-held.*.*", + "mesh-pipeline-runner.wait-ended.*.*", + "mesh-wants.wanted.*.*", + "mesh-wants.pipeline-wanted.*.*", + "node-engine.running.*.*", + "mesh-catalog.registration-changed", + "mesh-conditions.findings-asked" ], - "emits": [ - "transition", - "group", - "merged" - ], - "invokes": [ - "seat:mesh-controller.deliver", - "seat:mesh-controller.delivery-stop", - "seat:mesh-controller.delivery-backups-again", - "seat:mesh-controller.delivery-walks", - "seat:mesh-controller.delivery-check", - "seat:mesh-controller.forget-checks", - "seat:mesh-controller.plans", - "gitea.gitea_commit_statuses", - "gitea.gitea_contains", - "gitea.gitea_open_pulls" - ], - "state": [ - "deliveries", - "groups", - "pulls", + "requires": [ { - "name": "asks", - "history": 5 + "name": "records", + "storage": "ledger", + "template": "ledger", + "options": { + "max-mib": 1024 + }, + "types": [ + { + "name": "record", + "schema": { + "milestone": { + "type": "string" + }, + "source": { + "type": "integer" + }, + "call": { + "type": "string" + }, + "heads": { + "type": "object" + }, + "opened": { + "type": "string" + }, + "form": { + "type": "integer" + }, + "group": { + "type": "object" + }, + "trace": { + "type": "object" + }, + "key": { + "type": "string" + }, + "module": { + "type": "string" + }, + "fingerprint": { + "type": "string" + }, + "node": { + "type": "string" + }, + "step": { + "type": "string" + }, + "outcome": { + "type": "string" + }, + "why": { + "type": "string" + }, + "at": { + "type": "string" + }, + "event": { + "type": "string" + }, + "since": { + "type": "string" + }, + "branch": { + "type": "string" + }, + "ended": { + "type": "object" + }, + "id": { + "type": "string" + }, + "act": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "number": { + "type": "integer" + }, + "head": { + "type": "string" + }, + "words": { + "type": "string" + }, + "recovery": { + "type": "object" + }, + "owed": { + "type": "object" + }, + "movers": { + "type": "integer" + }, + "merge-called": { + "type": "string" + }, + "delivery-time": { + "type": "string" + }, + "class": { + "type": "string" + }, + "phases": { + "type": "object" + } + }, + "operations": [ + { + "name": "open", + "effect": "set-fields", + "fields": [ + "milestone", + "branch", + "source", + "call", + "heads", + "opened", + "form", + "merge-called" + ], + "sequence": true + }, + { + "name": "group", + "effect": "set-fields", + "fields": [ + "group" + ], + "sequence": true + }, + { + "name": "trace", + "effect": "set-fields", + "fields": [ + "trace", + "recovery" + ], + "sequence": true + }, + { + "name": "movers", + "effect": "set-fields", + "fields": [ + "movers" + ], + "sequence": true + }, + { + "name": "phases", + "effect": "set-fields", + "fields": [ + "phases" + ], + "sequence": true + }, + { + "name": "away", + "effect": "set-entry", + "fields": [ + "node", + "since" + ], + "into": "away", + "key": "node" + }, + { + "name": "back", + "effect": "remove", + "into": "away", + "key": "node" + }, + { + "name": "act", + "effect": "set-entry", + "fields": [ + "id", + "act", + "repository", + "number", + "head", + "outcome", + "words", + "at", + "owed" + ], + "into": "acts", + "key": "id", + "sequence": true + }, + { + "name": "end", + "effect": "set-fields", + "fields": [ + "ended", + "delivery-time", + "class" + ], + "sequence": true + } + ] + }, + { + "name": "mover", + "schema": { + "record": { + "type": "string" + }, + "module": { + "type": "string" + }, + "pipeline": { + "type": "string" + }, + "version": { + "type": "string" + }, + "key": { + "type": "string" + }, + "fingerprint": { + "type": "string" + }, + "node": { + "type": "string" + }, + "step": { + "type": "string" + }, + "outcome": { + "type": "string" + }, + "why": { + "type": "string" + }, + "at": { + "type": "string" + }, + "event": { + "type": "string" + }, + "class": { + "type": "string" + } + }, + "operations": [ + { + "name": "mover", + "effect": "set-fields", + "fields": [ + "record", + "module", + "class", + "pipeline", + "version" + ], + "sequence": true + }, + { + "name": "entry", + "effect": "set-entry", + "fields": [ + "key", + "module", + "fingerprint", + "node" + ], + "into": "entries", + "key": "key", + "sequence": true + }, + { + "name": "outcome", + "effect": "set-entry", + "fields": [ + "key", + "module", + "fingerprint", + "node", + "step", + "outcome", + "why", + "at", + "event" + ], + "into": "outcomes", + "key": "key", + "sequence": true + } + ], + "indexes": [ + { + "name": "movers", + "on": [ + "record" + ] + } + ] + }, + { + "name": "held", + "schema": { + "instance": { + "type": "string" + }, + "opened": { + "type": "string" + } + }, + "operations": [ + { + "name": "hold", + "effect": "set-entry", + "fields": [ + "instance", + "opened" + ], + "into": "records", + "key": "instance" + }, + { + "name": "drop", + "effect": "remove", + "into": "records", + "key": "instance" + } + ] + } + ] }, { - "name": "merges", - "history": 10 + "name": "heads", + "storage": "key-value", + "template": "state", + "options": { + "max-mib": 8 + } }, { - "name": "owed", - "history": 5 + "name": "findings", + "storage": "key-value", + "template": "state", + "options": { + "max-mib": 8 + } }, { - "name": "source", - "history": 64 + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } } ], - "reads": [ - "mesh-delivery.deliveries", - "mesh-delivery.groups", - "mesh-delivery.pulls", - "mesh-delivery-teller.answers", - "mesh-controller.assignments", - "node-engine.have" + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-assigner/asks": "0.3", + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-forge-bridge/forgemsg": "0.1" + }, + "invokes": [ + "seat:git.branch", + "seat:mesh-catalog.entry", + "seat:mesh-catalog.registrations", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-wants.entry", + "seat:node-engine.composition" + ], + "state": [ + { + "name": "source", + "history": 64, + "max-mib": 8 + } + ], + "capabilities": [ + "ledger-calls", + "ledger-upkeep-calls" ], "tools": [ - "delivery_status" + "delivery_status", + "gate_consumer", + "gate_head_take", + "gate_heads", + "gate_record", + "gate_record_end", + "gate_record_repair", + "gate_records", + "gate_source", + "gate_source_again", + "gate_source_seed", + "gate_source_start", + "gate_times", + "mesh-delivery-gate_state_keep", + "mesh-delivery-gate_state_prune_now" ], + "config": { + "record-retention": { + "type": "number", + "description": "days a delivery record is kept from when it opened (design 47 *The delivery record*): ninety covers every trace asked of a past delivery so far; when a record is removed at its retention, the gate says freed for each graph revision it pinned. Nothing else is removed to make room.", + "minimum": 1, + "maximum": 3650, + "trusted": false, + "default": 90 + }, + "untaken-bound": { + "type": "number", + "description": "minutes a watched branch's head may stand that no merge call delivered before the gate raises head-untaken (design 47 H §740); the gate keeps one deadline timer for the earliest.", + "minimum": 1, + "trusted": false, + "default": 10 + }, + "budget-core": { + "type": "string", + "description": "The budget of a delivery that moves a core module, from merge-called to the last running of its movers, as a duration such as 10m (ADR 0282; design 47 H2 §810): gate_times names every delivery over it, and the self-check raises over-budget for it.", + "trusted": false, + "runtime": true, + "default": "10m" + }, + "budget-leaf": { + "type": "string", + "description": "The budget of a delivery that moves only leaf modules, as a duration such as 3m (ADR 0304; design 47 H2 §810).", + "trusted": false, + "runtime": true, + "default": "3m" + }, + "prune-mark": { + "type": "number", + "description": "The fill of the gate's state heads, in percent of its cap, past which the gate prunes it at its own write, oldest first (design 47 H2 §812): below the bus module's raise mark of 75 %.", + "trusted": false, + "runtime": true, + "minimum": 1, + "maximum": 100, + "default": 70 + }, + "prune-target": { + "type": "number", + "description": "The fill, in percent of the cap, a prune of the gate's state heads takes it down to (design 47 H2 §812); below prune-mark.", + "trusted": false, + "runtime": true, + "minimum": 1, + "maximum": 100, + "default": 50 + } + }, "resources": [ { "id": "state", @@ -90,6 +493,18 @@ "mode": "0700", "place": ".", "unknown": "program" + }, + { + "id": "settings", + "type": "file", + "path": "${dir:state}/settings.json", + "mode": "0600", + "takes-config": [ + "record-retention", + "untaken-bound" + ], + "merge": "json", + "template": "files/settings.json" } ], "build": { @@ -103,7 +518,15 @@ "binary": "mesh-delivery-gate", "loads": [ "mesh-delivery-gate" - ] + ], + "env": { + "MESH_DELIVERY_GATE_SETTINGS": "${dir:state}/settings.json" + } + }, + { + "name": "files", + "kind": "archive", + "from": "files" } ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-files/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-files/module.json.captured index cc1df1622..4b75b5f33 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-files/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-files/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-files", - "version": "1", + "version": "0.1", + "class": "core", "claims": [ { "name": "node-files", @@ -20,12 +21,15 @@ "chmod", "chown", "trash", - "restore" + "restore", + "upload", + "download" ] } ], "invokes": [ - "seat:operator-channel.tell" + "seat:operator-channel.tell", + "seat:object-store.link" ], "resources": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-hand-acts/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-hand-acts/module.json.captured new file mode 100644 index 000000000..6131b4e2e --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-hand-acts/module.json.captured @@ -0,0 +1,66 @@ +{ + "module": "mesh-hand-acts", + "version": "0.1", + "class": "core", + "runs-as": "mesh-hand-acts", + "claims": [ + { + "name": "mesh-hand-acts", + "scope": "mesh", + "serves": [ + "hand-act", + "hand-acts", + "warranted" + ] + } + ], + "reads": [ + "messenger.asks" + ], + "logs": [ + { + "name": "acts", + "max-age-days": 400 + } + ], + "state": [ + "warrants", + "copied" + ], + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "mesh-hand-acts", + "resources": [ + { + "id": "account", + "type": "user", + "name": "mesh-hand-acts", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh-hand-acts" + }, + { + "id": "state", + "type": "directory", + "mode": "0700", + "owner": "mesh-hand-acts", + "place": ".", + "unknown": "program" + } + ], + "build": { + "artifacts": [ + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-hand-acts", + "binary": "mesh-hand-acts", + "loads": [ + "mesh-hand-acts" + ] + } + ] + } +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-healers/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-healers/module.json.captured new file mode 100644 index 000000000..930c16ec9 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-healers/module.json.captured @@ -0,0 +1,101 @@ +{ + "module": "mesh-healers", + "version": "0.1", + "class": "core", + "runs-as": "mesh-healers", + "claims": [ + { + "name": "mesh-healers", + "scope": "mesh", + "serves": [ + "healers", + "heal", + "drill" + ] + } + ], + "consumes": [ + "mesh-conditions.condition-raised", + "mesh-conditions.condition-changed", + "mesh-hand-acts.act-recorded", + "mesh-conditions.findings-asked" + ], + "invokes": [ + "seat:mesh-hand-acts.hand-act", + "seat:mesh-hand-acts.hand-acts" + ], + "reads": [ + "mesh-conditions.conditions" + ], + "state": [ + { + "name": "attempts", + "key-ttl": true + }, + { + "name": "would", + "key-ttl": true + }, + { + "name": "wakes", + "key-ttl": true + } + ], + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "mesh-healers", + "resources": [ + { + "id": "account", + "type": "user", + "name": "mesh-healers", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh-healers" + }, + { + "id": "state", + "type": "directory", + "mode": "0700", + "owner": "mesh-healers", + "place": ".", + "unknown": "program" + } + ], + "build": { + "artifacts": [ + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-healers", + "binary": "mesh-healers", + "loads": [ + "mesh-healers" + ] + } + ] + }, + "requires": [ + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ] +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/files/settings.json index 66abd38f7..8c2f04378 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/files/settings.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/files/settings.json @@ -9,9 +9,9 @@ "mesh-catalog modules/audit-logger", "mesh-catalog modules/avahi", "mesh-catalog modules/baserow", - "mesh-catalog modules/betterbird", "mesh-catalog modules/blueman", "mesh-catalog modules/bluetooth", + "mesh-catalog modules/brother", "mesh-catalog modules/ca-trust", "mesh-catalog modules/claude-code", "mesh-catalog modules/claude-licence-manager", @@ -45,6 +45,7 @@ "mesh-catalog modules/influxdb", "mesh-catalog modules/invoicing", "mesh-catalog modules/jira", + "mesh-catalog modules/kernel", "mesh-catalog modules/keycloak", "mesh-catalog modules/lab", "mesh-catalog modules/lemurs", @@ -56,11 +57,29 @@ "mesh-catalog modules/marrytts", "mesh-catalog modules/matrix", "mesh-catalog modules/memory-pressure", + "mesh-catalog modules/mesh-build-go", + "mesh-catalog modules/mesh-build-image", + "mesh-catalog modules/mesh-build-node", "mesh-catalog modules/mesh-catalog", "mesh-catalog modules/mesh-cli", + "mesh-catalog modules/mesh-conditions", + "mesh-catalog modules/mesh-config", "mesh-catalog modules/mesh-delivery", "mesh-catalog modules/mesh-delivery-gate", + "mesh-catalog modules/mesh-files", + "mesh-catalog modules/mesh-hand-acts", + "mesh-catalog modules/mesh-healers", "mesh-catalog modules/mesh-issues", + "mesh-catalog modules/mesh-knowledge", + "mesh-catalog modules/mesh-mail", + "mesh-catalog modules/mesh-mail-notifier", + "mesh-catalog modules/mesh-mail-reader", + "mesh-catalog modules/mesh-mail-web", + "mesh-catalog modules/mesh-provisioner", + "mesh-catalog modules/mesh-provisioner-client", + "mesh-catalog modules/mesh-reads", + "mesh-catalog modules/mesh-recovery", + "mesh-catalog modules/mesh-self-check", "mesh-catalog modules/mesh-vault", "mesh-catalog modules/mesh-watcher", "mesh-catalog modules/messenger", @@ -126,15 +145,19 @@ "mesh-catalog modules/zsh", "mesh-catalog modules/zsh-autosuggestions", "mesh-catalog modules/zsh-syntax-highlighting", - "mesh-controller", - "mesh-controller modules/build-agent", - "mesh-controller modules/route-proxy", "mesh-delivery", + "mesh-delivery modules/mesh-delivery-builder", + "mesh-delivery modules/mesh-delivery-forge-bridge", + "mesh-delivery modules/mesh-delivery-indexer", + "mesh-delivery modules/mesh-delivery-teller", + "mesh-delivery modules/mesh-delivery-view", + "mesh-delivery modules/mesh-delivery-watchman", "mesh-host", "mesh-lab", "mesh-media-catalog", "mesh-sdk", - "mesh-tools" + "mesh-tools", + "okioki" ], "duplicate-check": "on", "judge-model": "sonnet", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/module.json.captured index dcfc71c36..ec6bdc8f8 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-issues/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-issues", - "version": "1", + "version": "0.1", + "class": "core", "slug": "issues", "seats": [ { @@ -13,12 +14,17 @@ "move", "note", "link", + "milestones", + "milestone-set", + "milestone-move", "import", "groom", "set", "tracking", "reserve", - "fix-times" + "fix-times", + "learn-fixes", + "changes" ] } ], @@ -33,12 +39,17 @@ "move", "note", "link", + "milestones", + "milestone-set", + "milestone-move", "import", "groom", "set", "tracking", "reserve", - "fix-times" + "fix-times", + "learn-fixes", + "changes" ] } ], @@ -52,18 +63,23 @@ "triaged", "ready", "ready-to-verify", - "reserved" + "reserved", + "milestone-set", + "milestone-moved" ], "consumes": [ "mesh-issues.opened", "mesh-issues.moved", - "mesh-delivery-gate.transition" + "mesh-delivery-gate.transition", + "mesh-delivery-view.delivered" ], "invokes": [ "claude-code.claude_code_judge", - "seat:mesh-delivery.checks", "seat:operator-channel.notify", - "gitea.gitea_pull_reviews", + "seat:git.pull", + "seat:git.contains", + "seat:mesh-pipeline-runner.list", + "seat:mesh-pipeline-runner.show", "records.records_status", "records.records_list", "records.records_read", @@ -79,7 +95,11 @@ }, "counters", "grooming", - "reservations" + "reservations", + { + "name": "milestones", + "history": 5 + } ], "config": { "first-number": { @@ -102,9 +122,9 @@ "mesh-catalog modules/audit-logger", "mesh-catalog modules/avahi", "mesh-catalog modules/baserow", - "mesh-catalog modules/betterbird", "mesh-catalog modules/blueman", "mesh-catalog modules/bluetooth", + "mesh-catalog modules/brother", "mesh-catalog modules/ca-trust", "mesh-catalog modules/claude-code", "mesh-catalog modules/claude-licence-manager", @@ -138,6 +158,7 @@ "mesh-catalog modules/influxdb", "mesh-catalog modules/invoicing", "mesh-catalog modules/jira", + "mesh-catalog modules/kernel", "mesh-catalog modules/keycloak", "mesh-catalog modules/lab", "mesh-catalog modules/lemurs", @@ -149,11 +170,29 @@ "mesh-catalog modules/marrytts", "mesh-catalog modules/matrix", "mesh-catalog modules/memory-pressure", + "mesh-catalog modules/mesh-build-go", + "mesh-catalog modules/mesh-build-image", + "mesh-catalog modules/mesh-build-node", "mesh-catalog modules/mesh-catalog", "mesh-catalog modules/mesh-cli", + "mesh-catalog modules/mesh-conditions", + "mesh-catalog modules/mesh-config", "mesh-catalog modules/mesh-delivery", "mesh-catalog modules/mesh-delivery-gate", + "mesh-catalog modules/mesh-files", + "mesh-catalog modules/mesh-hand-acts", + "mesh-catalog modules/mesh-healers", "mesh-catalog modules/mesh-issues", + "mesh-catalog modules/mesh-knowledge", + "mesh-catalog modules/mesh-mail", + "mesh-catalog modules/mesh-mail-notifier", + "mesh-catalog modules/mesh-mail-reader", + "mesh-catalog modules/mesh-mail-web", + "mesh-catalog modules/mesh-provisioner", + "mesh-catalog modules/mesh-provisioner-client", + "mesh-catalog modules/mesh-reads", + "mesh-catalog modules/mesh-recovery", + "mesh-catalog modules/mesh-self-check", "mesh-catalog modules/mesh-vault", "mesh-catalog modules/mesh-watcher", "mesh-catalog modules/messenger", @@ -219,15 +258,19 @@ "mesh-catalog modules/zsh", "mesh-catalog modules/zsh-autosuggestions", "mesh-catalog modules/zsh-syntax-highlighting", - "mesh-controller", - "mesh-controller modules/build-agent", - "mesh-controller modules/route-proxy", "mesh-delivery", + "mesh-delivery modules/mesh-delivery-builder", + "mesh-delivery modules/mesh-delivery-forge-bridge", + "mesh-delivery modules/mesh-delivery-indexer", + "mesh-delivery modules/mesh-delivery-teller", + "mesh-delivery modules/mesh-delivery-view", + "mesh-delivery modules/mesh-delivery-watchman", "mesh-host", "mesh-lab", "mesh-media-catalog", "mesh-sdk", - "mesh-tools" + "mesh-tools", + "okioki" ] }, "duplicate-check": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/readers.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/readers.json new file mode 100644 index 000000000..aea1d275d --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/readers.json @@ -0,0 +1,3 @@ +{ + "readers": {} +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/settings.json index 6f682fed6..55571eb24 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/settings.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/files/settings.json @@ -1,5 +1,6 @@ { "judge-model": "sonnet", "drafting": "on", - "reserved-for": "168h" + "reserved-for": "168h", + "research-active-at-most": 3 } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/module.json.captured index 92b15f2db..43fbf81f2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-knowledge/module.json.captured @@ -1,18 +1,112 @@ { "module": "mesh-knowledge", - "version": "1", + "version": "0.1", + "class": "core", "slug": "knowledge", "requires": [ - "postgres-database" + "postgres-database", + "route", + { + "name": "records", "storage": "ledger", "template": "ledger", "options": {"max-mib": 1024}, + "types": [ + { + "name": "decision", + "schema": { + "kind": {"type": "string"}, + "number": {"type": "integer"}, + "entry": {"type": "object"}, + "version": {"type": "object"}, + "pending-sections": {"type": "object"}, + "title": {"type": "string"}, + "text": {"type": "text"}, + "digest": {"type": "string", "digest-of": "text"}, + "why": {"type": "string"}, + "reason": {"type": "string"} + }, + "operations": [ + {"name": "reserve", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "propose", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "write-section", "effect": "set-entry", "into": "pending-sections", "key": "title", "fields": ["title", "digest"], "sequence": true, "author": true}, + {"name": "submit", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "drop", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "import", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "form", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "take-over", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "review", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "ask", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "warrant", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "accept", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "withdraw", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "retract", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "draft", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true} + ] + }, + { + "name": "research", + "schema": { + "kind": {"type": "string"}, + "number": {"type": "integer"}, + "entry": {"type": "object"}, + "version": {"type": "object"}, + "pending-sections": {"type": "object"}, + "title": {"type": "string"}, + "text": {"type": "text"}, + "digest": {"type": "string", "digest-of": "text"}, + "why": {"type": "string"}, + "reason": {"type": "string"} + }, + "operations": [ + {"name": "reserve", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "propose", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "write-section", "effect": "set-entry", "into": "pending-sections", "key": "title", "fields": ["title", "digest"], "sequence": true, "author": true}, + {"name": "submit", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "drop", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "import", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "form", "effect": "set-fields", "fields": ["kind", "number", "entry", "pending-sections"], "sequence": true, "author": true}, + {"name": "take-over", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "review", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "ask", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "warrant", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "accept", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "withdraw", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "retract", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true}, + {"name": "draft", "effect": "set-fields", "fields": ["kind", "number", "entry"], "sequence": true, "author": true} + ] + } + ] + }, + {"name": "drafts", "storage": "key-value", "template": "state", "options": {"key-ttl": true}}, + {"name": "asked", "storage": "key-value", "template": "state"}, + {"name": "findings", "storage": "key-value", "template": "state"}, + {"name": "sent", "storage": "key-value", "template": "state"}, + {"name": "reviews", "storage": "stream", "configuration": {"when-full": "refuse", "max-mib": 512, "max-age-days": "none", "grant": "readers", "events": ["part-reviewed"]}}, + { + "name": "finding-events", "storage": "stream", "template": "events", + "options": {"events": ["finding-written.*", "finding-cleared.*", "findings-stated.*"], "max-age-days": 7, "max-mib": 8} + } ], "contributes": { "postgres-database": { "name": "knowledge" + }, + "route": { + "label": "knowledge", + "endpoint": "overview" } }, "binds": { - "postgres-database": "${dir:state}/database.json" + "postgres-database": "${dir:state}/database.json", + "route": "${dir:state}/route.json" }, + "listens": [ + { + "name": "overview", + "port": 8480, + "protocol": "tcp", + "from": "machine", + "why": "the overview page, read-only: only a process on this machine reaches it, and the operator through the route proxy (novox/hq ADR 0616 §4)" + } + ], "secrets": { "postgres-database": "${dir:state}/database.secret" }, @@ -30,9 +124,19 @@ "history", "reserve", "propose", + "open", + "write", + "remove", + "order", + "submit", + "drop", + "take-over", "import", "return", - "withdraw" + "withdraw", + "close", + "retract", + "progress" ] } ], @@ -50,15 +154,41 @@ "history", "reserve", "propose", + "open", + "write", + "remove", + "order", + "submit", + "drop", + "take-over", "import", "return", - "withdraw" + "withdraw", + "close", + "retract", + "progress" ] } ], "tools": [ "knowledge_health", - "knowledge_highest" + "knowledge_highest", + "knowledge_marks", + "knowledge_head", + "knowledge_operations", + "knowledge_section", + "knowledge_draft", + "knowledge_parts", + "knowledge_asked", + "knowledge_fill", + "knowledge_rebuild_index", + "knowledge_review_again", + "knowledge_integrity", + "knowledge_form_only", + "knowledge_move", + "knowledge_move_check", + "knowledge_overview", + "knowledge_overview_reread" ], "emits": [ "reserved", @@ -69,7 +199,28 @@ "imported", "drafted", "confirmed", - "returned" + "returned", + "opened", + "written", + "removed", + "ordered", + "submitted", + "dropped", + "taken-over", + "part-reviewed", + "moved", + "checked", + "formed" + ], + "consumes": [ + "claude-code.judged", + "mesh-issues.opened", + "mesh-issues.moved", + "mesh-issues.milestone-set", + "mesh-issues.milestone-moved", + "messenger.offered", + "messenger.closed", + "mesh-conditions.findings-asked" ], "uses": [ "operator-channel" @@ -77,13 +228,26 @@ "invokes": [ "seat:issue-tracker.reserve", "claude-code.claude_code_judge", - "claude-code.claude_code_judged", "records.records_status", "records.records_list", "records.records_read", - "seat:operator-channel.notify" + "seat:operator-channel.notify", + "seat:issue-tracker.list", + "seat:issue-tracker.get", + "seat:issue-tracker.milestones", + "seat:issue-tracker.changes", + "seat:mesh-delivery.deliveries", + "seat:mesh-delivery.show", + "seat:operator-channel.asks", + "seat:mesh-hand-acts.hand-act" ], "config": { + "readers": { + "type": "object", + "trusted": true, + "description": "The modules heard on the reviews of records (the stream of each part's verdict), by name, each with why; empty grants none. Set only at the controller's terminal or on the operator's Approve.", + "default": {} + }, "judge-model": { "type": "string", "description": "The model the knowledge base's drafting and confirming judgements ask, by the agent's name for it, such as sonnet; empty is sonnet.", @@ -99,6 +263,12 @@ "description": "How long a reserved number waits for its proposal before it is withdrawn, as a duration such as 168h; empty is the knowledge base's own default.", "pattern": "|[0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h)([0-9]+(\\.[0-9]+)?(ns|us|µs|ms|s|m|h))*", "default": "168h" + }, + "research-active-at-most": { + "type": "number", + "description": "The most research efforts that may be active at once; propose refuses a further one, which is parked as an idea instead. 0 or empty is 3.", + "minimum": 0, + "default": 3 } }, "resources": [ @@ -122,10 +292,19 @@ "type": "file", "path": "${dir:state}/settings.json", "mode": "0600", - "takes-config": ["judge-model", "drafting", "reserved-for"], + "takes-config": ["judge-model", "drafting", "reserved-for", "research-active-at-most"], "merge": "json", "template": "files/settings.json" }, + { + "id": "readers", + "type": "file", + "path": "${dir:state}/readers.json", + "mode": "0600", + "takes-config": ["readers"], + "merge": "json", + "template": "files/readers.json" + }, { "id": "prepare", "type": "process", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-notifier/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-notifier/module.json.captured index 9afba4661..290b2b2c2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-notifier/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-notifier/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-mail-notifier", - "version": "1", + "version": "0.1", + "class": "core", "runs-as": "mesh-mail-notifier", "claims": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/files/callers.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/files/callers.json deleted file mode 100644 index 84dd80034..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/files/callers.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "callers": ["mesh-mail-web"] -} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/module.json.captured index b83e8bb40..211b6dbe5 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-reader/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-mail-reader", - "version": "1", + "version": "0.1", + "class": "core", "runs-as": "mesh-mail-reader", "claims": [ { @@ -32,14 +33,6 @@ "secrets": { "postgres-database": "${dir:state}/database.secret" }, - "config": { - "callers": { - "type": "list", - "description": "Who may call one of mail-reading's six verbs (entries, groups, correct, lessons, undo, status): a module's name (on every machine), ., or person. (novox/hq ADR 0459 §2). mesh-mail-web alone by default.", - "trusted": true, - "default": ["mesh-mail-web"] - } - }, "tools": [ "mail-reading.entries", "mail-reading.groups", @@ -77,17 +70,6 @@ "place": ".", "unknown": "program" }, - { - "id": "callers", - "trusted": true, - "type": "file", - "path": "${dir:state}/callers.json", - "mode": "0600", - "owner": "mesh-mail-reader", - "merge": "json", - "template": "files/callers.json", - "takes-config": ["callers"] - }, { "id": "database-url", "type": "file", @@ -127,8 +109,7 @@ "mesh-mail-reader" ], "env": { - "DATABASE_URL_FILE": "${dir:state}/database.url", - "MESH_MAIL_READER_CALLERS": "${dir:state}/callers.json" + "DATABASE_URL_FILE": "${dir:state}/database.url" } }, { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-web/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-web/module.json.captured index c6c0d3de5..f9192aac6 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-web/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail-web/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-mail-web", - "version": "1", + "version": "0.1", + "class": "core", "slug": "mail-web", "runs-as": "mesh-mail-web", "claims": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail/module.json.captured index 735fbc54f..42ad7e902 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-mail/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-mail", - "version": "1", + "version": "0.1", + "class": "core", "slug": "mail", "seats": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner-client/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner-client/module.json.captured index 095128a87..c086a9afc 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner-client/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner-client/module.json.captured @@ -1,12 +1,14 @@ { "module": "mesh-provisioner-client", - "version": "1", + "version": "0.1", + "class": "core", "claims": [ { "name": "node-provisioner", "scope": "node" } ], + "core-credentials": true, "own-secrets": { "provisioner-broker": "${dir:state}/broker" }, diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner/module.json.captured index 650425b3d..dd980a5c0 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-provisioner/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-provisioner", - "version": "1", + "version": "0.1", + "class": "core", "runs-as": "mesh-provisioner", "claims": [ { @@ -11,16 +12,69 @@ ] } ], + "uses": [ + "operator-channel" + ], + "reads": [ + "node-engine.have", + "mesh-host.composed", + "gitea.bound", + "keycloak.bound", + "postgres.bound", + "route-adapter.bound", + "route-proxy.bound", + "node-tools.bound", + "mesh-vault.bound" + ], + "invokes": [ + "mesh-delivery-assigner.assigner_read_assignments", + "mesh-delivery-assigner.assigner_read_wants", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-catalog.entry", + "seat:mesh-delivery.source", + "seat:mesh-hand-acts.hand-act" + ], + "consumes": [ + "mesh-delivery-assigner.views.assignments", + "mesh-delivery-assigner.views.wants", + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-conditions.findings-asked" + ], + "tools": [ + "provisioner_provisions", + "provisioner_plans", + "provisioner_compose", + "provisioner_decide", + "provisioner_health", + "provisioner_first_views", + "provisioner_first_view_again", + "provisioner_entry_again" + ], "state": [ "registry", "needs", "applied", - "collect" + "collect", + "provisions", + "plans", + "refused" ], + "core-credentials": true, "own-secrets": { "broker": "${dir:state}/broker" }, "secrets-owner": "mesh-provisioner", + "runtime-health": { + "kind": "tool", + "tool": "provisioner_health", + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "60s" + }, "resources": [ { "id": "account", @@ -52,5 +106,26 @@ ] } ] - } + }, + "requires": [ + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + }, + { + "name": "findings", + "storage": "key-value", + "template": "state" + } + ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-reads/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-reads/module.json.captured index 18062752f..1067ef63e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-reads/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-reads/module.json.captured @@ -1,6 +1,7 @@ { "module": "mesh-reads", - "version": "1", + "version": "0.1", + "class": "core", "runs-as": "mesh-reads", "claims": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/dump-wait-minutes b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/dump-wait-minutes new file mode 100644 index 000000000..bcb00821f --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/dump-wait-minutes @@ -0,0 +1 @@ +${config:dump-wait-minutes} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/expire-every-hours b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/expire-every-hours new file mode 100644 index 000000000..68cafde19 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/expire-every-hours @@ -0,0 +1 @@ +${config:expire-every-hours} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/point-keep-days b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/point-keep-days new file mode 100644 index 000000000..02af64917 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/point-keep-days @@ -0,0 +1 @@ +${config:point-keep-days} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/points-cap b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/points-cap new file mode 100644 index 000000000..cbe82190d --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/points-cap @@ -0,0 +1 @@ +${config:points-cap} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/points-filling-mark b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/points-filling-mark new file mode 100644 index 000000000..da03c7e78 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/points-filling-mark @@ -0,0 +1 @@ +${config:points-filling-mark} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/snapshot-restore-wait-minutes b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/snapshot-restore-wait-minutes new file mode 100644 index 000000000..89cd4bdf5 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/files/snapshot-restore-wait-minutes @@ -0,0 +1 @@ +${config:snapshot-restore-wait-minutes} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/module.json.captured new file mode 100644 index 000000000..2719831e7 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-recovery/module.json.captured @@ -0,0 +1,322 @@ +{ + "module": "mesh-recovery", + "version": "0.1", + "class": "core", + "runs-as": "mesh-recovery", + "claims": [ + { + "name": "mesh-recovery", + "scope": "mesh", + "serves": [ + "snapshot-kept", + "restore-kept", + "kept-points", + "restore-aside", + "cancel", + "take", + "restore", + "retry", + "aside", + "discard-aside", + "expire-points" + ] + } + ], + "tools": [ + "recovery_kept_points", + "recovery_take", + "recovery_restore", + "recovery_retry", + "recovery_aside", + "recovery_discard_aside", + "recovery_restore_aside", + "recovery_cancel", + "recovery_expire_points" + ], + "consumes": [ + "node-backup.item-started", + "node-backup.item-ended", + "node-engine.running", + "mesh-broker.snapshot-restored", + "mesh-broker.recreated", + "mesh-broker.dropped", + "mesh-conditions.findings-asked", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed" + ], + "invokes": [ + "seat:mesh-catalog.seat-definitions", + "seat:mesh-catalog.entry", + "seat:mesh-module-assigner.assignments", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-broker.show", + "seat:mesh-broker.snapshot-get", + "seat:mesh-broker.snapshot-restore", + "seat:mesh-broker.snapshot-restore-cancel", + "seat:node-backup.restore", + "seat:mesh-recovery.kept-points", + "seat:mesh-recovery.restore-aside", + "seat:mesh-recovery.cancel", + "seat:mesh-recovery.take", + "seat:mesh-recovery.restore", + "seat:mesh-recovery.retry", + "seat:mesh-recovery.aside", + "seat:mesh-recovery.discard-aside", + "seat:mesh-recovery.expire-points" + ], + "requires": [ + { + "name": "digests", + "storage": "key-value", + "template": "state" + }, + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "bounds", + "storage": "key-value", + "template": "state", + "options": { + "key-ttl": true + } + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ], + "config": { + "points-cap": { + "type": "number", + "description": "bytes the points directory may hold; an act that would pass it ends failed, naming it, before it removes anything (design 47 G section 564).", + "minimum": 1, + "trusted": false, + "default": 10737418240 + }, + "points-filling-mark": { + "type": "number", + "description": "percent of the cap past which the finding points-filling is written (design 47 G section 564).", + "minimum": 1, + "maximum": 100, + "trusted": false, + "default": 80 + }, + "point-keep-days": { + "type": "number", + "description": "days after which a restore point is removed, the newest of its kept data never (design 47 G sections 551, 557).", + "minimum": 0.01, + "maximum": 3650, + "trusted": false, + "default": 90 + }, + "dump-wait-minutes": { + "type": "number", + "description": "minutes an act waits on the dump of the bus's item before recovery-waits is written (design 47 G sections 561, 557).", + "minimum": 0.01, + "maximum": 10080, + "trusted": false, + "default": 60 + }, + "snapshot-restore-wait-minutes": { + "type": "number", + "description": "minutes a restore in place of a protected keeper's snapshot is waited on, and once more after its cancel (design 47 G section 681, A-138, A-140).", + "minimum": 0.01, + "maximum": 10080, + "trusted": false, + "default": 90 + }, + "expire-every-hours": { + "type": "number", + "description": "hours between two removals of the points past their keep days, beside the one at the start and at each snapshot-kept; timed by a bound key of the state bounds (design 47 G sections 551, 557, A-138).", + "minimum": 0.01, + "maximum": 8760, + "trusted": false, + "default": 24 + } + }, + "data": { + "own": [ + { + "id": "points", + "path": "${dir:points}", + "class": "valuable", + "why": "the restore points taken of modules' kept data before a form change, and the asides of live data set aside before a restore (design 47 G sections 516, 554)" + } + ] + }, + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "mesh-recovery", + "resources": [ + { + "id": "account", + "type": "user", + "name": "mesh-recovery", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh-recovery" + }, + { + "id": "state", + "type": "directory", + "mode": "0700", + "owner": "mesh-recovery", + "place": ".", + "unknown": "program" + }, + { + "id": "points", + "type": "directory", + "path": "/var/lib/mesh-recovery/points", + "mode": "0700", + "owner": "mesh-recovery", + "unknown": "program" + }, + { + "id": "cap", + "type": "file", + "path": "${dir:state}/points-cap", + "owner": "mesh-recovery", + "mode": "0600", + "template": "files/points-cap" + }, + { + "id": "mark", + "type": "file", + "path": "${dir:state}/points-filling-mark", + "owner": "mesh-recovery", + "mode": "0600", + "template": "files/points-filling-mark" + }, + { + "id": "keep-days", + "type": "file", + "path": "${dir:state}/point-keep-days", + "owner": "mesh-recovery", + "mode": "0600", + "template": "files/point-keep-days" + }, + { + "id": "dump-wait", + "type": "file", + "path": "${dir:state}/dump-wait-minutes", + "owner": "mesh-recovery", + "mode": "0600", + "template": "files/dump-wait-minutes" + }, + { + "id": "restore-wait", + "type": "file", + "path": "${dir:state}/snapshot-restore-wait-minutes", + "owner": "mesh-recovery", + "mode": "0600", + "template": "files/snapshot-restore-wait-minutes" + }, + { + "id": "expire-every", + "type": "file", + "path": "${dir:state}/expire-every-hours", + "owner": "mesh-recovery", + "mode": "0600", + "template": "files/expire-every-hours" + }, + { + "id": "recovery", + "type": "process", + "name": "mesh-recovery", + "artifact": "program", + "run": [ + "./mesh-recovery" + ], + "env": { + "MESH_BROKER_FILE": "${dir:state}/broker", + "MESH_RECOVERY_POINTS": "${dir:points}", + "MESH_RECOVERY_POINTS_CAP_FILE": "${dir:state}/points-cap", + "MESH_RECOVERY_FILLING_MARK_FILE": "${dir:state}/points-filling-mark", + "MESH_RECOVERY_KEEP_DAYS_FILE": "${dir:state}/point-keep-days", + "MESH_RECOVERY_DUMP_WAIT_FILE": "${dir:state}/dump-wait-minutes", + "MESH_RECOVERY_RESTORE_WAIT_FILE": "${dir:state}/snapshot-restore-wait-minutes", + "MESH_RECOVERY_EXPIRE_EVERY_FILE": "${dir:state}/expire-every-hours" + }, + "user": "mesh-recovery", + "serves": [ + "seat:mesh-recovery.snapshot-kept", + "seat:mesh-recovery.restore-kept", + "seat:mesh-recovery.kept-points", + "seat:mesh-recovery.restore-aside", + "seat:mesh-recovery.cancel", + "seat:mesh-recovery.take", + "seat:mesh-recovery.restore", + "seat:mesh-recovery.retry", + "seat:mesh-recovery.aside", + "seat:mesh-recovery.discard-aside", + "seat:mesh-recovery.expire-points" + ], + "bus": { + "invokes": [ + "seat:mesh-catalog.seat-definitions", + "seat:mesh-catalog.entry", + "seat:mesh-module-assigner.assignments", + "seat:mesh-hand-acts.hand-act", + "seat:mesh-broker.show", + "seat:mesh-broker.snapshot-get", + "seat:mesh-broker.snapshot-restore", + "seat:mesh-broker.snapshot-restore-cancel", + "seat:node-backup.restore" + ] + }, + "health": { + "kind": "unit" + } + } + ], + "runtime-health": { + "kind": "tool", + "tool": "recovery_kept_points", + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "180s" + }, + "build": { + "artifacts": [ + { + "name": "program", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-recovery", + "binary": "mesh-recovery" + }, + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-recovery-tools", + "binary": "mesh-recovery-tools", + "loads": [ + "mesh-recovery-tools" + ] + }, + { + "name": "files", + "kind": "archive", + "from": "files" + } + ] + } +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-self-check/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-self-check/module.json.captured new file mode 100644 index 000000000..ec9dfb550 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-self-check/module.json.captured @@ -0,0 +1,123 @@ +{ + "module": "mesh-self-check", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-catalog/modules/restic/backupgood": "0.1", + "git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings": "0.1" + }, + "runs-as": "mesh-self-check", + "claims": [ + { + "name": "mesh-self-check", + "scope": "mesh", + "serves": [ + "doctor", + "probes" + ] + } + ], + "invokes": [ + "nats.nats_streams", + "nats.nats_closed_connections", + "seat:mesh-watchdogs.signals", + "seat:node-intrusion-prevention.banned", + "mesh-delivery-assigner.assigner_read_assignments", + "mesh-delivery-assigner.assigner_read_seat_holders", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-delivery.source", + "seat:mesh-hand-acts.hand-act", + "mesh-delivery-gate.gate_times" + ], + "reads": [ + "mesh-delivery-watchman.presence", + "mesh-host.health", + "disk-load.readings", + "restic.good" + ], + "consumes": [ + "mesh-delivery-assigner.views.assignments", + "mesh-delivery-assigner.views.seat-holders", + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-conditions.findings-asked" + ], + "state": [ + "verdict", + { + "name": "verdicts", + "ttl-seconds": 604800 + } + ], + "own-secrets": { + "broker": "${dir:state}/broker" + }, + "secrets-owner": "mesh-self-check", + "resources": [ + { + "id": "account", + "type": "user", + "name": "mesh-self-check", + "shell": "/usr/bin/nologin", + "home": "/var/lib/mesh-self-check" + }, + { + "id": "state", + "type": "directory", + "mode": "0700", + "owner": "mesh-self-check", + "place": ".", + "unknown": "program" + } + ], + "build": { + "artifacts": [ + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/mesh-self-check", + "binary": "mesh-self-check", + "loads": [ + "mesh-self-check" + ] + } + ] + }, + "config": { + "probes": { + "type": "list", + "description": "The ids of the probes that run, each judging one thing of the mesh (mesh-self-check.probes lists them with what each asserts). A probe not listed runs nothing and raises nothing, and what it raised before is cleared. D8 and DA are in the code and off by default.", + "trusted": true, + "default": [ + "D13", + "D-fill" + ], + "runtime": true + } + }, + "requires": [ + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ] +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-vault/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-vault/module.json.captured index 44944c952..1e9300a8e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-vault/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-vault/module.json.captured @@ -1,10 +1,17 @@ { "module": "mesh-vault", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-grants/grantsstate": "0.1" + }, "runs-as": "mesh-vault", "provides": [ { "name": "secret", + "credential": { + "form": "pair" + }, "scope": "mesh", "identity": { "in": "a vault entry" @@ -14,10 +21,37 @@ "emits": [ "provisioned", "rotated", - "secret-changed" + "secret-changed", + "account-hashed", + "own-replaced", + "account-issued", + "signed", + "rotation-begun", + "node-account-ready", + "rotation-done", + "own-retired" + ], + "invokes": [ + "seat:mesh-hand-acts.hand-acts", + "mesh-delivery-assigner.assigner_read_assignments", + "seat:anthropic-licence-manager.bindings" ], "reads": [ - "mesh-controller.assignments" + "node-engine.have", + "mesh-grants.accounts", + "mesh-provisioner.plans", + "mesh-provisioner.provisions" + ], + "state": [ + { + "name": "bus-accounts", + "history": 2 + }, + "signers", + "bound", + "node-logins", + "findings", + "licence-bindings" ], "receives": { "secret": "${dir:grants}/mesh.json" @@ -118,6 +152,18 @@ "unknown": "program" } ], + "streams": [ + { + "name": "mesh-vault-findings", + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 16 + } + ], "build": { "artifacts": [ { @@ -135,7 +181,8 @@ "MESH_VAULT_LEDGER": "${dir:ledger}", "MESH_VAULT_ROOT": "${dir:root}", "MESH_VAULT_STORE": "${dir:store}", - "MESH_VAULT_STATE": "${dir:state}" + "MESH_VAULT_STATE": "${dir:state}", + "MESH_VAULT_ENROLMENT_CALLERS": "mesh-enrolment" } } ] @@ -145,6 +192,11 @@ "secret_holders", "secret_verify", "secret_handed", + "own_handed", + "secret_own", + "account_hash", + "account_adopt", + "account_retire", "secret_asks", "secret_vault_export", "provisioner_retirement", @@ -152,7 +204,15 @@ "provisioner_retire_reject", "provisioner_delete", "vault_status", - "vault_health" + "vault_health", + "own_drift", + "own_take_switch", + "vault_signers", + "vault_signed", + "signers_reassert", + "node_logins", + "vault_first_views", + "vault_first_view_again" ], "claims": [ { @@ -160,14 +220,28 @@ "scope": "mesh", "serves": [ "get", - "accept", "secret-ask", "issued", "rotate", "move-in", "node-key", - "move-asks" + "own", + "issue-account", + "sign", + "enrolment-token", + "node-account", + "rotate-node", + "node-account-confirm", + "abandon", + "retire", + "licence-put", + "own-put" ] } + ], + "consumes": [ + "mesh-delivery-assigner.views.assignments", + "mesh-conditions.findings-asked", + "claude-licence-manager.binding.changed.*" ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-watcher/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-watcher/module.json.captured index e9543a5d3..23877ef24 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-watcher/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mesh-watcher/module.json.captured @@ -1,13 +1,17 @@ { "module": "mesh-watcher", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "watch", "consumes": [ - "mesh-controller.doctor-heartbeat" + "mesh-self-check.checked", + "mesh-delivery-assigner.views.seat-holders", + "mesh-conditions.findings-asked" ], "invokes": [ + "mesh-delivery-assigner.assigner_read_seat_holders", "mesh-watcher.watcher_ping", - "seat:mesh-controller.seats" + "seat:mesh-hand-acts.hand-act" ], "own-secrets": { "telegram-token": "${dir:state}/telegram-token" @@ -16,7 +20,9 @@ "watcher_status", "watcher_last_heard", "watcher_test", - "watcher_ping" + "watcher_ping", + "watcher_first_views", + "watcher_first_view_again" ], "config": { "telegram-chat-id": { @@ -39,7 +45,9 @@ "type": "file", "path": "${dir:state}/settings.json", "mode": "0600", - "takes-config": ["telegram-chat-id"], + "takes-config": [ + "telegram-chat-id" + ], "merge": "json", "template": "files/settings.json" } @@ -67,5 +75,26 @@ "from": "files" } ] - } + }, + "requires": [ + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/files/settings.json index 6d22854ac..7eaa42a2d 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/files/settings.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/files/settings.json @@ -1,5 +1,8 @@ { "time-zone": "", "only-what-needs-me": [], - "messages-per-hour": 100 + "messages-per-hour": 100, + "settle-seconds": 120, + "refused-kept": 20, + "readers": {"offered": ["mesh-knowledge"], "closed": ["mesh-knowledge"]} } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/module.json.captured index 604519581..4f89a31b8 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/messenger/module.json.captured @@ -1,6 +1,7 @@ { "module": "messenger", - "version": "1", + "version": "0.1", + "class": "core", "slug": "msgr", "runs-as": "messenger", "seats": [ @@ -74,10 +75,12 @@ "channel" ], "consumes": [ - "mesh-controller.condition-raised", - "mesh-controller.condition-changed", - "mesh-controller.condition-cleared", - "mesh-controller.plan-moved", + "mesh-conditions.condition-raised", + "mesh-conditions.condition-changed", + "mesh-conditions.condition-cleared", + "mesh-delivery-view.moving", + "mesh-delivery-view.settled", + "mesh-delivery-view.stuck", "intake.choice", "intake.link", "intake.failed", @@ -86,9 +89,22 @@ "emits": [ "refused" ], + "requires": [ + { + "name": "ask-events", + "storage": "stream", + "template": "events", + "options": { + "events": ["offered", "closed"], + "max-age-days": 7, + "max-mib": 64, + "grant": "readers" + } + } + ], "invokes": [ - "seat:mesh-controller.conditions", - "seat:mesh-controller.root-free", + "seat:mesh-conditions.conditions", + "seat:node-engine.root-free", "seat:issue-tracker.tracking" ], "state": [ @@ -115,6 +131,12 @@ "messenger_unlink" ], "config": { + "readers": { + "type": "object", + "description": "Who may hear an ask offered or closed (the stream of the asks, kept seven days), per event: offered and closed, each a list of module names, on every machine. The knowledge base alone by default, for its overview page; an asker's own answers (decided) are never on it (ADR 0616 §7).", + "trusted": true, + "default": {"offered": ["mesh-knowledge"], "closed": ["mesh-knowledge"]} + }, "time-zone": { "type": "string", "description": "The time zone every time a message says is said in, an IANA name such as Europe/Brussels; empty is this machine's own zone.", @@ -140,6 +162,22 @@ "maximum": 1000, "trusted": false, "default": 100 + }, + "refused-kept": { + "type": "number", + "description": "how many refused asks of one asker the router keeps as closed records, a whole number from 1 to 1000: the twenty-first refusal of an asker removes its oldest (design 47 G section 570).", + "minimum": 1, + "maximum": 1000, + "trusted": false, + "default": 20 + }, + "settle-seconds": { + "type": "number", + "description": "seconds a delivery that ended well still holds the messages about what it changed, so a problem that passes as the delivery settles is not sent (ADR 0505 §3); 0 holds nothing after the end.", + "minimum": 0, + "maximum": 3600, + "trusted": false, + "default": 120 } }, "resources": [ @@ -163,7 +201,7 @@ "type": "file", "path": "${dir:state}/settings.json", "mode": "0600", - "takes-config": ["time-zone", "desktop-machines", "only-what-needs-me", "messages-per-hour"], + "takes-config": ["time-zone", "desktop-machines", "only-what-needs-me", "messages-per-hour", "settle-seconds", "refused-kept", "readers"], "merge": "json", "template": "files/settings.json", "owner": "messenger" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/files/object-store.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/files/object-store.json new file mode 100644 index 000000000..d2970bcc8 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/files/object-store.json @@ -0,0 +1,6 @@ +{ + "scheme": "http", + "at": "${machine:at}", + "port": "${port:9000}", + "region": "eu-west" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/module.json.captured index 85b825308..956a69fb6 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/minio/module.json.captured @@ -1,6 +1,7 @@ { "module": "minio", - "version": "1", + "version": "0.1", + "class": "core", "upgrade": { "policy": "record", "why": "holds the photos themselves (irreplaceable, kept by photos) for its consumers: a person takes each build, after a backup (hq ADR 0236)" @@ -12,11 +13,59 @@ "identity": { "max": 20, "in": "an S3 access key" + }, + "credential": { + "form": "pair" } } ], "requires": [ - "route" + "route", + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ], + "seats": [ + { + "name": "object-store", + "scope": "mesh", + "serves": [ + "link" + ] + } + ], + "claims": [ + { + "name": "object-store", + "scope": "mesh", + "serves": [ + "link" + ] + } + ], + "invokes": [ + "mesh-delivery-assigner.assigner_read_seat_holders", + "seat:mesh-hand-acts.hand-act" + ], + "consumes": [ + "mesh-delivery-assigner.views.seat-holders", + "mesh-conditions.findings-asked" ], "contributes": { "route": { @@ -108,6 +157,13 @@ "mode": "0600", "template": "files/root.env" }, + { + "id": "object-store", + "type": "file", + "path": "${dir:state}/object-store.json", + "mode": "0600", + "template": "files/object-store.json" + }, { "id": "data", "type": "directory", @@ -173,11 +229,28 @@ "MESH_MINIO_ROOT_USER": "meshroot", "MESH_MINIO_ROOT_PASSWORD_FILE": "${dir:state}/root.secret", "MESH_MINIO_REGION": "eu-west", + "MESH_MINIO_LINKS": "${dir:state}/links", "MESH_MINIO_MC_BIN": "mcli", "MESH_MINIO_MC_CONFIG": "${dir:state}/mc", "MESH_RECEIVES": "${dir:grants}/mesh.json" } }, + { + "name": "tools-go", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/object-store", + "binary": "object-store", + "loads": [ + "object-store" + ], + "env": { + "OBJECT_STORE_CONFIG": "${dir:state}/object-store.json", + "MESH_MINIO_LINKS": "${dir:state}/links", + "MESH_RECEIVES": "${dir:grants}/mesh.json" + } + }, { "name": "files", "kind": "archive", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/model-usage/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/model-usage/module.json.captured index 50743a3cd..86ef6f202 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/model-usage/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/model-usage/module.json.captured @@ -1,6 +1,7 @@ { "module": "model-usage", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "usage", "capabilities": [ "container-runtime" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mongodb/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mongodb/module.json.captured index cbb12681d..27ab92027 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mongodb/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mongodb/module.json.captured @@ -1,6 +1,7 @@ { "module": "mongodb", - "version": "1", + "version": "0.1", + "class": "leaf", "upgrade": { "policy": "record", "why": "a provider whose restart drops every consumer on its machine, and which holds the photos' albums (irreplaceable, kept by photos): a person takes each build, after a backup (hq ADR 0236)" @@ -12,6 +13,9 @@ "identity": { "max": 63, "in": "a MongoDB database name" + }, + "credential": { + "form": "pair" } } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mosquitto/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mosquitto/module.json.captured index 21058e0ac..a8bb15153 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mosquitto/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mosquitto/module.json.captured @@ -1,6 +1,7 @@ { "module": "mosquitto", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "mosq", "provides": [ { @@ -8,6 +9,9 @@ "scope": "mesh", "identity": { "in": "a Mosquitto client and topic prefix" + }, + "credential": { + "form": "pair" } } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mounts/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mounts/module.json.captured index 488ebb976..2da577468 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mounts/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mounts/module.json.captured @@ -1,15 +1,17 @@ { "module": "mounts", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings": "0.1" + }, "requires": [ "nfs-share" ], "reads": [ + "disk-load.readings", "nfs-server.exports" ], - "invokes": [ - "seat:mesh-controller.data" - ], "capabilities": [ "package-manager", "service-manager" @@ -38,20 +40,20 @@ "per-machine": true } ], - "config": { - "shares": { - "type": "string", - "description": "The shares of another machine this machine mounts: space-separated name=mountpoint, each optionally :ro, or none (novox/hq ADR 0263 rule 5).", - "trusted": true, - "default": "none" - }, - "sources": { - "type": "string", - "description": "The occasional sources this machine mounts: space-separated name=smb://[@]/@ or name=disk:@, each optionally :ro, or none (novox/hq ADR 0263 rule 6); an SMB source's username is in its entry, its password the secret smb-password- (novox/hq ADR 0283).", - "trusted": true, - "default": "none" - } + "config": { + "shares": { + "type": "string", + "description": "The shares of another machine this machine mounts: space-separated name=mountpoint, each optionally :ro, or none (novox/hq ADR 0263 rule 5).", + "trusted": true, + "default": "none" }, + "sources": { + "type": "string", + "description": "The occasional sources this machine mounts: space-separated name=smb://[@]/@ or name=disk:@, each optionally :ro, or none (novox/hq ADR 0263 rule 6); an SMB source's username is in its entry, its password the secret smb-password- (novox/hq ADR 0283).", + "trusted": true, + "default": "none" + } + }, "own-secrets": { "smb-password-*": { "path": "${dir:state}/smb-password-*.secret", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mssql/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mssql/module.json.captured index ed4e44887..52f62daa9 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mssql/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/mssql/module.json.captured @@ -1,6 +1,7 @@ { "module": "mssql", - "version": "1", + "version": "0.1", + "class": "leaf", "upgrade": { "policy": "record", "why": "a provider whose restart drops every consumer on its machine, and whose new version may upgrade its databases in place: a person takes each build, after a backup (hq ADR 0236)" @@ -12,6 +13,9 @@ "identity": { "max": 128, "in": "a SQL Server login and database name" + }, + "credential": { + "form": "pair" } } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/n8n/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/n8n/module.json.captured index 975247faa..d67bc7a60 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/n8n/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/n8n/module.json.captured @@ -1,6 +1,7 @@ { "module": "n8n", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/files/settings.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/files/settings.json new file mode 100644 index 000000000..f973289e0 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/files/settings.json @@ -0,0 +1,4 @@ +{ + "snapshots-cap": 21474836480, + "snapshot-keep-days": 90 +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/module.json.captured index 3ad66bc38..bcc65be90 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nats/module.json.captured @@ -1,38 +1,160 @@ { "module": "nats", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-delivery/modules/mesh-grants/busgrants": "0.1" + }, "upgrade": { "policy": "record", - "why": "the bus: replaced only as a planned step a person starts (`bus upgrade`), its streams snapshotted first and checked after (hq ADR 0236); the controller holds this whatever is said here" + "why": "the bus keeps the streams of the whole mesh: each move waits for a person's yes, which the operator's Approve of the release that carries its build gives, and its node backs its streams up before it applies (hq ADR 0236, ADR 0601)" }, "provides": [ { "name": "mesh-bus", - "scope": "mesh" + "scope": "mesh", + "credential": { + "form": "none" + } + }, + { + "name": "bus-state", + "scope": "mesh", + "credential": { + "form": "none" + } } ], "claims": [ { "name": "mesh-broker", - "scope": "mesh" + "scope": "mesh", + "serves": [ + "list", + "show", + "check", + "orphans", + "snapshot-get", + "snapshot-restore", + "snapshot-restore-cancel", + "snapshot-remove" + ] } ], "bus-users": "/var/lib/nats-module/conf/accounts.conf", + "core-credentials": true, "own-secrets": { - "broker": "${dir:mesh-state}/broker" + "broker": "${dir:mesh-state}/broker", + "broker-nats-tools": "${dir:tools-secret}/broker-nats-tools", + "broker-keeper": { + "path": "${dir:keeper-state}/broker-keeper", + "owner": "nats-keeper" + } }, "capabilities": [ "container-runtime" ], - "emits": [], - "consumes": [], + "emits": [ + "consumer-removed", + "bucket-keys-removed", + "stream-removed", + "stream-purged", + "bucket-expiry-set", + "snapshot-restored" + ], + "invokes": [ + "seat:mesh-hand-acts.hand-act", + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-delivery.source", + "seat:mesh-catalog.seat-definitions" + ], + "consumes": [ + "mesh-catalog.catalog-revision", + "mesh-catalog.registration-changed", + "mesh-delivery.source-moved", + "mesh-catalog.seat-definition-changed", + "mesh-catalog.seat-definition-removed", + "mesh-conditions.findings-asked" + ], + "uses": [ + "operator-channel" + ], + "config": { + "snapshots-cap": { + "type": "number", + "description": "How many bytes the keeper's snapshots directory may hold (design 47 G §681): past 80 % of it the keeper tells a finding, and it never takes a snapshot past it. The keeper reads it at its start from its settings file.", + "minimum": 1, + "default": 21474836480 + }, + "snapshot-keep-days": { + "type": "number", + "description": "How many days a snapshot the keeper took before a drop or recreate, and its record, are kept (design 47 G §681, A-112). The keeper reads it at its start from its settings file; the tool nats_snapshots reads it as its configuration.", + "minimum": 1, + "default": 90 + } + }, + "streams": [ + { + "name": "broker-events", + "events": [ + "created", + "refused", + "drifted", + "drift-cleared", + "full", + "full-cleared", + "orphaned", + "recreated", + "dropped" + ], + "retention": "history", + "max-mib": 256 + }, + { + "name": "nats-findings", + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 16 + } + ], + "state": [ + { + "name": "asked", + "history": 5 + }, + { + "name": "requests", + "history": 5, + "ttl-seconds": 7862400 + }, + { + "name": "spent", + "history": 1, + "ttl-seconds": 86400, + "read-only": true + }, + { + "name": "plans", + "history": 1, + "read-only": true + }, + { + "name": "findings", + "history": 1 + } + ], "listens": [ { "name": "bus", "port": 4222, "protocol": "tcp", "from": "mesh", - "why": "the mesh bus — every link the mesh has, over TLS, reached across the overlay" + "why": "the mesh bus \u2014 every link the mesh has, over TLS, reached across the overlay" } ], "tools": [ @@ -42,9 +164,28 @@ "nats_subscriptions", "nats_streams", "nats_backlog", + "nats_consumer", + "nats_consumers", + "nats_stream_messages", "nats_buckets", "nats_users", - "nats_user_can" + "nats_user_can", + "nats_snapshot_verify", + "nats_consumer_remove", + "nats_bucket_remove", + "nats_stream_remove", + "nats_stream_purge", + "nats_bucket_expiry", + "nats_history", + "nats_create", + "nats_apply", + "nats_recreate", + "nats_drop", + "nats_keeper_health", + "nats_first_view_again", + "nats_requests", + "nats_snapshots", + "nats_plans" ], "guards": [ 8222 @@ -57,7 +198,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": "p=${dir:snapshots}/bus.tar.partial; s=0; docker exec -i mesh-broker-nats /opt/mesh/mesh-nats-snapshot snapshot < ${dir:mesh-state}/broker > \"$p\" || s=$?; if [ $s -ne 0 ]; then echo \"mesh-nats-snapshot snapshot exited $s$([ $s -eq 137 -o $s -eq 143 ] && echo ' (killed by a signal)')\" >&2; docker inspect -f 'container {{.State.Status}} since {{.State.StartedAt}}' mesh-broker-nats >&2; rm -f \"$p\"; exit $s; fi; mv \"$p\" ${dir:snapshots}/bus.tar || 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" @@ -71,6 +212,13 @@ ] }, "resources": [ + { + "id": "keeper-account", + "type": "user", + "name": "nats-keeper", + "shell": "/usr/bin/nologin", + "home": "/var/lib/nats-keeper" + }, { "id": "jetstream-data", "type": "directory", @@ -85,6 +233,21 @@ "mode": "0700", "unknown": "program" }, + { + "id": "tools-secret", + "type": "directory", + "path": "/var/lib/mesh/nats-tools", + "mode": "0711", + "unknown": "program" + }, + { + "id": "keeper-state", + "type": "directory", + "path": "/var/lib/nats-keeper", + "mode": "0700", + "owner": "nats-keeper", + "unknown": "program" + }, { "id": "snapshots", "type": "directory", @@ -98,6 +261,20 @@ "place": "mesh", "unknown": "program" }, + { + "id": "keeper-settings", + "trusted": false, + "type": "file", + "path": "${dir:keeper-state}/settings.json", + "mode": "0600", + "owner": "nats-keeper", + "takes-config": [ + "snapshots-cap", + "snapshot-keep-days" + ], + "merge": "json", + "template": "files/settings.json" + }, { "id": "server-conf", "type": "file", @@ -105,6 +282,76 @@ "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": "keeper", + "type": "process", + "name": "nats-keeper", + "artifact": "tools", + "run": [ + "./nats-tools", + "keep" + ], + "user": "nats-keeper", + "env": { + "MESH_BROKER_FILE": "${dir:keeper-state}/broker-keeper", + "MESH_NATS_FULL_RAISE": "75", + "MESH_NATS_FULL_CLEAR": "70", + "MESH_NATS_SNAPSHOTS_DIR": "${dir:keeper-state}" + }, + "serves": [ + "seat:mesh-broker.snapshot-get", + "seat:mesh-broker.snapshot-restore", + "seat:mesh-broker.snapshot-restore-cancel", + "seat:mesh-broker.snapshot-remove" + ], + "bus": { + "state": [ + "asked", + "requests", + "spent", + "plans", + "findings" + ], + "asks": true, + "keeps": true, + "invokes": [ + "seat:mesh-catalog.revision", + "seat:mesh-catalog.registrations", + "seat:mesh-delivery.source", + "seat:mesh-catalog.seat-definitions", + "seat:mesh-hand-acts.hand-act" + ] + }, + "health": { + "kind": "tool", + "tool": "nats_keeper_health", + "interval": "60s", + "timeout": "10s", + "looks": 2, + "grace": "180s" + } + }, { "id": "server", "type": "container", @@ -116,9 +363,23 @@ "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" + ], + "health": { + "kind": "tcp", + "endpoint": "bus" + } } ], "accesses": [ @@ -129,21 +390,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", @@ -155,10 +419,17 @@ "loads": [ "nats-tools" ], + "bus": { + "removes": [ + "controller-leftovers" + ] + }, "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}", + "NATS_TOOLS_CREDENTIAL": "${dir:tools-secret}/broker-nats-tools" } }, { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/netcheck/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/netcheck/module.json.captured index ec01003a8..ba762203c 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/netcheck/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/netcheck/module.json.captured @@ -1,6 +1,7 @@ { "module": "netcheck", - "version": "1", + "version": "0.1", + "class": "leaf", "emits": [ "tunnel.endpoint-changed", "tunnel.handshake-stale", @@ -11,6 +12,7 @@ "netcheck_tcp", "netcheck_dns", "netcheck_http", + "netcheck_request", "netcheck_listening" ], "replaces": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/networkmanager/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/networkmanager/module.json.captured index 68ace345e..3433f40ba 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/networkmanager/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/networkmanager/module.json.captured @@ -1,6 +1,7 @@ { "module": "networkmanager", - "version": "1", + "version": "0.1", + "class": "core", "upgrade": { "policy": "record", "why": "the machine's network: a build that breaks it can cut the machine off from the bus, and then neither the gate's rollback nor a push reaches it (hq ADR 0236)" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud-client/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud-client/module.json.captured index af71acbbb..5b603e465 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud-client/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud-client/module.json.captured @@ -1,6 +1,7 @@ { "module": "nextcloud-client", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/files/config.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/files/config.json index 0967ef424..fe0323434 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/files/config.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/files/config.json @@ -1 +1,6 @@ -{} +{ + "onlyofficeUrl": "${bound:document-server:public-root}", + "onlyofficeInternalUrl": "http://${bound:document-server:at}:${bound:document-server:port}/", + "onlyofficeStorageUrl": "https://${bound:route:name}/", + "onlyofficeSecret": "${secret:document-server}" +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/module.json.captured index 2854a160c..c4efbe8a4 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nextcloud/module.json.captured @@ -1,11 +1,13 @@ { "module": "nextcloud", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "ncloud", "requires": [ "postgres-database", "s3-bucket", - "route" + "route", + "document-server" ], "contributes": { "postgres-database": { @@ -19,11 +21,13 @@ "binds": { "postgres-database": "${dir:state}/database.json", "s3-bucket": "${dir:state}/store.json", - "route": "${dir:state}/route.json" + "route": "${dir:state}/route.json", + "document-server": "${dir:state}/document-server.json" }, "secrets": { "postgres-database": "${dir:state}/database.secret", - "s3-bucket": "${dir:state}/store.secret" + "s3-bucket": "${dir:state}/store.secret", + "document-server": "${dir:state}/document-server.secret" }, "emits": [ "user.created", @@ -69,7 +73,7 @@ }, "user": { "type": "string", - "description": "The Nextcloud account the module's tools act as; empty is admin.", + "description": "The Nextcloud account the module's tools act as; empty is mesh-admin, the account the module makes and keeps for itself. Any other account is used as given and never repaired.", "trusted": true, "default": "" } @@ -134,6 +138,7 @@ "mode": "0600", "template": "files/config.json", "takes-config": ["container", "url", "user"], + "protected": ["onlyofficeSecret"], "merge": "json" } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nfs-server/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nfs-server/module.json.captured index f9994d16f..b3f027d18 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nfs-server/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nfs-server/module.json.captured @@ -1,6 +1,10 @@ { "module": "nfs-server", - "version": "1", + "version": "0.1", + "class": "core", + "packages": { + "git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings": "0.1" + }, "upgrade": { "policy": "record", "why": "the folders other machines mount: a build that breaks the exports leaves every client's mount hanging or refused, and the gate on this one machine does not see the clients (hq ADR 0236, ADR 0263)" @@ -13,7 +17,10 @@ { "name": "nfs-share", "scope": "mesh", - "identity": false + "identity": false, + "credential": { + "form": "none" + } } ], "data": { @@ -45,26 +52,23 @@ } ], "reads": [ + "disk-load.readings", "mounts.shares" ], - "invokes": [ - "seat:mesh-controller.seats", - "seat:mesh-controller.data" - ], - "config": { - "shares": { - "type": "string", - "description": "The folders this machine exports, as space-separated name=path; the operator's, with no default (novox/hq ADR 0263).", - "trusted": true, - "required": true - }, - "grants": { - "type": "string", - "description": "Which nodes may mount which share, and how: share=node:rw|ro[,node:rw|ro], entries separated by spaces, or none to export to no node whatever a node wants (novox/hq ADR 0263).", - "trusted": true, - "default": "none" - } + "config": { + "shares": { + "type": "string", + "description": "The folders this machine exports, as space-separated name=path; the operator's, with no default (novox/hq ADR 0263).", + "trusted": true, + "required": true }, + "grants": { + "type": "string", + "description": "Which nodes may mount which share, and how: share=node:rw|ro[,node:rw|ro], entries separated by spaces, or none to export to no node whatever a node wants (novox/hq ADR 0263).", + "trusted": true, + "default": "none" + } + }, "facts": { "machines": { "path": "/etc/nfs-server/machines", @@ -187,5 +191,34 @@ "from": "files" } ] - } + }, + "invokes": [ + "mesh-delivery-assigner.assigner_read_seat_holders", + "seat:mesh-hand-acts.hand-act" + ], + "consumes": [ + "mesh-delivery-assigner.views.seat-holders", + "mesh-conditions.findings-asked" + ], + "requires": [ + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nftables/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nftables/module.json.captured index b7b0c83fe..f4b31b727 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nftables/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nftables/module.json.captured @@ -1,6 +1,7 @@ { "module": "nftables", - "version": "1", + "version": "0.1", + "class": "core", "upgrade": { "policy": "record", "why": "the machine's packet filter: a build that breaks it can cut the machine off from the bus, and then neither the gate's rollback nor a push reaches it (hq ADR 0236)" @@ -15,10 +16,28 @@ "serves": [ "rules", "reload", - "remove" + "remove", + "allow", + "disallow", + "allowed" ] } ], + "requires": [ + { + "name": "allowances", + "storage": "key-value", + "template": "state", + "options": { + "history": 1, + "per-machine": true + } + } + ], + "invokes": [ + "seat:node-engine.converged", + "seat:mesh-hand-acts.hand-act" + ], "filtering": { "into": "/etc/nftables.conf" }, @@ -71,6 +90,15 @@ "tools": [ "firewall_rules" ], + "config": { + "allowances-max": { + "type": "number", + "description": "The most allowances this machine keeps, which allow refuses past (design 33 control-verbs §3): it keeps the rendered chain readable and allowed in one answer.", + "trusted": false, + "runtime": true, + "default": 100 + } + }, "build": { "artifacts": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nm-applet/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nm-applet/module.json.captured index 1c6764ef0..22f916059 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nm-applet/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nm-applet/module.json.captured @@ -1,6 +1,7 @@ { "module": "nm-applet", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/node-env/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/node-env/module.json.captured index 85fd7e57c..db48bb5f4 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/node-env/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/node-env/module.json.captured @@ -1,6 +1,7 @@ { "module": "node-env", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "claims": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodejs/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodejs/module.json.captured index c3573444a..0762ab3ac 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodejs/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodejs/module.json.captured @@ -1,13 +1,17 @@ { "module": "nodejs", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], "provides": [ { "name": "node-toolchain", - "reach": "machine" + "reach": "machine", + "credential": { + "form": "none" + } } ], "resources": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodered/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodered/module.json.captured index f8068dd1c..672625046 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodered/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/nodered/module.json.captured @@ -1,6 +1,7 @@ { "module": "nodered", - "version": "1", + "version": "0.1", + "class": "leaf", "emits": [ "flows.deployed" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ollama/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ollama/module.json.captured index 2d5fb48c3..690f62adc 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ollama/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ollama/module.json.captured @@ -1,13 +1,17 @@ { "module": "ollama", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], "provides": [ { "name": "model-access", - "scope": "node" + "scope": "node", + "credential": { + "form": "none" + } } ], "listens": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/files/server.env b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/files/server.env index 19fab119b..a92e1c8fe 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/files/server.env +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/files/server.env @@ -2,4 +2,5 @@ JWT_ENABLED=true JWT_SECRET=${secret:jwt} JWT_HEADER=Authorization JWT_IN_BODY=true +SECURE_LINK_SECRET=${secret:secure-link} ALLOW_PRIVATE_IP_ADDRESS=true diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/module.json.captured index 4af651f4d..98f530cf5 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/only-office/module.json.captured @@ -1,7 +1,24 @@ { "module": "only-office", - "version": "1", + "version": "0.1", + "class": "core", "slug": "office", + "provides": [ + { + "name": "document-server", + "scope": "mesh", + "credential": { + "own": "jwt" + } + } + ], + "serves": { + "document-server": { + "scheme": "http", + "port": 9070, + "public-root": "https://${bound:route:name}/" + } + }, "capabilities": [ "container-runtime" ], @@ -14,11 +31,60 @@ "endpoint": "web" } }, + "seats": [ + { + "name": "document-converter", + "scope": "mesh", + "serves": [ + "convert" + ] + } + ], + "claims": [ + { + "name": "document-converter", + "scope": "mesh", + "serves": [ + "convert" + ] + } + ], + "streams": [ + { + "name": "convert-asks", + "events": [ + "convert.asked" + ], + "max-age-days": 1, + "max-mib": 8, + "retention": "work-queue", + "max-deliveries": 3, + "duplicates": 24 + } + ], + "state": [ + { + "name": "convert-answers", + "ttl-seconds": 600 + } + ], "binds": { "route": "${dir:state}/route.json" }, "own-secrets": { - "jwt": "${dir:state}/jwt.secret" + "jwt": { + "path": "${dir:state}/jwt.secret", + "owner": "only-office-converter", + "taken": "at-start" + }, + "secure-link": { + "path": "${dir:state}/secure-link.secret", + "taken": "at-start" + }, + "broker-converter": { + "path": "${dir:state}/broker-converter.secret", + "owner": "only-office-converter" + } }, "listens": [ { @@ -39,7 +105,7 @@ }, { "id": "lib", - "path": "${dir:lib}", + "path": "${dir:server-lib}", "class": "rebuildable", "why": "the document server's working files" }, @@ -79,10 +145,16 @@ { "id": "state", "type": "directory", - "mode": "0700", + "mode": "0711", "place": ".", "unknown": "program" }, + { + "id": "converter-account", + "type": "user", + "name": "only-office-converter", + "shell": "/usr/bin/nologin" + }, { "id": "server-env", "type": "file", @@ -90,45 +162,58 @@ "mode": "0600", "template": "files/server.env" }, + { + "id": "box", + "type": "directory", + "mode": "0700", + "unknown": "program" + }, { "id": "logs", "type": "directory", + "path": "${dir:box}/logs", "mode": "0700", "unknown": "program" }, { "id": "data", "type": "directory", + "path": "${dir:box}/data", "mode": "0700", "unknown": "program" }, { - "id": "lib", + "id": "server-lib", "type": "directory", - "mode": "0700", + "path": "${dir:box}/lib", + "mode": "0711", "unknown": "program" }, { "id": "db", "type": "directory", + "path": "${dir:box}/db", "mode": "0700", "unknown": "program" }, { "id": "rabbitmq", "type": "directory", + "path": "${dir:box}/rabbitmq", "mode": "0700", "unknown": "program" }, { "id": "redis", "type": "directory", + "path": "${dir:box}/redis", "mode": "0700", "unknown": "program" }, { "id": "fonts", "type": "directory", + "path": "${dir:box}/fonts", "mode": "0700", "unknown": "program" }, @@ -152,17 +237,55 @@ "volumes": [ "${dir:logs}:/var/log/onlyoffice", "${dir:data}:/var/www/onlyoffice/Data", - "${dir:lib}:/var/lib/onlyoffice", + "${dir:server-lib}:/var/lib/onlyoffice", "${dir:db}:/var/lib/postgresql", "${dir:rabbitmq}:/var/lib/rabbitmq", "${dir:redis}:/var/lib/redis", "${dir:fonts}:/usr/share/fonts/truetype/custom" ], - "secrets-in-environment": "run-document-server.sh regenerates JWT_SECRET from the environment on every start and overwrites local.json; not convertible" + "secrets-in-environment": "run-document-server.sh regenerates JWT_SECRET and SECURE_LINK_SECRET from the environment on every start and overwrites local.json and nginx's ds.conf; not convertible" + }, + { + "id": "converter", + "type": "process", + "name": "only-office-converter", + "artifact": "tools", + "run": [ + "./only-office", + "converter" + ], + "user": "only-office-converter", + "env": { + "ONLY_OFFICE_BROKER": "${dir:state}/broker-converter.secret", + "ONLY_OFFICE_JWT": "${dir:state}/jwt.secret", + "ONLY_OFFICE_SERVER": "http://127.0.0.1:9070" + }, + "bus": { + "queues": [ + "convert-asks" + ], + "state": [ + "convert-answers" + ] + }, + "health": { + "kind": "unit" + } } ], "build": { "artifacts": [ + { + "name": "tools", + "kind": "bundle", + "language": "go", + "system": "arch", + "from": "cmd/only-office", + "binary": "only-office", + "loads": [ + "only-office" + ] + }, { "name": "files", "kind": "archive", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openai-consumer/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openai-consumer/module.json.captured index 2e98414ef..20d633cfa 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openai-consumer/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openai-consumer/module.json.captured @@ -1,6 +1,7 @@ { "module": "openai-consumer", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "openai", "capabilities": [ "container-runtime" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openrazer/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openrazer/module.json.captured index faa34f870..6e30f9513 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openrazer/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/openrazer/module.json.captured @@ -1,6 +1,7 @@ { "module": "openrazer", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/keeper.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/keeper.json new file mode 100644 index 000000000..8e340a943 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/keeper.json @@ -0,0 +1,5 @@ +{ + "upgrade-order": [], + "record-days": 180, + "round-start-minutes": 120 +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/mesh-pacman-weekly-upgrade.service b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/mesh-pacman-weekly-upgrade.service deleted file mode 100644 index 69741dd7a..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/mesh-pacman-weekly-upgrade.service +++ /dev/null @@ -1,12 +0,0 @@ -# Generated by the mesh. Do not edit — module pacman writes this file and replaces it at every push. -[Unit] -Description=Weekly full upgrade (the mesh's pacman module, ADR 0477) -Wants=network-online.target -After=network-online.target - -[Service] -# The upgrade pacman_upgrade runs (pacman -Syu --noconfirm), as a oneshot whose result is the module's health -# (pacman_upgrade_health). The mesh restarts no machine for an upgrade: a new kernel waits for the next restart. -Type=oneshot -Nice=10 -ExecStart=/usr/bin/pacman -Syu --noconfirm diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/mesh-pacman-weekly-upgrade.timer b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/mesh-pacman-weekly-upgrade.timer deleted file mode 100644 index a8a9b4d9d..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/mesh-pacman-weekly-upgrade.timer +++ /dev/null @@ -1,11 +0,0 @@ -# Generated by the mesh. Do not edit — module pacman writes this file and replaces it at every push. -[Unit] -Description=Weekly full upgrade, Saturday 04:00 local time on every node (the mesh's pacman module, ADR 0477) - -[Timer] -# The same moment on every node: no random delay. A node that was off or asleep then upgrades at its next start. -OnCalendar=Sat *-*-* 04:00:00 -Persistent=true - -[Install] -WantedBy=timers.target diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/reflector.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/reflector.conf index eb9e731b7..91bad4c7c 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/reflector.conf +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/files/reflector.conf @@ -1,7 +1,7 @@ -# The mesh's (module pacman, novox/hq to-be 42): how reflector refreshes the mirror list, weekly, -# through reflector.timer. Written whole at every push. Before the module, every machine's list was -# generated once and never again. ---save /etc/pacman.d/mirrorlist +# The mesh's (module pacman, novox/hq ADR 0585): the options reflector ranks the mesh's one mirror list with. +# The keeper of the node that opens a week's upgrade round runs reflector with them (and --info) and keeps only the +# mirrors as fresh as the newest; every node writes /etc/pacman.d/mirrorlist from that list. reflector's own timer +# stays disabled, and nothing here saves a list. Written whole at every push. --protocol https --country Belgium,Netherlands,Luxembourg,Germany,France --latest 20 diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/module.json.captured index ca1a81a30..580aaaa54 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/pacman/module.json.captured @@ -1,6 +1,7 @@ { "module": "pacman", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "package-manager", "service-manager" @@ -11,15 +12,74 @@ "scope": "node" } ], + "reads": [ + "mesh-host.packages" + ], + "uses": [ + "operator-channel" + ], + "config": { + "upgrade-order": { + "type": "list", + "description": "The nodes in the order they upgrade, each by its name: the first opens each week's round on Saturday at 04:00 local time, and each node upgrades after the one before it passed its after-upgrade check (novox/hq ADR 0508 §5). Empty: no round starts, and every node's health says why. Falls back to the mesh-level key of the same name.", + "trusted": true, + "predefined": "upgrade-order", + "default": [] + }, + "record-days": { + "type": "number", + "description": "How many days a package record taken before an upgrade is kept on the bus before it is deleted (novox/hq ADR 0508 §2); a rollback can return only to a record still kept.", + "minimum": 1, + "trusted": false, + "default": 180 + }, + "round-start-minutes": { + "type": "number", + "description": "How many minutes a node whose turn in the round came may take to start its upgrade before the round is said to stand still, in that node's and the waiting nodes' health (novox/hq ADR 0508 §6).", + "minimum": 1, + "trusted": false, + "default": 120 + } + }, + "own-secrets": { + "broker-keeper": { + "path": "${dir:state}/broker-keeper.secret", + "owner": "pacman-keeper" + } + }, + "state": [ + "installed", + "updates", + "runs", + "records", + "rounds", + "asks", + "mirrors" + ], + "emits": [ + "package.changed", + "upgrade.recorded", + "upgrade.kernel-held", + "upgrade.started", + "upgrade.finished", + "upgrade.failed", + "upgrade.checked", + "rollback.started", + "rollback.finished" + ], "tools": [ "pacman_search", "pacman_info", "pacman_installed", + "pacman_packages", "pacman_owns", "pacman_files", "pacman_updates", "pacman_upgrade", "pacman_upgrade_health", + "pacman_upgrades", + "pacman_rollback", + "pacman_round", "pacman_orphans", "pacman_remove_orphans", "pacman_cache", @@ -30,11 +90,6 @@ "pacman_config" ], "resources": [ - { - "id": "package", - "type": "package", - "package": "pacman" - }, { "id": "config", "type": "file", @@ -42,6 +97,11 @@ "mode": "0644", "template": "files/pacman.conf" }, + { + "id": "package", + "type": "package", + "package": "pacman" + }, { "id": "contrib", "type": "package", @@ -63,11 +123,8 @@ "id": "mirror-refresh", "type": "service", "unit": "reflector.timer", - "state": "running", - "boot": "enabled", - "health": { - "kind": "unit" - } + "state": "stopped", + "boot": "disabled" }, { "id": "cache-cleaning", @@ -80,29 +137,90 @@ } }, { - "id": "upgrade-service", - "type": "file", - "path": "/etc/systemd/system/mesh-pacman-weekly-upgrade.service", - "mode": "0644", - "template": "files/mesh-pacman-weekly-upgrade.service" + "id": "keeper-account", + "type": "user", + "name": "pacman-keeper", + "shell": "/usr/bin/nologin" }, { - "id": "upgrade-timer", - "type": "file", - "path": "/etc/systemd/system/mesh-pacman-weekly-upgrade.timer", - "mode": "0644", - "template": "files/mesh-pacman-weekly-upgrade.timer" + "id": "state", + "type": "directory", + "mode": "0711", + "place": "mesh", + "unknown": "program" }, { - "id": "weekly-upgrade", - "type": "service", - "unit": "mesh-pacman-weekly-upgrade.timer", - "state": "running", - "boot": "enabled", - "restart-on": [ - "upgrade-service", - "upgrade-timer" + "id": "keeper-config", + "type": "file", + "path": "${dir:state}/keeper.json", + "mode": "0644", + "takes-config": [ + "upgrade-order", + "record-days", + "round-start-minutes" ], + "merge": "json", + "template": "files/keeper.json", + "trusted": true + }, + { + "id": "root-helper", + "type": "process", + "name": "pacman-root", + "artifact": "tools", + "run": [ + "./pacman-tools", + "root" + ], + "env": { + "PACMAN_ROOT_SOCKET": "${dir:state}/root/helper.sock", + "PACMAN_ROOT_PEER": "pacman-keeper" + }, + "health": { + "kind": "unit" + } + }, + { + "id": "keeper", + "type": "process", + "name": "pacman-keeper", + "artifact": "tools", + "run": [ + "./pacman-tools", + "keeper" + ], + "user": "pacman-keeper", + "env": { + "PACMAN_KEEPER_BROKER": "${dir:state}/broker-keeper.secret", + "PACMAN_KEEPER_CONFIG": "${dir:state}/keeper.json", + "PACMAN_ROOT_SOCKET": "${dir:state}/root/helper.sock" + }, + "restart-on": [ + "keeper-config" + ], + "bus": { + "state": [ + "installed", + "updates", + "runs", + "records", + "rounds", + "asks", + "mirrors" + ], + "emits": [ + "package.changed", + "upgrade.recorded", + "upgrade.kernel-held", + "upgrade.started", + "upgrade.finished", + "upgrade.failed", + "upgrade.checked", + "rollback.started", + "rollback.finished" + ], + "asks": true + }, "health": { "kind": "tool", "tool": "pacman_upgrade_health", @@ -124,7 +242,10 @@ "binary": "pacman-tools", "loads": [ "pacman-tools" - ] + ], + "env": { + "PACMAN_KEEPER_CONFIG": "${dir:state}/keeper.json" + } }, { "name": "files", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-eef/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-eef/module.json.captured index 101bdc27a..6f9989e33 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-eef/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-eef/module.json.captured @@ -1,6 +1,7 @@ { "module": "photos-eef", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "eef", "capabilities": [ "container-runtime" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-filip/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-filip/module.json.captured index 9c1c83fac..c526f3818 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-filip/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/photos-filip/module.json.captured @@ -1,6 +1,7 @@ { "module": "photos-filip", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "filip", "capabilities": [ "container-runtime" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/picom/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/picom/module.json.captured index cfdc39702..bc61080d1 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/picom/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/picom/module.json.captured @@ -1,6 +1,7 @@ { "module": "picom", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/polychromatic/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/polychromatic/module.json.captured index 4d6ba4b33..8930b1469 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/polychromatic/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/polychromatic/module.json.captured @@ -1,6 +1,7 @@ { "module": "polychromatic", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "requires": [ "x11-display" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/postgres/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/postgres/module.json.captured index 919df4216..e41fab60c 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/postgres/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/postgres/module.json.captured @@ -1,6 +1,7 @@ { "module": "postgres", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "upgrade": { "policy": "record", @@ -9,6 +10,7 @@ "provides": [ { "name": "postgres-database", + "credential": {"form": "pair"}, "scope": "mesh", "identity": { "max": 63, @@ -61,8 +63,8 @@ "postgres-database": "${dir:grants}" }, "own-secrets": { - "superuser": "${dir:state}/superuser.secret", - "reader": "${dir:state}/reader.secret" + "superuser": "${dir:data}/superuser.secret", + "reader": "${dir:data}/reader.secret" }, "data": { "own": [ @@ -93,22 +95,31 @@ }, "resources": [ { - "id": "state", + "id": "data", "type": "directory", "mode": "0700", - "place": ".", + "place": "mesh", + "unknown": "program" + }, + { + "id": "state", + "type": "directory", + "path": "/var/lib/postgres", + "owner": "postgres", + "mode": "0700", "unknown": "program" }, { "id": "grants", "type": "directory", + "path": "${dir:data}/grants", "mode": "0700", "unknown": "program" }, { "id": "consumers", "type": "file", - "path": "${dir:state}/consumers.json", + "path": "${dir:data}/consumers.json", "mode": "0600", "template": "files/consumers.json" }, @@ -146,7 +157,7 @@ ], "volumes": [ "/var/lib/mesh-store:/var/lib/postgresql/data", - "${dir:state}/superuser.secret:/run/secrets/superuser:ro" + "${dir:data}/superuser.secret:/run/secrets/superuser:ro" ] }, { @@ -169,10 +180,10 @@ ], "env": { "MESH_PROVISION_POSTGRES": "postgres://postgres@127.0.0.1:${port:5432}/postgres?sslmode=disable", - "MESH_PROVISION_PASSWORD_FILE": "${dir:state}/superuser.secret", + "MESH_PROVISION_PASSWORD_FILE": "${dir:data}/superuser.secret", "MESH_RECEIVES": "${dir:grants}/mesh.json", - "MESH_POSTGRES_READER_PASSWORD_FILE": "${dir:state}/reader.secret", - "MESH_CONSUMERS_FILE": "${dir:state}/consumers.json" + "MESH_POSTGRES_READER_PASSWORD_FILE": "${dir:data}/reader.secret", + "MESH_CONSUMERS_FILE": "${dir:data}/consumers.json" } }, { @@ -186,6 +197,7 @@ "bound" ], "reads": [ - "mesh-controller.assignments" + "mesh-provisioner.plans", + "mesh-provisioner.provisions" ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/module.json.captured index a110d4109..e4b54f8f4 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/module.json.captured @@ -1,6 +1,7 @@ { "module": "power", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "templates": "templates", "capabilities": [ @@ -314,6 +315,48 @@ "mode": "0644", "template": "templates/systemd/system/suspend-then-hibernate.target.d/mesh-power.conf" }, + { + "id": "reboot-drop-ins", + "type": "directory", + "path": "/etc/systemd/system/reboot.target.d", + "mode": "0755", + "unknown": "program" + }, + { + "id": "reboot-bound", + "type": "file", + "path": "/etc/systemd/system/reboot.target.d/mesh-power.conf", + "mode": "0644", + "template": "templates/systemd/system/reboot.target.d/mesh-power.conf" + }, + { + "id": "poweroff-drop-ins", + "type": "directory", + "path": "/etc/systemd/system/poweroff.target.d", + "mode": "0755", + "unknown": "program" + }, + { + "id": "poweroff-bound", + "type": "file", + "path": "/etc/systemd/system/poweroff.target.d/mesh-power.conf", + "mode": "0644", + "template": "templates/systemd/system/poweroff.target.d/mesh-power.conf" + }, + { + "id": "halt-drop-ins", + "type": "directory", + "path": "/etc/systemd/system/halt.target.d", + "mode": "0755", + "unknown": "program" + }, + { + "id": "halt-bound", + "type": "file", + "path": "/etc/systemd/system/halt.target.d/mesh-power.conf", + "mode": "0644", + "template": "templates/systemd/system/halt.target.d/mesh-power.conf" + }, { "id": "udev-rule", "type": "file", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/halt.target.d/mesh-power.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/halt.target.d/mesh-power.conf new file mode 100644 index 000000000..569d7fd97 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/halt.target.d/mesh-power.conf @@ -0,0 +1,8 @@ +# Written by the mesh (module power, novox/hq ADR 0211; issue 1126). Replaced on every push. +# +# A shutdown is bounded at ten minutes, not systemd's thirty. A unit started again during the shutdown +# (on ace, 2026-10-28, the bus and the authorization manager) is never stopped a second time, and the +# shutdown then waits on this job's timeout with nothing on the console. The target keeps its own +# forcing action: the last phase still ends every process, unmounts and syncs. +[Unit] +JobTimeoutSec=10min diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/poweroff.target.d/mesh-power.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/poweroff.target.d/mesh-power.conf new file mode 100644 index 000000000..569d7fd97 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/poweroff.target.d/mesh-power.conf @@ -0,0 +1,8 @@ +# Written by the mesh (module power, novox/hq ADR 0211; issue 1126). Replaced on every push. +# +# A shutdown is bounded at ten minutes, not systemd's thirty. A unit started again during the shutdown +# (on ace, 2026-10-28, the bus and the authorization manager) is never stopped a second time, and the +# shutdown then waits on this job's timeout with nothing on the console. The target keeps its own +# forcing action: the last phase still ends every process, unmounts and syncs. +[Unit] +JobTimeoutSec=10min diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/reboot.target.d/mesh-power.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/reboot.target.d/mesh-power.conf new file mode 100644 index 000000000..569d7fd97 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/power/templates/systemd/system/reboot.target.d/mesh-power.conf @@ -0,0 +1,8 @@ +# Written by the mesh (module power, novox/hq ADR 0211; issue 1126). Replaced on every push. +# +# A shutdown is bounded at ten minutes, not systemd's thirty. A unit started again during the shutdown +# (on ace, 2026-10-28, the bus and the authorization manager) is never stopped a second time, and the +# shutdown then waits on this job's timeout with nothing on the console. The target keeps its own +# forcing action: the last phase still ends every process, unmounts and syncs. +[Unit] +JobTimeoutSec=10min diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/powerlevel10k/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/powerlevel10k/module.json.captured index da1bd4dfe..d719efb31 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/powerlevel10k/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/powerlevel10k/module.json.captured @@ -1,6 +1,7 @@ { "module": "powerlevel10k", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "resources": [ { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/records/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/records/module.json.captured index db6f7e5a9..a41fe6961 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/records/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/records/module.json.captured @@ -1,6 +1,7 @@ { "module": "records", - "version": "1", + "version": "0.1", + "class": "leaf", "slug": "records", "requires": [ "git" @@ -9,7 +10,7 @@ "git": "${dir:mesh-state}/git.json" }, "consumes": [ - "gitea.pull.merged" + "git.pull-merged" ], "tools": [ "records_search", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/redis/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/redis/module.json.captured index 58e11064b..357accec8 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/redis/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/redis/module.json.captured @@ -1,12 +1,16 @@ { "module": "redis", - "version": "1", + "version": "0.1", + "class": "leaf", "provides": [ { "name": "redis-cache", "scope": "mesh", "identity": { "in": "a Redis ACL user and key prefix" + }, + "credential": { + "form": "pair" } } ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/restic/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/restic/module.json.captured index 313d3e7de..1a006be0e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/restic/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/restic/module.json.captured @@ -1,6 +1,7 @@ { "module": "restic", "version": "0.1", + "class": "core", "packages": { "git.novox.be/novox/mesh-catalog/modules/disk-load/diskreadings": "0.1" }, @@ -261,7 +262,7 @@ "findings-stated.*" ], "max-age-days": 7, - "max-mib": 16 + "max-mib": 8 } } ] diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/rofi/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/rofi/module.json.captured index fbd061d01..1bba3a54f 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/rofi/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/rofi/module.json.captured @@ -1,6 +1,7 @@ { "module": "rofi", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/route-adapter/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/route-adapter/module.json.captured index 5234c78bb..ee7e27f74 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/route-adapter/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/route-adapter/module.json.captured @@ -1,6 +1,7 @@ { "module": "route-adapter", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "slug": "radapt", "capabilities": [ @@ -9,6 +10,7 @@ "provides": [ { "name": "route", + "credential": {"form": "none"}, "scope": "mesh", "identity": false } @@ -129,6 +131,7 @@ "bound" ], "reads": [ - "mesh-controller.assignments" + "mesh-provisioner.plans", + "mesh-provisioner.provisions" ] } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/screen-lock/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/screen-lock/module.json.captured index 1791c7986..5f184f289 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/screen-lock/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/screen-lock/module.json.captured @@ -1,6 +1,7 @@ { "module": "screen-lock", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/searxng/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/searxng/module.json.captured index cee18e4ef..14add9c82 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/searxng/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/searxng/module.json.captured @@ -1,6 +1,7 @@ { "module": "searxng", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sensors/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sensors/module.json.captured index 3df678384..79a476d6f 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sensors/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sensors/module.json.captured @@ -1,6 +1,7 @@ { "module": "sensors", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/showcase/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/showcase/module.json.captured index e657e2ab0..06fea3efc 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/showcase/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/showcase/module.json.captured @@ -1,6 +1,7 @@ { "module": "showcase", - "version": "1", + "version": "0.1", + "class": "core", "templates": "templates", "slug": "show", "capabilities": [ @@ -9,7 +10,10 @@ "provides": [ { "name": "greeting", - "scope": "mesh" + "scope": "mesh", + "credential": { + "form": "none" + } } ], "serves": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/slack/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/slack/module.json.captured index 9feeedb31..f791e2451 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/slack/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/slack/module.json.captured @@ -1,6 +1,7 @@ { "module": "slack", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "requires": [ "x11-display" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/snapd/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/snapd/module.json.captured index 93ad73073..cd5ecd1d3 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/snapd/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/snapd/module.json.captured @@ -1,6 +1,7 @@ { "module": "snapd", - "version": "1", + "version": "0.1", + "class": "leaf", "tools": [ "snapd_status", "snapd_list", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ssh-client/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ssh-client/module.json.captured index a6965445a..c4f8c3a91 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ssh-client/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/ssh-client/module.json.captured @@ -1,6 +1,7 @@ { "module": "ssh-client", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "tools": [ "ssh_client_hosts", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sshd/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sshd/module.json.captured index 066e058d2..b799d5a87 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sshd/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sshd/module.json.captured @@ -1,6 +1,7 @@ { "module": "sshd", - "version": "1", + "version": "0.1", + "class": "leaf", "upgrade": { "policy": "record", "why": "the operator's way into the machine when the mesh cannot reach it: a build that breaks it is found only when that way is needed, which no gate sees (hq ADR 0236)" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/step-ca/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/step-ca/module.json.captured index b11d2b990..887945e1f 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/step-ca/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/step-ca/module.json.captured @@ -1,13 +1,17 @@ { "module": "step-ca", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], "provides": [ { "name": "internal-acme-ca", - "scope": "mesh" + "scope": "mesh", + "credential": { + "form": "none" + } } ], "serves": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sudo/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sudo/module.json.captured index 364ce5fc9..019d9f992 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sudo/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/sudo/module.json.captured @@ -1,6 +1,7 @@ { "module": "sudo", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/supabase/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/supabase/module.json.captured index 14ddbcd56..e67fad8e2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/supabase/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/supabase/module.json.captured @@ -1,6 +1,7 @@ { "module": "supabase", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-networkd/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-networkd/module.json.captured index 0c4c109d7..5c0e60f68 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-networkd/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-networkd/module.json.captured @@ -1,6 +1,7 @@ { "module": "systemd-networkd", - "version": "1", + "version": "0.1", + "class": "core", "upgrade": { "policy": "record", "why": "the machine's network: a build that breaks it can cut the machine off from the bus, and then neither the gate's rollback nor a push reaches it (hq ADR 0236)" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-resolved/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-resolved/module.json.captured index b850afcfe..c62dbd7b4 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-resolved/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd-resolved/module.json.captured @@ -1,6 +1,7 @@ { "module": "systemd-resolved", - "version": "1", + "version": "0.1", + "class": "core", "upgrade": { "policy": "record", "why": "the machine's names: a build that breaks this resolver stops every name resolving on a machine a person works on, the bus's included, and then neither the gate's rollback nor a push reaches it (hq ADR 0236, ADR 0247)" @@ -8,7 +9,10 @@ "provides": [ { "name": "split-dns", - "reach": "machine" + "reach": "machine", + "credential": { + "form": "none" + } } ], "requires": [ @@ -49,7 +53,7 @@ "facts": { "kept": { "path": "/etc/node-resolver/resolv.conf", - "template": "# Managed by the mesh, and written by the module holding this machine's own resolver\n# (module systemd-resolved, novox/hq ADR 0247). On every other machine the module holding\n# the uplink writes this file, listing the mesh's resolvers (ADR 0223); here something\n# requires names routed by domain - a VPN client's domains to its own servers - so the file\n# names this machine's own resolver alone, which sends those domains over the VPN's link and\n# every other name to the mesh's resolvers. One server listed, so one answer per name.\n#\n# Its address on the private network, not loopback: a container copies this file, and\n# this address is one it can reach. Another program writing this file is put back by the\n# module's guard, which keeps what it wrote for whoever handles it on this machine.\n# Replaced on every push; edit nothing here.\n{{$own := \"\"}}{{range .Machines}}{{if eq .Name $.Node}}{{$own = .Address}}{{end}}{{end}}nameserver {{if $own}}{{$own}}{{else}}127.0.0.53{{end}}\noptions timeout:1 attempts:2 edns0\n" + "template": "# Managed by the mesh, and written by the module holding this machine's own resolver\n# (module systemd-resolved, novox/hq ADR 0247). On every other machine the module holding\n# the uplink writes this file, listing the mesh's resolvers (ADR 0223); here something\n# requires names routed by domain - a VPN client's domains to its own servers - so the file\n# names this machine's own resolver alone, which sends those domains over the VPN's link and\n# every other name to the mesh's resolvers. One server listed, so one answer per name.\n#\n# Its address on the private network, not loopback: a container copies this file, and\n# this address is one it can reach. Another program writing this file is put back by the\n# module's guard, which keeps what it wrote for whoever handles it on this machine.\n# Replaced on every push; edit nothing here.\n{{$own := \"\"}}{{range .Machines}}{{if eq .Name $.Node}}{{$own = .Address}}{{end}}{{end}}nameserver {{if $own}}{{$own}}{{else}}127.0.0.53{{end}}\noptions timeout:3 attempts:2 edns0\n" }, "resolved": { "path": "/etc/systemd/resolved.conf.d/50-mesh.conf", @@ -57,7 +61,7 @@ }, "resolvers": { "path": "/etc/resolv.conf", - "template": "# Managed by the mesh, and written by the module holding this machine's own resolver\n# (module systemd-resolved, novox/hq ADR 0247). On every other machine the module holding\n# the uplink writes this file, listing the mesh's resolvers (ADR 0223); here something\n# requires names routed by domain - a VPN client's domains to its own servers - so the file\n# names this machine's own resolver alone, which sends those domains over the VPN's link and\n# every other name to the mesh's resolvers. One server listed, so one answer per name.\n#\n# Its address on the private network, not loopback: a container copies this file, and\n# this address is one it can reach. Another program writing this file is put back by the\n# module's guard, which keeps what it wrote for whoever handles it on this machine.\n# Replaced on every push; edit nothing here.\n{{$own := \"\"}}{{range .Machines}}{{if eq .Name $.Node}}{{$own = .Address}}{{end}}{{end}}nameserver {{if $own}}{{$own}}{{else}}127.0.0.53{{end}}\noptions timeout:1 attempts:2 edns0\n" + "template": "# Managed by the mesh, and written by the module holding this machine's own resolver\n# (module systemd-resolved, novox/hq ADR 0247). On every other machine the module holding\n# the uplink writes this file, listing the mesh's resolvers (ADR 0223); here something\n# requires names routed by domain - a VPN client's domains to its own servers - so the file\n# names this machine's own resolver alone, which sends those domains over the VPN's link and\n# every other name to the mesh's resolvers. One server listed, so one answer per name.\n#\n# Its address on the private network, not loopback: a container copies this file, and\n# this address is one it can reach. Another program writing this file is put back by the\n# module's guard, which keeps what it wrote for whoever handles it on this machine.\n# Replaced on every push; edit nothing here.\n{{$own := \"\"}}{{range .Machines}}{{if eq .Name $.Node}}{{$own = .Address}}{{end}}{{end}}nameserver {{if $own}}{{$own}}{{else}}127.0.0.53{{end}}\noptions timeout:3 attempts:2 edns0\n" }, "suffix": { "path": "/etc/node-resolver/suffix", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd/module.json.captured index 984ccf3aa..2f3cff730 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/systemd/module.json.captured @@ -1,6 +1,7 @@ { "module": "systemd", - "version": "1", + "version": "0.1", + "class": "core", "capabilities": [ "service-manager", "package-manager" @@ -18,6 +19,7 @@ "enable", "disable", "journal", + "kernel-log", "failed", "reset-failed", "wanted-by", @@ -41,7 +43,7 @@ "systemd-tools" ], "env": { - "MESH_SYSTEMD_STATE": "${dir:state}" + "MESH_SYSTEMD_STATE": "${dir:data}" } } ] @@ -53,10 +55,18 @@ "package": "systemd" }, { - "id": "state", + "id": "data", "type": "directory", "mode": "0700", - "place": ".", + "place": "mesh", + "unknown": "program" + }, + { + "id": "state", + "type": "directory", + "path": "/var/lib/systemd", + "owner": "root", + "mode": "0755", "unknown": "program" } ] diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/telegram/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/telegram/module.json.captured index 95ae6f1b2..22304d74c 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/telegram/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/telegram/module.json.captured @@ -1,6 +1,7 @@ { "module": "telegram", - "version": "1", + "version": "0.1", + "class": "core", "slug": "tgrm", "runs-as": "telegram", "claims": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/time-sync/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/time-sync/module.json.captured index c3d9b0c52..de09c9e59 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/time-sync/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/time-sync/module.json.captured @@ -1,6 +1,7 @@ { "module": "time-sync", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager", "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/triggerhappy/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/triggerhappy/module.json.captured index 18faaf4b9..babb95e7b 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/triggerhappy/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/triggerhappy/module.json.captured @@ -1,6 +1,7 @@ { "module": "triggerhappy", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "service-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/umami/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/umami/module.json.captured index 22ead4197..d1c618a88 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/umami/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/umami/module.json.captured @@ -1,6 +1,7 @@ { "module": "umami", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], @@ -32,7 +33,10 @@ "provides": [ { "name": "analytics", - "scope": "mesh" + "scope": "mesh", + "credential": { + "form": "none" + } } ], "serves": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/unifi/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/unifi/module.json.captured index 2ee5cf49f..c9f09c7e5 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/unifi/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/unifi/module.json.captured @@ -1,6 +1,7 @@ { "module": "unifi", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/website/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/website/module.json.captured index 481cfc665..07970c19e 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/website/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/website/module.json.captured @@ -1,6 +1,7 @@ { "module": "website", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "container-runtime" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xclip/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xclip/module.json.captured index bf06f6fa3..a094b45ed 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xclip/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xclip/module.json.captured @@ -1,6 +1,7 @@ { "module": "xclip", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xdg/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xdg/module.json.captured index c3d191ac3..72b0650a2 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xdg/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xdg/module.json.captured @@ -1,6 +1,7 @@ { "module": "xdg", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ "package-manager" ], diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xorg/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xorg/module.json.captured index 7b0b6b1e7..26550fec3 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xorg/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xorg/module.json.captured @@ -1,6 +1,7 @@ { "module": "xorg", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager", @@ -9,7 +10,10 @@ "provides": [ { "name": "x11-display", - "reach": "machine" + "reach": "machine", + "credential": { + "form": "none" + } } ], "claims": [ diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/files/xresources-normal b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/files/xresources-normal index d95ee3b9a..8867c3139 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/files/xresources-normal +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/files/xresources-normal @@ -1,31 +1,31 @@ ! xterm: the face, the palette and the clipboard keys. Scoped to the XTerm class, so they ! outrank any `*name` resource of yours and touch no other X program. -XTerm*termName: xterm-256color -XTerm*saveLines: 10000 -XTerm*renderFont: true -XTerm*faceName: JetBrainsMono Nerd Font -XTerm*faceSize: 12 -XTerm*boldMode: false -XTerm*alwaysBoldMode: false -XTerm*allowBoldFonts: true -XTerm*background: #000000 -XTerm*foreground: #a8a8a8 -XTerm*color0: #000000 -XTerm*color8: #666666 -XTerm*color1: #9e1828 -XTerm*color9: #bc5766 -XTerm*color2: #008800 -XTerm*color10: #61a171 -XTerm*color3: #d2bb4b -XTerm*color11: #e7db52 -XTerm*color4: #414171 -XTerm*color12: #5085af -XTerm*color5: #963c59 -XTerm*color13: #a97a99 -XTerm*color6: #418179 -XTerm*color14: #6ba4a4 -XTerm*color7: #bebebe -XTerm*color15: #ffffff +XTerm*termName: ${config:term-name} +XTerm*saveLines: ${config:save-lines} +XTerm*renderFont: ${config:render-font} +XTerm*faceName: ${config:face} +XTerm*faceSize: ${config:size} +XTerm*boldMode: ${config:bold-mode} +XTerm*alwaysBoldMode: ${config:always-bold-mode} +XTerm*allowBoldFonts: ${config:allow-bold-fonts} +XTerm*background: ${config:background} +XTerm*foreground: ${config:foreground} +XTerm*color0: ${config:color0} +XTerm*color8: ${config:color8} +XTerm*color1: ${config:color1} +XTerm*color9: ${config:color9} +XTerm*color2: ${config:color2} +XTerm*color10: ${config:color10} +XTerm*color3: ${config:color3} +XTerm*color11: ${config:color11} +XTerm*color4: ${config:color4} +XTerm*color12: ${config:color12} +XTerm*color5: ${config:color5} +XTerm*color13: ${config:color13} +XTerm*color6: ${config:color6} +XTerm*color14: ${config:color14} +XTerm*color7: ${config:color7} +XTerm*color15: ${config:color15} XTerm*VT100.Translations: #override \n\ - Ctrl Shift ~Alt C: copy-selection(CLIPBOARD) \n\ - Ctrl Shift ~Alt V: insert-selection(CLIPBOARD) + ${config:copy-binding}: copy-selection(CLIPBOARD) \n\ + ${config:paste-binding}: insert-selection(CLIPBOARD) diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/module.json.captured index e6a565ac8..195510057 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/xterm/module.json.captured @@ -1,6 +1,7 @@ { "module": "xterm", - "version": "1", + "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" @@ -21,6 +22,175 @@ "xterm_font", "xterm_colours" ], + "config": { + "face": { + "type": "string", + "description": "The font family xterm draws with, as fc-list names it: JetBrainsMono Nerd Font, because research 026/04 chose it for its glyphs the prompt uses. A family the machine does not have falls back to the nearest installed face (xterm_font says which).", + "pattern": "[A-Za-z0-9 ._-]{1,64}", + "default": "JetBrainsMono Nerd Font" + }, + "size": { + "type": "number", + "description": "The size of xterm's text, in points: 12 reads well on a screen of about 100 DPI, and a denser screen needs a larger size.", + "minimum": 6, + "maximum": 72, + "predefined": "font-size", + "default": 12 + }, + "save-lines": { + "type": "number", + "description": "How many lines of scrollback xterm keeps per terminal: 10000 holds a long build log, and each line costs memory in every open terminal.", + "minimum": 0, + "maximum": 1000000, + "default": 10000 + }, + "term-name": { + "type": "string", + "description": "The TERM value xterm sets for the programs it runs: xterm-256color, because the palette has 256 colours and every program knows the name.", + "pattern": "[A-Za-z0-9._-]{1,64}", + "default": "xterm-256color" + }, + "render-font": { + "type": "boolean", + "description": "Whether xterm draws with fontconfig faces (true) or the old X core fonts (false): true, because the face is a fontconfig family and core fonts cannot show it.", + "default": true + }, + "bold-mode": { + "type": "boolean", + "description": "Whether xterm draws bold text by overstriking the normal face (true): false, because the face has a real bold style and overstriking blurs it.", + "default": false + }, + "always-bold-mode": { + "type": "boolean", + "description": "Whether xterm overstrikes bold even where the face has a bold style (true): false, for the same reason as bold-mode.", + "default": false + }, + "allow-bold-fonts": { + "type": "boolean", + "description": "Whether xterm may use the face's bold style for bold text (true): true, so bold text is drawn with the real bold weight.", + "default": true + }, + "background": { + "type": "string", + "description": "The terminal's background colour, as #rrggbb: black, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#000000" + }, + "foreground": { + "type": "string", + "description": "The terminal's text colour, as #rrggbb: a light grey, easier on the eyes than white on black.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#a8a8a8" + }, + "color0": { + "type": "string", + "description": "Palette entry 0, the normal black, as #rrggbb: #000000, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#000000" + }, + "color1": { + "type": "string", + "description": "Palette entry 1, the normal red, as #rrggbb: #9e1828, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#9e1828" + }, + "color2": { + "type": "string", + "description": "Palette entry 2, the normal green, as #rrggbb: #008800, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#008800" + }, + "color3": { + "type": "string", + "description": "Palette entry 3, the normal yellow, as #rrggbb: #d2bb4b, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#d2bb4b" + }, + "color4": { + "type": "string", + "description": "Palette entry 4, the normal blue, as #rrggbb: #414171, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#414171" + }, + "color5": { + "type": "string", + "description": "Palette entry 5, the normal magenta, as #rrggbb: #963c59, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#963c59" + }, + "color6": { + "type": "string", + "description": "Palette entry 6, the normal cyan, as #rrggbb: #418179, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#418179" + }, + "color7": { + "type": "string", + "description": "Palette entry 7, the normal white, as #rrggbb: #bebebe, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#bebebe" + }, + "color8": { + "type": "string", + "description": "Palette entry 8, the bright black, as #rrggbb: #666666, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#666666" + }, + "color9": { + "type": "string", + "description": "Palette entry 9, the bright red, as #rrggbb: #bc5766, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#bc5766" + }, + "color10": { + "type": "string", + "description": "Palette entry 10, the bright green, as #rrggbb: #61a171, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#61a171" + }, + "color11": { + "type": "string", + "description": "Palette entry 11, the bright yellow, as #rrggbb: #e7db52, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#e7db52" + }, + "color12": { + "type": "string", + "description": "Palette entry 12, the bright blue, as #rrggbb: #5085af, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#5085af" + }, + "color13": { + "type": "string", + "description": "Palette entry 13, the bright magenta, as #rrggbb: #a97a99, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#a97a99" + }, + "color14": { + "type": "string", + "description": "Palette entry 14, the bright cyan, as #rrggbb: #6ba4a4, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#6ba4a4" + }, + "color15": { + "type": "string", + "description": "Palette entry 15, the bright white, as #rrggbb: #ffffff, as both workstations ran it.", + "pattern": "#[0-9a-fA-F]{6}", + "default": "#ffffff" + }, + "copy-binding": { + "type": "string", + "description": "The key combination that copies the selection to the clipboard, in X translation syntax: Ctrl Shift ~Alt C, so a plain Ctrl+C still interrupts the program. It holds no colon, backslash or line break, which would end the resource.", + "pattern": "[^:\\\\\\n]+", + "default": "Ctrl Shift ~Alt C" + }, + "paste-binding": { + "type": "string", + "description": "The key combination that pastes the clipboard, in X translation syntax: Ctrl Shift ~Alt V, the pair of copy-binding. It holds no colon, backslash or line break, which would end the resource.", + "pattern": "[^:\\\\\\n]+", + "default": "Ctrl Shift ~Alt V" + } + }, "items": [ { "collection": "environment", diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/all-syslog.sh b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/all-syslog.sh new file mode 100644 index 000000000..5f601144a --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/all-syslog.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# shellcheck disable=SC2154 +# +# Copyright (C) 2013-2014 Lawrence Livermore National Security, LLC. +# Copyright (c) 2020 by Delphix. All rights reserved. +# + +# +# Log the zevent via syslog. +# + +[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc" +. "${ZED_ZEDLET_DIR}/zed-functions.sh" + +zed_exit_if_ignoring_this_event + +# build a string of name=value pairs for this event +msg="eid=${ZEVENT_EID} class=${ZEVENT_SUBCLASS}" + +if [ "${ZED_SYSLOG_DISPLAY_GUIDS}" = "1" ]; then + [ -n "${ZEVENT_POOL_GUID}" ] && msg="${msg} pool_guid=${ZEVENT_POOL_GUID}" + [ -n "${ZEVENT_VDEV_GUID}" ] && msg="${msg} vdev_guid=${ZEVENT_VDEV_GUID}" +else + [ -n "${ZEVENT_POOL}" ] && msg="${msg} pool='${ZEVENT_POOL}'" + [ -n "${ZEVENT_VDEV_PATH}" ] && msg="${msg} vdev=${ZEVENT_VDEV_PATH##*/}" +fi + +# log pool state if state is anything other than 'ACTIVE' +[ -n "${ZEVENT_POOL_STATE_STR}" ] && [ "$ZEVENT_POOL_STATE" -ne 0 ] && \ + msg="${msg} pool_state=${ZEVENT_POOL_STATE_STR}" + +# Log the following payload nvpairs if they are present +[ -n "${ZEVENT_VDEV_STATE_STR}" ] && msg="${msg} vdev_state=${ZEVENT_VDEV_STATE_STR}" +[ -n "${ZEVENT_CKSUM_ALGORITHM}" ] && msg="${msg} algorithm=${ZEVENT_CKSUM_ALGORITHM}" +[ -n "${ZEVENT_ZIO_SIZE}" ] && msg="${msg} size=${ZEVENT_ZIO_SIZE}" +[ -n "${ZEVENT_ZIO_OFFSET}" ] && msg="${msg} offset=${ZEVENT_ZIO_OFFSET}" +[ -n "${ZEVENT_ZIO_PRIORITY}" ] && msg="${msg} priority=${ZEVENT_ZIO_PRIORITY}" +[ -n "${ZEVENT_ZIO_ERR}" ] && msg="${msg} err=${ZEVENT_ZIO_ERR}" +[ -n "${ZEVENT_ZIO_FLAGS}" ] && msg="${msg} flags=$(printf '0x%x' "${ZEVENT_ZIO_FLAGS}")" + +# log delays that are >= 10 milisec +[ -n "${ZEVENT_ZIO_DELAY}" ] && [ "$ZEVENT_ZIO_DELAY" -gt 10000000 ] && \ + msg="${msg} delay=$((ZEVENT_ZIO_DELAY / 1000000))ms" + +# list the bookmark data together +# shellcheck disable=SC2153 +[ -n "${ZEVENT_ZIO_OBJSET}" ] && \ + msg="${msg} bookmark=${ZEVENT_ZIO_OBJSET}:${ZEVENT_ZIO_OBJECT}:${ZEVENT_ZIO_LEVEL}:${ZEVENT_ZIO_BLKID}" + +zed_log_msg "${msg}" + +exit 0 diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/config.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/config.json new file mode 100644 index 000000000..0984e89a2 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/config.json @@ -0,0 +1 @@ +${config-json} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/resilver_finish-start-scrub.sh b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/resilver_finish-start-scrub.sh new file mode 100644 index 000000000..cafce6fde --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/resilver_finish-start-scrub.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# shellcheck disable=SC2154 +# resilver_finish-start-scrub.sh +# Run a scrub after a resilver +# +# Exit codes: +# 1: Internal error +# 2: Script wasn't enabled in zed.rc +# 3: Scrubs are automatically started for sequential resilvers +[ -f "${ZED_ZEDLET_DIR}/zed.rc" ] && . "${ZED_ZEDLET_DIR}/zed.rc" +. "${ZED_ZEDLET_DIR}/zed-functions.sh" + +[ "${ZED_SCRUB_AFTER_RESILVER}" = "1" ] || exit 2 +[ "${ZEVENT_RESILVER_TYPE}" != "sequential" ] || exit 3 +[ -n "${ZEVENT_POOL}" ] || exit 1 +[ -n "${ZEVENT_SUBCLASS}" ] || exit 1 +zed_check_cmd "${ZPOOL}" || exit 1 + +zed_log_msg "Starting scrub after resilver on ${ZEVENT_POOL}" +"${ZPOOL}" scrub "${ZEVENT_POOL}" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/scrub.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/scrub.conf deleted file mode 100644 index daccbd93f..000000000 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/scrub.conf +++ /dev/null @@ -1,6 +0,0 @@ -# Written by the mesh (module zfs) from this machine's assignment. Replaced on every push; change the -# settings scrub-pool, scrub-cadence, scrub-day and scrub-time, never this file. The module's tools read it. -pool=${config:scrub-pool} -cadence=${config:scrub-cadence} -day=${config:scrub-day} -time=${config:scrub-time} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed-functions.sh b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed-functions.sh new file mode 100644 index 000000000..78d8f658d --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed-functions.sh @@ -0,0 +1,825 @@ +#!/bin/sh +# shellcheck disable=SC2154,SC3043 +# zed-functions.sh +# +# ZED helper functions for use in ZEDLETs + + +# Variable Defaults +# +: "${ZED_LOCKDIR:="/var/lock"}" +: "${ZED_NOTIFY_INTERVAL_SECS:=3600}" +: "${ZED_NOTIFY_VERBOSE:=0}" +: "${ZED_RUNDIR:="/var/run"}" +: "${ZED_SYSLOG_PRIORITY:="daemon.notice"}" +: "${ZED_SYSLOG_TAG:="zed"}" + +ZED_FLOCK_FD=8 + + +# zed_check_cmd (cmd, ...) +# +# For each argument given, search PATH for the executable command [cmd]. +# Log a message if [cmd] is not found. +# +# Arguments +# cmd: name of executable command for which to search +# +# Return +# 0 if all commands are found in PATH and are executable +# n for a count of the command executables that are not found +# +zed_check_cmd() +{ + local cmd + local rv=0 + + for cmd; do + if ! command -v "${cmd}" >/dev/null 2>&1; then + zed_log_err "\"${cmd}\" not installed" + rv=$((rv + 1)) + fi + done + return "${rv}" +} + + +# zed_log_msg (msg, ...) +# +# Write all argument strings to the system log. +# +# Globals +# ZED_SYSLOG_PRIORITY +# ZED_SYSLOG_TAG +# +# Return +# nothing +# +zed_log_msg() +{ + logger -p "${ZED_SYSLOG_PRIORITY}" -t "${ZED_SYSLOG_TAG}" -- "$@" +} + + +# zed_log_err (msg, ...) +# +# Write an error message to the system log. This message will contain the +# script name, EID, and all argument strings. +# +# Globals +# ZED_SYSLOG_PRIORITY +# ZED_SYSLOG_TAG +# ZEVENT_EID +# +# Return +# nothing +# +zed_log_err() +{ + zed_log_msg "error: ${0##*/}:""${ZEVENT_EID:+" eid=${ZEVENT_EID}:"}" "$@" +} + + +# zed_lock (lockfile, [fd]) +# +# Obtain an exclusive (write) lock on [lockfile]. If the lock cannot be +# immediately acquired, wait until it becomes available. +# +# Every zed_lock() must be paired with a corresponding zed_unlock(). +# +# By default, flock-style locks associate the lockfile with file descriptor 8. +# The bash manpage warns that file descriptors >9 should be used with care as +# they may conflict with file descriptors used internally by the shell. File +# descriptor 9 is reserved for zed_rate_limit(). If concurrent locks are held +# within the same process, they must use different file descriptors (preferably +# decrementing from 8); otherwise, obtaining a new lock with a given file +# descriptor will release the previous lock associated with that descriptor. +# +# Arguments +# lockfile: pathname of the lock file; the lock will be stored in +# ZED_LOCKDIR unless the pathname contains a "/". +# fd: integer for the file descriptor used by flock (OPTIONAL unless holding +# concurrent locks) +# +# Globals +# ZED_FLOCK_FD +# ZED_LOCKDIR +# +# Return +# nothing +# +zed_lock() +{ + local lockfile="$1" + local fd="${2:-${ZED_FLOCK_FD}}" + local umask_bak + local err + + [ -n "${lockfile}" ] || return + if ! expr "${lockfile}" : '.*/' >/dev/null 2>&1; then + lockfile="${ZED_LOCKDIR}/${lockfile}" + fi + + umask_bak="$(umask)" + umask 077 + + # Obtain a lock on the file bound to the given file descriptor. + # + eval "exec ${fd}>> '${lockfile}'" + if ! err="$(flock --exclusive "${fd}" 2>&1)"; then + zed_log_err "failed to lock \"${lockfile}\": ${err}" + fi + + umask "${umask_bak}" +} + + +# zed_unlock (lockfile, [fd]) +# +# Release the lock on [lockfile]. +# +# Arguments +# lockfile: pathname of the lock file +# fd: integer for the file descriptor used by flock (must match the file +# descriptor passed to the zed_lock function call) +# +# Globals +# ZED_FLOCK_FD +# ZED_LOCKDIR +# +# Return +# nothing +# +zed_unlock() +{ + local lockfile="$1" + local fd="${2:-${ZED_FLOCK_FD}}" + local err + + [ -n "${lockfile}" ] || return + if ! expr "${lockfile}" : '.*/' >/dev/null 2>&1; then + lockfile="${ZED_LOCKDIR}/${lockfile}" + fi + + # Release the lock and close the file descriptor. + if ! err="$(flock --unlock "${fd}" 2>&1)"; then + zed_log_err "failed to unlock \"${lockfile}\": ${err}" + fi + eval "exec ${fd}>&-" +} + + +# zed_notify (subject, pathname) +# +# Send a notification via all available methods. +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Return +# 0: notification succeeded via at least one method +# 1: notification failed +# 2: no notification methods configured +# +zed_notify() +{ + local subject="$1" + local pathname="$2" + local num_success=0 + local num_failure=0 + + zed_notify_email "${subject}" "${pathname}"; rv=$? + [ "${rv}" -eq 0 ] && num_success=$((num_success + 1)) + [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1)) + + zed_notify_pushbullet "${subject}" "${pathname}"; rv=$? + [ "${rv}" -eq 0 ] && num_success=$((num_success + 1)) + [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1)) + + zed_notify_slack_webhook "${subject}" "${pathname}"; rv=$? + [ "${rv}" -eq 0 ] && num_success=$((num_success + 1)) + [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1)) + + zed_notify_pushover "${subject}" "${pathname}"; rv=$? + [ "${rv}" -eq 0 ] && num_success=$((num_success + 1)) + [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1)) + + zed_notify_ntfy "${subject}" "${pathname}"; rv=$? + [ "${rv}" -eq 0 ] && num_success=$((num_success + 1)) + [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1)) + + zed_notify_gotify "${subject}" "${pathname}"; rv=$? + [ "${rv}" -eq 0 ] && num_success=$((num_success + 1)) + [ "${rv}" -eq 1 ] && num_failure=$((num_failure + 1)) + + [ "${num_success}" -gt 0 ] && return 0 + [ "${num_failure}" -gt 0 ] && return 1 + return 2 +} + + +# zed_notify_email (subject, pathname) +# +# Send a notification via email to the address specified by ZED_EMAIL_ADDR. +# +# Requires the mail executable to be installed in the standard PATH, or +# ZED_EMAIL_PROG to be defined with the pathname of an executable capable of +# reading a message body from stdin. +# +# Command-line options to the mail executable can be specified in +# ZED_EMAIL_OPTS. This undergoes the following keyword substitutions: +# - @ADDRESS@ is replaced with the space-delimited recipient email address(es) +# - @SUBJECT@ is replaced with the notification subject +# If @SUBJECT@ was omited here, a "Subject: ..." header will be added to notification +# +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Globals +# ZED_EMAIL_PROG +# ZED_EMAIL_OPTS +# ZED_EMAIL_ADDR +# +# Return +# 0: notification sent +# 1: notification failed +# 2: not configured +# +zed_notify_email() +{ + local subject="${1:-"ZED notification"}" + local pathname="${2:-"/dev/null"}" + + : "${ZED_EMAIL_PROG:="mail"}" + : "${ZED_EMAIL_OPTS:="-s '@SUBJECT@' @ADDRESS@"}" + + # For backward compatibility with ZED_EMAIL. + if [ -n "${ZED_EMAIL}" ] && [ -z "${ZED_EMAIL_ADDR}" ]; then + ZED_EMAIL_ADDR="${ZED_EMAIL}" + fi + [ -n "${ZED_EMAIL_ADDR}" ] || return 2 + + zed_check_cmd "${ZED_EMAIL_PROG}" || return 1 + + [ -n "${subject}" ] || return 1 + if [ ! -r "${pathname}" ]; then + zed_log_err \ + "${ZED_EMAIL_PROG##*/} cannot read \"${pathname}\"" + return 1 + fi + + # construct cmdline options + ZED_EMAIL_OPTS_PARSED="$(echo "${ZED_EMAIL_OPTS}" \ + | sed -e "s/@ADDRESS@/${ZED_EMAIL_ADDR}/g" \ + -e "s/@SUBJECT@/${subject}/g")" + + # pipe message to email prog + # shellcheck disable=SC2086,SC2248 + { + # no subject passed as option? + if [ "${ZED_EMAIL_OPTS%@SUBJECT@*}" = "${ZED_EMAIL_OPTS}" ] ; then + # inject subject header + printf "Subject: %s\n" "${subject}" + # The following empty line is needed to separate the header from the + # body of the message. Otherwise programs like sendmail will skip + # everything up to the first empty line (or wont send an email at + # all) and will still exit with exit code 0 + printf "\n" + fi + # output message + cat "${pathname}" + } | + eval ${ZED_EMAIL_PROG} ${ZED_EMAIL_OPTS_PARSED} >/dev/null 2>&1 + rv=$? + if [ "${rv}" -ne 0 ]; then + zed_log_err "${ZED_EMAIL_PROG##*/} exit=${rv}" + return 1 + fi + return 0 +} + + +# zed_notify_pushbullet (subject, pathname) +# +# Send a notification via Pushbullet . +# The access token (ZED_PUSHBULLET_ACCESS_TOKEN) identifies this client to the +# Pushbullet server. The optional channel tag (ZED_PUSHBULLET_CHANNEL_TAG) is +# for pushing to notification feeds that can be subscribed to; if a channel is +# not defined, push notifications will instead be sent to all devices +# associated with the account specified by the access token. +# +# Requires awk, curl, and sed executables to be installed in the standard PATH. +# +# References +# https://docs.pushbullet.com/ +# https://www.pushbullet.com/security +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Globals +# ZED_PUSHBULLET_ACCESS_TOKEN +# ZED_PUSHBULLET_CHANNEL_TAG +# +# Return +# 0: notification sent +# 1: notification failed +# 2: not configured +# +zed_notify_pushbullet() +{ + local subject="$1" + local pathname="${2:-"/dev/null"}" + local msg_body + local msg_tag + local msg_json + local msg_out + local msg_err + local url="https://api.pushbullet.com/v2/pushes" + + [ -n "${ZED_PUSHBULLET_ACCESS_TOKEN}" ] || return 2 + + [ -n "${subject}" ] || return 1 + if [ ! -r "${pathname}" ]; then + zed_log_err "pushbullet cannot read \"${pathname}\"" + return 1 + fi + + zed_check_cmd "awk" "curl" "sed" || return 1 + + # Escape the following characters in the message body for JSON: + # newline, backslash, double quote, horizontal tab, vertical tab, + # and carriage return. + # + msg_body="$(awk '{ ORS="\\n" } { gsub(/\\/, "\\\\"); gsub(/"/, "\\\""); + gsub(/\t/, "\\t"); gsub(/\f/, "\\f"); gsub(/\r/, "\\r"); print }' \ + "${pathname}")" + + # Push to a channel if one is configured. + # + [ -n "${ZED_PUSHBULLET_CHANNEL_TAG}" ] && msg_tag="$(printf \ + '"channel_tag": "%s", ' "${ZED_PUSHBULLET_CHANNEL_TAG}")" + + # Construct the JSON message for pushing a note. + # + msg_json="$(printf '{%s"type": "note", "title": "%s", "body": "%s"}' \ + "${msg_tag}" "${subject}" "${msg_body}")" + + # Send the POST request and check for errors. + # + msg_out="$(curl -u "${ZED_PUSHBULLET_ACCESS_TOKEN}:" -X POST "${url}" \ + --header "Content-Type: application/json" --data-binary "${msg_json}" \ + 2>/dev/null)"; rv=$? + if [ "${rv}" -ne 0 ]; then + zed_log_err "curl exit=${rv}" + return 1 + fi + msg_err="$(echo "${msg_out}" \ + | sed -n -e 's/.*"error" *:.*"message" *: *"\([^"]*\)".*/\1/p')" + if [ -n "${msg_err}" ]; then + zed_log_err "pushbullet \"${msg_err}"\" + return 1 + fi + return 0 +} + + +# zed_notify_slack_webhook (subject, pathname) +# +# Notification via Slack Webhook . +# The Webhook URL (ZED_SLACK_WEBHOOK_URL) identifies this client to the +# Slack channel. +# +# Requires awk, curl, and sed executables to be installed in the standard PATH. +# +# References +# https://api.slack.com/incoming-webhooks +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Globals +# ZED_SLACK_WEBHOOK_URL +# +# Return +# 0: notification sent +# 1: notification failed +# 2: not configured +# +zed_notify_slack_webhook() +{ + [ -n "${ZED_SLACK_WEBHOOK_URL}" ] || return 2 + + local subject="$1" + local pathname="${2:-"/dev/null"}" + local msg_body + local msg_tag + local msg_json + local msg_out + local msg_err + local url="${ZED_SLACK_WEBHOOK_URL}" + + [ -n "${subject}" ] || return 1 + if [ ! -r "${pathname}" ]; then + zed_log_err "slack webhook cannot read \"${pathname}\"" + return 1 + fi + + zed_check_cmd "awk" "curl" "sed" || return 1 + + # Escape the following characters in the message body for JSON: + # newline, backslash, double quote, horizontal tab, vertical tab, + # and carriage return. + # + msg_body="$(awk '{ ORS="\\n" } { gsub(/\\/, "\\\\"); gsub(/"/, "\\\""); + gsub(/\t/, "\\t"); gsub(/\f/, "\\f"); gsub(/\r/, "\\r"); print }' \ + "${pathname}")" + + # Construct the JSON message for posting. + # shellcheck disable=SC2016 + # + msg_json="$(printf '{"text": "*%s*\\n```%s```"}' "${subject}" "${msg_body}" )" + + # Send the POST request and check for errors. + # + msg_out="$(curl -X POST "${url}" \ + --header "Content-Type: application/json" --data-binary "${msg_json}" \ + 2>/dev/null)"; rv=$? + if [ "${rv}" -ne 0 ]; then + zed_log_err "curl exit=${rv}" + return 1 + fi + msg_err="$(echo "${msg_out}" \ + | sed -n -e 's/.*"error" *:.*"message" *: *"\([^"]*\)".*/\1/p')" + if [ -n "${msg_err}" ]; then + zed_log_err "slack webhook \"${msg_err}"\" + return 1 + fi + return 0 +} + +# zed_notify_pushover (subject, pathname) +# +# Send a notification via Pushover . +# The access token (ZED_PUSHOVER_TOKEN) identifies this client to the +# Pushover server. The user token (ZED_PUSHOVER_USER) defines the user or +# group to which the notification will be sent. +# +# Requires curl and sed executables to be installed in the standard PATH. +# +# References +# https://pushover.net/api +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Globals +# ZED_PUSHOVER_TOKEN +# ZED_PUSHOVER_USER +# +# Return +# 0: notification sent +# 1: notification failed +# 2: not configured +# +zed_notify_pushover() +{ + local subject="$1" + local pathname="${2:-"/dev/null"}" + local msg_body + local msg_out + local msg_err + local url="https://api.pushover.net/1/messages.json" + + [ -n "${ZED_PUSHOVER_TOKEN}" ] && [ -n "${ZED_PUSHOVER_USER}" ] || return 2 + + if [ ! -r "${pathname}" ]; then + zed_log_err "pushover cannot read \"${pathname}\"" + return 1 + fi + + zed_check_cmd "curl" "sed" || return 1 + + # Read the message body in. + # + msg_body="$(cat "${pathname}")" + + if [ -z "${msg_body}" ] + then + msg_body=$subject + subject="" + fi + + # Send the POST request and check for errors. + # + msg_out="$( \ + curl \ + --form-string "token=${ZED_PUSHOVER_TOKEN}" \ + --form-string "user=${ZED_PUSHOVER_USER}" \ + --form-string "message=${msg_body}" \ + --form-string "title=${subject}" \ + "${url}" \ + 2>/dev/null \ + )"; rv=$? + if [ "${rv}" -ne 0 ]; then + zed_log_err "curl exit=${rv}" + return 1 + fi + msg_err="$(echo "${msg_out}" \ + | sed -n -e 's/.*"errors" *:.*\[\(.*\)\].*/\1/p')" + if [ -n "${msg_err}" ]; then + zed_log_err "pushover \"${msg_err}"\" + return 1 + fi + return 0 +} + + +# zed_notify_ntfy (subject, pathname) +# +# Send a notification via Ntfy.sh . +# The ntfy topic (ZED_NTFY_TOPIC) identifies the topic that the notification +# will be sent to Ntfy.sh server. The ntfy url (ZED_NTFY_URL) defines the +# self-hosted or provided hosted ntfy service location. The ntfy access token +# (ZED_NTFY_ACCESS_TOKEN) reprsents an +# access token that could be used if a topic is read/write protected. If a +# topic can be written to publicaly, a ZED_NTFY_ACCESS_TOKEN is not required. +# +# Requires curl and sed executables to be installed in the standard PATH. +# +# References +# https://docs.ntfy.sh +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Globals +# ZED_NTFY_TOPIC +# ZED_NTFY_ACCESS_TOKEN (OPTIONAL) +# ZED_NTFY_URL +# +# Return +# 0: notification sent +# 1: notification failed +# 2: not configured +# +zed_notify_ntfy() +{ + local subject="$1" + local pathname="${2:-"/dev/null"}" + local msg_body + local msg_out + local msg_err + + [ -n "${ZED_NTFY_TOPIC}" ] || return 2 + local url="${ZED_NTFY_URL:-"https://ntfy.sh"}/${ZED_NTFY_TOPIC}" + + if [ ! -r "${pathname}" ]; then + zed_log_err "ntfy cannot read \"${pathname}\"" + return 1 + fi + + zed_check_cmd "curl" "sed" || return 1 + + # Read the message body in. + # + msg_body="$(cat "${pathname}")" + + if [ -z "${msg_body}" ] + then + msg_body=$subject + subject="" + fi + + # Send the POST request and check for errors. + # + if [ -n "${ZED_NTFY_ACCESS_TOKEN}" ]; then + msg_out="$( \ + curl \ + -u ":${ZED_NTFY_ACCESS_TOKEN}" \ + -H "Title: ${subject}" \ + -d "${msg_body}" \ + -H "Priority: high" \ + "${url}" \ + 2>/dev/null \ + )"; rv=$? + else + msg_out="$( \ + curl \ + -H "Title: ${subject}" \ + -d "${msg_body}" \ + -H "Priority: high" \ + "${url}" \ + 2>/dev/null \ + )"; rv=$? + fi + if [ "${rv}" -ne 0 ]; then + zed_log_err "curl exit=${rv}" + return 1 + fi + msg_err="$(echo "${msg_out}" \ + | sed -n -e 's/.*"errors" *:.*\[\(.*\)\].*/\1/p')" + if [ -n "${msg_err}" ]; then + zed_log_err "ntfy \"${msg_err}"\" + return 1 + fi + return 0 +} + + +# zed_notify_gotify (subject, pathname) +# +# Send a notification via Gotify . +# The Gotify URL (ZED_GOTIFY_URL) defines a self-hosted Gotify location. +# The Gotify application token (ZED_GOTIFY_APPTOKEN) defines a +# Gotify application token which is associated with a message. +# The optional Gotify priority value (ZED_GOTIFY_PRIORITY) overrides the +# default or configured priority at the Gotify server for the application. +# +# Requires curl and sed executables to be installed in the standard PATH. +# +# References +# https://gotify.net/docs/index +# +# Arguments +# subject: notification subject +# pathname: pathname containing the notification message (OPTIONAL) +# +# Globals +# ZED_GOTIFY_URL +# ZED_GOTIFY_APPTOKEN +# ZED_GOTIFY_PRIORITY +# +# Return +# 0: notification sent +# 1: notification failed +# 2: not configured +# +zed_notify_gotify() +{ + local subject="$1" + local pathname="${2:-"/dev/null"}" + local msg_body + local msg_out + local msg_err + + [ -n "${ZED_GOTIFY_URL}" ] && [ -n "${ZED_GOTIFY_APPTOKEN}" ] || return 2 + local url="${ZED_GOTIFY_URL}/message?token=${ZED_GOTIFY_APPTOKEN}" + + if [ ! -r "${pathname}" ]; then + zed_log_err "gotify cannot read \"${pathname}\"" + return 1 + fi + + zed_check_cmd "curl" "sed" || return 1 + + # Read the message body in. + # + msg_body="$(cat "${pathname}")" + + if [ -z "${msg_body}" ] + then + msg_body=$subject + subject="" + fi + + # Send the POST request and check for errors. + # + if [ -n "${ZED_GOTIFY_PRIORITY}" ]; then + msg_out="$( \ + curl \ + --form-string "title=${subject}" \ + --form-string "message=${msg_body}" \ + --form-string "priority=${ZED_GOTIFY_PRIORITY}" \ + "${url}" \ + 2>/dev/null \ + )"; rv=$? + else + msg_out="$( \ + curl \ + --form-string "title=${subject}" \ + --form-string "message=${msg_body}" \ + "${url}" \ + 2>/dev/null \ + )"; rv=$? + fi + + if [ "${rv}" -ne 0 ]; then + zed_log_err "curl exit=${rv}" + return 1 + fi + msg_err="$(echo "${msg_out}" \ + | sed -n -e 's/.*"errors" *:.*\[\(.*\)\].*/\1/p')" + if [ -n "${msg_err}" ]; then + zed_log_err "gotify \"${msg_err}"\" + return 1 + fi + return 0 +} + + + +# zed_rate_limit (tag, [interval]) +# +# Check whether an event of a given type [tag] has already occurred within the +# last [interval] seconds. +# +# This function obtains a lock on the statefile using file descriptor 9. +# +# Arguments +# tag: arbitrary string for grouping related events to rate-limit +# interval: time interval in seconds (OPTIONAL) +# +# Globals +# ZED_NOTIFY_INTERVAL_SECS +# ZED_RUNDIR +# +# Return +# 0 if the event should be processed +# 1 if the event should be dropped +# +# State File Format +# time;tag +# +zed_rate_limit() +{ + local tag="$1" + local interval="${2:-${ZED_NOTIFY_INTERVAL_SECS}}" + local lockfile="zed.zedlet.state.lock" + local lockfile_fd=9 + local statefile="${ZED_RUNDIR}/zed.zedlet.state" + local time_now + local time_prev + local umask_bak + local rv=0 + + [ -n "${tag}" ] || return 0 + + zed_lock "${lockfile}" "${lockfile_fd}" + time_now="$(date +%s)" + time_prev="$(grep -E "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \ + | tail -1 | cut -d\; -f1)" + + if [ -n "${time_prev}" ] \ + && [ "$((time_now - time_prev))" -lt "${interval}" ]; then + rv=1 + else + umask_bak="$(umask)" + umask 077 + grep -E -v "^[0-9]+;${tag}\$" "${statefile}" 2>/dev/null \ + > "${statefile}.$$" + echo "${time_now};${tag}" >> "${statefile}.$$" + mv -f "${statefile}.$$" "${statefile}" + umask "${umask_bak}" + fi + + zed_unlock "${lockfile}" "${lockfile_fd}" + return "${rv}" +} + + +# zed_guid_to_pool (guid) +# +# Convert a pool GUID into its pool name (like "tank") +# Arguments +# guid: pool GUID (decimal or hex) +# +# Return +# Pool name +# +zed_guid_to_pool() +{ + if [ -z "$1" ] ; then + return + fi + + guid="$(printf "%u" "$1")" + $ZPOOL get -H -ovalue,name guid | awk '$1 == '"$guid"' {print $2; exit}' +} + +# zed_exit_if_ignoring_this_event +# +# Exit the script if we should ignore this event, as determined by +# $ZED_SYSLOG_SUBCLASS_INCLUDE and $ZED_SYSLOG_SUBCLASS_EXCLUDE in zed.rc. +# This function assumes you've imported the normal zed variables. +zed_exit_if_ignoring_this_event() +{ + if [ -n "${ZED_SYSLOG_SUBCLASS_INCLUDE}" ]; then + eval "case ${ZEVENT_SUBCLASS} in + ${ZED_SYSLOG_SUBCLASS_INCLUDE});; + *) exit 0;; + esac" + elif [ -n "${ZED_SYSLOG_SUBCLASS_EXCLUDE}" ]; then + eval "case ${ZEVENT_SUBCLASS} in + ${ZED_SYSLOG_SUBCLASS_EXCLUDE}) exit 0;; + *);; + esac" + fi +} diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed-mesh.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed-mesh.conf new file mode 100644 index 000000000..196be4669 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed-mesh.conf @@ -0,0 +1,4 @@ +# Written by the mesh (module zfs). ZED runs from the module's own folder, which holds no link. +[Service] +ExecStart= +ExecStart=/usr/bin/zed -F -d /etc/zfs/mesh-zed.d diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed.rc b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed.rc new file mode 100644 index 000000000..562b9f594 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zed.rc @@ -0,0 +1,7 @@ +# Written by the mesh (module zfs). Replaced on every push; change the settings zed and zed-handlers, never this file. +# It holds the package's own variables but its notification and mail lines: a pool's fault reaches the operator once, +# from the event follower's finding, never from a ZED handler. +ZED_USE_ENCLOSURE_LEDS=1 +ZED_SYSLOG_SUBCLASS_EXCLUDE="history_event" +# Read only by the scrub-after-resilver handler, which is placed only while zed-handlers names it. +ZED_SCRUB_AFTER_RESILVER=1 diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zfs.conf b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zfs.conf new file mode 100644 index 000000000..edc788e72 --- /dev/null +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/files/zfs.conf @@ -0,0 +1,5 @@ +# Written by the mesh (module zfs) from this machine's assignment. Replaced on every push; change the +# settings arc-max, arc-min and module-options, never this file. ZFS reads it when its kernel module loads. +${config-lines:arc-max:options zfs zfs_arc_max=:mib-bytes} +${config-lines:arc-min:options zfs zfs_arc_min=:mib-bytes} +${config-lines:module-options:options zfs } diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/module.json.captured index c109320a6..9e41b0586 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zfs/module.json.captured @@ -1,53 +1,266 @@ { "module": "zfs", - "version": "1", + "version": "0.1", + "class": "leaf", "capabilities": [ - "service-manager" + "bus-state-calls", + "ledger-calls", + "package-manager", + "service-manager", + "stream-publish" ], - "emits": [ - "snapshot.taken", - "scrub.requested" + "invokes": [ + "seat:node-service-manager.start" ], - "config": { - "scrub-pool": { - "type": "string", - "description": "The name of the ZFS pool the module scrubs; the operator's, with no default.", - "trusted": true, - "required": true - }, - "scrub-cadence": { - "type": "string", - "description": "How often the pool named by scrub-pool is scrubbed: weekly, or monthly on the first scrub-day of each month. Weekly is what the distribution's timer did on the home server before the module, so taking it over moves nothing until the operator chooses.", - "enum": [ - "weekly", - "monthly" + "consumes": [ + "mesh-conditions.findings-asked" + ], + "own-secrets": { + "broker-keeper": { + "path": "${dir:keeper-state}/broker-keeper.secret", + "owner": "zfs-keeper" + } + }, + "requires": [ + { + "name": "events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "config.applied", + "config.refused", + "config.waiting", + "snapshot.taken.person", + "snapshot.taken.schedule", + "snapshot.removed.person", + "snapshot.removed.schedule", + "snapshot.skipped.person", + "snapshot.skipped.schedule", + "run.skipped", + "scrub.requested" ], - "trusted": true, - "default": "weekly" - }, - "scrub-day": { - "type": "string", - "description": "The weekday the scrub starts, Mon to Sun; for a monthly scrub, the first such day of the month. Checked by the scheduled run, which refuses any other value and runs nothing; Monday is when the distribution's weekly timer fired.", - "enum": [ - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", - "Sun" - ], - "trusted": true, - "default": "Mon" - }, - "scrub-time": { - "type": "string", - "description": "The time the scrub starts, HH:MM from 00:00 to 23:59 in the machine's time zone; the scheduled run checks it every quarter of an hour, so the scrub starts within 15 minutes of it. Midnight is when the distribution's weekly timer fired.", - "pattern": "([01][0-9]|2[0-3]):[0-5][0-9]", - "trusted": true, - "default": "00:00" + "max-age-days": 30 } }, + { + "name": "applied", + "storage": "key-value", + "template": "state" + }, + { + "name": "schedule", + "storage": "key-value", + "template": "state" + }, + { + "name": "snapshots", + "storage": "ledger", + "template": "ledger", + "options": { + "max-mib": 64 + }, + "types": [ + { + "name": "snapshot", + "schema": { + "dataset": { + "type": "string" + }, + "name": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "at": { + "type": "string" + }, + "taken": { + "type": "object" + } + }, + "operations": [ + { + "name": "taken", + "effect": "set-entry", + "into": "taken", + "key": "name", + "fields": [ + "dataset", + "name", + "kind", + "at" + ] + }, + { + "name": "removed", + "effect": "remove", + "into": "taken", + "key": "name" + } + ] + } + ] + }, + { + "name": "findings", + "storage": "key-value", + "template": "state" + }, + { + "name": "finding-events", + "storage": "stream", + "template": "events", + "options": { + "events": [ + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "max-age-days": 7, + "max-mib": 8 + } + } + ], + "config": { + "pool": { + "type": "string", + "description": "The name of the ZFS pool the module owns: scrubs, trims, takes scheduled ZFS snapshots of and converges; the operator's, with no default.", + "trusted": true, + "required": true, + "renamed-from": "scrub-pool" + }, + "scrub-cadence": { + "type": "string", + "description": "How often the pool named by pool is scrubbed: weekly, or monthly on the first scrub-day of each month. Weekly is what the distribution's timer did on the home server before the module, so taking it over moves nothing until the operator chooses.", + "enum": [ + "weekly", + "monthly" + ], + "trusted": true, + "default": "weekly" + }, + "scrub-day": { + "type": "string", + "description": "The weekday the scrub starts, Mon to Sun; for a monthly scrub, the first such day of the month. Checked by the scheduled run, which refuses any other value and runs nothing; Monday is when the distribution's weekly timer fired.", + "enum": [ + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + "Sun" + ], + "trusted": true, + "default": "Mon" + }, + "scrub-time": { + "type": "string", + "description": "The time the scrub starts, HH:MM from 00:00 to 23:59 in the machine's time zone; the scheduled run checks it every quarter of an hour, so the scrub starts within 15 minutes of it. Midnight is when the distribution's weekly timer fired.", + "pattern": "([01][0-9]|2[0-3]):[0-5][0-9]", + "trusted": true, + "default": "00:00" + }, + "arc-max": { + "type": "number", + "description": "The most ZFS's read cache in memory (the ARC) may hold, in whole MiB: at least 64 and below the node's memory. Written live and into the options file. Not managed until set.", + "minimum": 64, + "trusted": false + }, + "arc-min": { + "type": "number", + "description": "The least the ARC keeps, in whole MiB, not above arc-max. Written live and into the options file. Not managed until set.", + "minimum": 0, + "trusted": false + }, + "module-options": { + "type": "list", + "description": "Kernel module parameters, each name=digits, from l2arc_write_max, l2arc_write_boost, l2arc_headroom, l2arc_noprefetch, l2arc_rebuild_enabled, zfs_txg_timeout, zfs_dirty_data_max, zfs_scan_vdev_limit, zfs_scrub_min_time_ms, zfs_resilver_min_time_ms and zfs_arc_sys_free (arc-max and arc-min hold the ARC's). Written into the options file; a live one is also written live, the others take effect at the next load of the kernel module. An empty list is not managed.", + "trusted": true + }, + "hostid": { + "type": "string", + "description": "The node's ZFS id: eight hexadecimal digits, not all zero, written to /etc/hostid with ZFS's own writer only when the pool's label holds 0 or this value. Changing it needs a check of the pool's import at the next boot; the module never reboots. Not managed until set.", + "pattern": "^[0-9a-fA-F]{8}$", + "trusted": true + }, + "zed": { + "type": "string", + "description": "Whether the ZFS event daemon runs from the module's own folder: on or off. Not managed until set.", + "enum": [ + "on", + "off" + ], + "trusted": false + }, + "zed-handlers": { + "type": "list", + "description": "The event handlers placed in the module's folder: all-syslog (the journal handler) and resilver_finish-start-scrub (a scrub after a resilver). Empty is not managed.", + "trusted": true + }, + "trim-schedule": { + "type": "string", + "description": "How often the pool is trimmed by the scheduled run: none, weekly, or monthly on the first trim-day of each month. Any set value holds the distribution's trim timers stopped. Needs trim-day and trim-time for weekly and monthly. Not managed until set.", + "enum": [ + "none", + "weekly", + "monthly" + ], + "trusted": false + }, + "trim-day": { + "type": "string", + "description": "The weekday the trim starts, Mon to Sun; for monthly, the first such day of the month. Not managed until set.", + "enum": [ + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", + "Sun" + ], + "trusted": false + }, + "trim-time": { + "type": "string", + "description": "The time the trim starts, HH:MM in the machine's time zone, within 15 minutes. Not managed until set.", + "pattern": "([01][0-9]|2[0-3]):[0-5][0-9]", + "trusted": false + }, + "cache-devices": { + "type": "list", + "description": "The pool's cache devices, by their names under /dev/disk/by-id: letters, digits, -, _, . and : only. A kernel-named member is re-added by its stable name; an empty list removes nothing and is not managed.", + "trusted": true + }, + "log-devices": { + "type": "list", + "description": "The pool's log devices, by their names under /dev/disk/by-id. An empty list removes nothing and is not managed.", + "trusted": true + }, + "log-mirror": { + "type": "boolean", + "description": "Whether log-devices are one mirror: true needs exactly two names, added as one mirror; otherwise each is a log device of its own. Not managed until set.", + "trusted": true + }, + "pool-properties": { + "type": "object", + "description": "The pool's properties: autotrim, autoexpand, autoreplace (on, off or default) and failmode (wait, continue, panic or default). Not managed until set.", + "trusted": true + }, + "dataset-properties": { + "type": "object", + "description": "Per dataset of the pool, its properties: compression, atime, relatime, recordsize, primarycache, secondarycache, sync, logbias, quota and reservation, each in its own form; never sharenfs or sharesmb. Not managed until set.", + "trusted": true + }, + "snapshots": { + "type": "object", + "description": "The scheduled ZFS snapshots of every filesystem of the pool: {\"none\": true}, or keep counts hourly, daily, weekly and monthly, each a whole number from 0 to 168; a count of 0 takes none of that kind and removes none. Only snapshots the module took, named mesh-- and recorded in its ledger, are ever removed. Not managed until set.", + "trusted": true + } + }, "tools": [ "zfs_datasets", "zfs_snapshots", @@ -59,6 +272,17 @@ "zfs_scrub_start", "zfs_scrub_pause", "zfs_scrub_stop", + "zfs_snapshots_run_now", + "zfs_snapshots_prune_now", + "zfs_config_apply", + "zfs_snapshots_pause", + "zfs_snapshots_resume", + "zfs_snapshots_record", + "zfs_config", + "zfs_snapshots_schedule", + "zfs_module_events", + "zfs_snapshots_check", + "zfs_findings", "zfs_io", "zfs_arc", "zfs_events", @@ -118,6 +342,310 @@ ] }, "resources": [ + { + "id": "utils", + "type": "package", + "package": "zfs-utils" + }, + { + "id": "dkms", + "type": "package", + "package": "zfs-dkms" + }, + { + "id": "state-dir", + "type": "directory", + "path": "/var/lib/zfs-tools", + "mode": "0755", + "owner": "${machine:account}", + "unknown": "program" + }, + { + "id": "cursor-dir", + "type": "directory", + "path": "/run/zfs-events", + "mode": "0700", + "unknown": "program" + }, + { + "id": "run-dir", + "type": "directory", + "path": "/run/zfs-tools", + "mode": "0755", + "unknown": "program" + }, + { + "id": "keeper-account", + "type": "user", + "name": "zfs-keeper", + "shell": "/usr/bin/nologin" + }, + { + "id": "keeper-state", + "type": "directory", + "mode": "0711", + "owner": "zfs-keeper", + "place": "mesh", + "unknown": "program" + }, + { + "id": "config-dir", + "type": "directory", + "path": "/etc/zfs-tools", + "mode": "0755", + "unknown": "program" + }, + { + "id": "scrub-state-dir", + "type": "directory", + "path": "/var/lib/zfs-scrub", + "mode": "0700", + "unknown": "program" + }, + { + "id": "config", + "type": "file", + "path": "/etc/zfs-tools/config.json", + "mode": "0644", + "template": "files/config.json", + "trusted": false + }, + { + "id": "options", + "type": "file", + "path": "/etc/modprobe.d/zfs.conf", + "mode": "0644", + "template": "files/zfs.conf", + "if-config": [ + "arc-max", + "arc-min", + "module-options" + ] + }, + { + "id": "zed-dir", + "type": "directory", + "path": "/etc/zfs/mesh-zed.d", + "mode": "0755", + "unknown": "module", + "if-config": [ + "zed=on" + ] + }, + { + "id": "zed-rc", + "type": "file", + "path": "/etc/zfs/mesh-zed.d/zed.rc", + "mode": "0644", + "template": "files/zed.rc", + "if-config": [ + "zed=on" + ] + }, + { + "id": "zed-functions", + "type": "file", + "path": "/etc/zfs/mesh-zed.d/zed-functions.sh", + "mode": "0644", + "template": "files/zed-functions.sh", + "if-config": [ + "zed=on" + ], + "names-on-purpose": { + "api.pushbullet.com": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it", + "api.pushover.net": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it", + "api.slack.com": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it", + "docs.pushbullet.com": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it", + "gotify.net": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it", + "pushover.net": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it", + "www.pushbullet.com": "the distribution's own zed-functions.sh, kept as the package ships it (A-2): its notifier functions name the notification services' sites in their comments and urls, and none is used unless the operator's zed.rc enables it" + } + }, + { + "id": "zed-handler-all-syslog", + "type": "file", + "path": "/etc/zfs/mesh-zed.d/all-syslog.sh", + "mode": "0755", + "template": "files/all-syslog.sh", + "if-config": [ + "zed-handlers=all-syslog" + ] + }, + { + "id": "zed-handler-scrub-after-resilver", + "type": "file", + "path": "/etc/zfs/mesh-zed.d/resilver_finish-start-scrub.sh", + "mode": "0755", + "template": "files/resilver_finish-start-scrub.sh", + "if-config": [ + "zed-handlers=resilver_finish-start-scrub" + ] + }, + { + "id": "zed-drop-ins", + "type": "directory", + "path": "/etc/systemd/system/zfs-zed.service.d", + "mode": "0755", + "unknown": "program", + "if-config": [ + "zed=on" + ] + }, + { + "id": "zed-drop-in", + "type": "file", + "path": "/etc/systemd/system/zfs-zed.service.d/mesh.conf", + "mode": "0644", + "template": "files/zed-mesh.conf", + "if-config": [ + "zed=on" + ] + }, + { + "id": "import-cache", + "type": "service", + "unit": "zfs-import-cache.service", + "state": "running", + "boot": "enabled", + "health": { + "kind": "unit" + } + }, + { + "id": "mount", + "type": "service", + "unit": "zfs-mount.service", + "state": "running", + "boot": "enabled", + "health": { + "kind": "unit" + } + }, + { + "id": "target", + "type": "service", + "unit": "zfs.target", + "state": "running", + "boot": "enabled", + "health": { + "kind": "unit" + } + }, + { + "id": "import-scan", + "type": "service", + "unit": "zfs-import-scan.service" + }, + { + "id": "share", + "type": "service", + "unit": "zfs-share.service" + }, + { + "id": "volume-wait", + "type": "service", + "unit": "zfs-volume-wait.service" + }, + { + "id": "import-target", + "type": "service", + "unit": "zfs-import.target" + }, + { + "id": "zed-on", + "type": "service", + "unit": "zfs-zed.service", + "state": "running", + "boot": "enabled", + "if-config": [ + "zed=on" + ], + "restart-on": [ + "zed-rc", + "zed-functions", + "zed-handler-all-syslog", + "zed-handler-scrub-after-resilver", + "zed-drop-in" + ], + "health": { + "kind": "unit" + } + }, + { + "id": "zed-off", + "type": "service", + "unit": "zfs-zed.service", + "state": "stopped", + "boot": "disabled", + "if-config": [ + "zed=off" + ] + }, + { + "id": "keeper", + "type": "process", + "name": "zfs-keeper", + "artifact": "tools", + "run": [ + "./zfs-tools", + "keeper" + ], + "user": "zfs-keeper", + "env": { + "MESH_BROKER_FILE": "${dir:keeper-state}/broker-keeper.secret", + "ZFS_KEEPER_SOCKET": "${dir:keeper-state}/keeper.sock" + }, + "bus": { + "state": [ + "applied", + "schedule", + "findings" + ], + "emits": [ + "config.applied", + "config.refused", + "config.waiting", + "snapshot.taken.person", + "snapshot.taken.schedule", + "snapshot.removed.person", + "snapshot.removed.schedule", + "snapshot.skipped.person", + "snapshot.skipped.schedule", + "run.skipped", + "finding-written.*", + "finding-cleared.*", + "findings-stated.*" + ], + "consumes": [ + "mesh-conditions.findings-asked" + ], + "invokes": [ + "zfs.zfs_snapshots_record", + "zfs.zfs_snapshots_schedule", + "seat:node-service-manager.start" + ] + }, + "health": { + "kind": "unit" + } + }, + { + "id": "apply", + "type": "process", + "name": "zfs-config-apply", + "artifact": "tools", + "run": [ + "./zfs-tools", + "apply" + ], + "run-once": true, + "restart-on": [ + "config" + ], + "env": { + "ZFS_KEEPER_SOCKET": "${dir:keeper-state}/keeper.sock" + } + }, { "id": "watch", "type": "process", @@ -137,21 +665,6 @@ "grace": "60s" } }, - { - "id": "state-dir", - "type": "directory", - "path": "/var/lib/zfs-tools", - "mode": "0755", - "owner": "${machine:account}", - "unknown": "program" - }, - { - "id": "cursor-dir", - "type": "directory", - "path": "/run/zfs-events", - "mode": "0700", - "unknown": "program" - }, { "id": "events", "type": "process", @@ -163,53 +676,62 @@ ], "health": { "kind": "unit" + }, + "env": { + "ZFS_KEEPER_SOCKET": "${dir:keeper-state}/keeper.sock" } }, { - "id": "config-dir", - "type": "directory", - "path": "/etc/zfs-tools", - "mode": "0755", - "unknown": "program" - }, - { - "id": "scrub-config", - "type": "file", - "path": "/etc/zfs-tools/scrub.conf", - "mode": "0644", - "template": "files/scrub.conf" - }, - { - "id": "scrub-state-dir", - "type": "directory", - "path": "/var/lib/zfs-scrub", - "mode": "0700", - "unknown": "program" - }, - { - "id": "scrub-run", + "id": "run", "type": "process", - "name": "zfs-mesh-scrub", + "name": "zfs-mesh-run", "artifact": "tools", "run": [ "./zfs-tools", - "scrub-run" + "run" ], - "schedule": "*/15 * * * *" + "schedule": "0,15,30,45 * * * *", + "env": { + "ZFS_KEEPER_SOCKET": "${dir:keeper-state}/keeper.sock" + } }, { "id": "distribution-weekly", "type": "service", - "unit": "zfs-scrub-weekly@${config:scrub-pool}.timer", + "unit": "zfs-scrub-weekly@${config:pool}.timer", "state": "stopped", "boot": "disabled" }, { "id": "distribution-monthly", "type": "service", - "unit": "zfs-scrub-monthly@${config:scrub-pool}.timer", + "unit": "zfs-scrub-monthly@${config:pool}.timer", "state": "stopped", "boot": "disabled" + }, + { + "id": "distribution-trim-weekly", + "type": "service", + "unit": "zfs-trim-weekly@${config:pool}.timer", + "state": "stopped", + "boot": "disabled", + "if-config": [ + "trim-schedule=none", + "trim-schedule=weekly", + "trim-schedule=monthly" + ] + }, + { + "id": "distribution-trim-monthly", + "type": "service", + "unit": "zfs-trim-monthly@${config:pool}.timer", + "state": "stopped", + "boot": "disabled", + "if-config": [ + "trim-schedule=none", + "trim-schedule=weekly", + "trim-schedule=monthly" + ] } ], "build": { diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-autosuggestions/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-autosuggestions/module.json.captured index e8839210f..16415c596 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-autosuggestions/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-autosuggestions/module.json.captured @@ -1,6 +1,7 @@ { "module": "zsh-autosuggestions", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-syntax-highlighting/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-syntax-highlighting/module.json.captured index b9c81a90c..8fa4c1cb4 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-syntax-highlighting/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh-syntax-highlighting/module.json.captured @@ -1,6 +1,7 @@ { "module": "zsh-syntax-highlighting", - "version": "1", + "version": "0.1", + "class": "leaf", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh/module.json.captured b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh/module.json.captured index 028f2213d..c4bbfb570 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh/module.json.captured +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/modules/zsh/module.json.captured @@ -1,6 +1,7 @@ { "module": "zsh", "version": "0.1", + "class": "core", "moved": true, "capabilities": [ "package-manager" diff --git a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/predefined.json b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/predefined.json index 9e536767b..56ba37d0c 100644 --- a/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/predefined.json +++ b/modules/mesh-delivery-indexer/testdata/beside/mesh-catalog/predefined.json @@ -9,5 +9,10 @@ "description": "The size a desktop program shows its text in, in points.", "minimum": 6, "maximum": 72 + }, + "upgrade-order": { + "type": "list", + "description": "The nodes in the order they upgrade, each by its name: the first opens each week's round of upgrades, and each node upgrades only after the one before it passed its after-upgrade check. Empty or unset: no round starts.", + "trusted": true } }