package main import ( "strings" "git.novox.be/novox/mesh-sdk/go/catalogue" ) // An address is read from the node's settings where it is used, never recorded with a port // (novox/hq 04-ISSUES/102). Three readers did not follow the setting; each is held to it here. var aDigest = "sha256:" + strings.Repeat("e", 64) // aStore is a module offering the artifact store on 5000, published the long way as the // distribution module does, so a node may be given another number for it. func aStore() catalogue.Manifest { return catalogue.Manifest{Module: "distribution", Version: "1", Provides: []catalogue.Offer{{Name: catalogue.ArtifactStoreProvision, Scope: catalogue.ScopeMesh}}, Serves: map[string]map[string]any{catalogue.ArtifactStoreProvision: {"port": float64(5000)}}, Listens: []catalogue.Listening{{Port: 5000, From: catalogue.FromMesh}}, Resources: []map[string]any{{"id": "store", "type": "container", "name": "mesh-registry", "ports": []any{"5000:5000"}, "image": "registry@" + aDigest}}} } // **The trust a machine writes for the store, and the address every built image is fetched // through, say the port the node gave the store** — not the catalogue's number. // **The control plane's own connections say the port the node gave the store and the broker.** // // Composed from the control plane's own manifest against a real inventory: the store's module is // given 6852 on this node the way genesis or an operator gives it, and the control plane's // process is told so beside the sealed connection genesis wrote. // withSeatPorts is the control plane's manifest with the seat placeholders in its environment — // added here until module.json carries them (the manifest lands one commit after the code that // fills it, so a control plane one build behind never sees a placeholder it cannot fill). func withSeatPorts(m catalogue.Manifest) catalogue.Manifest { seatPorts := map[string]string{ "MESH_STORE_INVENTORY_PORT": "${seat:mesh-store:5432}", "MESH_STORE_IDENTITY_PORT": "${seat:mesh-store:5432}", "MESH_STORE_LICENCES_PORT": "${seat:mesh-store:5432}", "MESH_BROKER_AMQP_PORT": "${seat:mesh-broker:5672}", "MESH_BROKER_MANAGEMENT_PORT": "${seat:mesh-broker:15672}", "MESH_BROKER_ADDRESS_PORT": "${seat:mesh-broker:5671}", } out := m out.Resources = nil for _, r := range m.Resources { if r["type"] != "container" && r["type"] != "process" { out.Resources = append(out.Resources, r) continue } copied := map[string]any{} for k, v := range r { copied[k] = v } env := map[string]any{} if had, ok := r["env"].(map[string]any); ok { for k, v := range had { env[k] = v } } for k, v := range seatPorts { if _, said := env[k]; !said { env[k] = v } } copied["env"] = env out.Resources = append(out.Resources, copied) } return out } // aLoneNode is one capable machine with nothing placed on any network — the control-node during // genesis, before the "network" step, which is after the store, the broker, the vault and the // catalogue have each been built and pushed (finding F2). // **Before the network exists, the store's own node reaches it by loopback** — never refused, // never handed the scheme: a genesis pushes the store, the broker, the vault and the catalogue to // a node on no network, and builds the catalogue on a base it must be able to pull.