Cluster.Strategy.LolipopZTL (libcluster_mesh v0.1.0)

Copy Markdown View Source

libcluster strategy that discovers peers by polling the local LOLIPOP Zero Trust Link (ZTL) daemon via ztlctl status.

ZTL's controller has no public device-listing API, but every node's ztld daemon already knows the full netmap, so peers are read from the daemon itself. Without --all the CLI lists online peers only, which is exactly the set worth connecting to.

Usage

Run ztld in TUN mode (userspace mode has no TUN device, so the BEAM cannot bind its distribution listener to the mesh address). Start every node with a longname built from its ZTL IPv4 (e.g. myapp@100.64.0.7), then configure:

config :libcluster,
  topologies: [
    ztl: [
      strategy: Cluster.Strategy.LolipopZTL,
      config: [
        node_basename: "myapp",
        hostnames: ["myapp-"],
        # socket: "/opt/data/ztl/run/ztld.sock",
        # polling_interval: 5_000
      ]
    ]
  ]

Options

  • node_basename (required) — node name part before @, shared by all nodes
  • hostnames (required) — list of mesh hostname prefixes that identify cluster members; peers not matching any prefix are ignored
  • cli — path to the ztlctl binary (default "ztlctl")
  • socketztld socket path passed to ztlctl --socket; when omitted, ztlctl selects the daemon socket
  • polling_interval — poll interval in milliseconds (default 5_000)
  • cmd_timeout — CLI timeout in milliseconds (default 10_000; polls never overlap regardless, as the next poll is scheduled after the current one)
  • runnerLibclusterMesh.Runner implementation (default runs the CLI)