Raxol.Swarm.Discovery (Raxol v2.3.0)

View Source

Automatic node discovery via libcluster.

Wraps Cluster.Supervisor with strategy presets for common deployment scenarios. When libcluster is not installed, falls back to manual Node.connect/1.

Strategy Presets

# LAN multicast (zero config)
Discovery.start_link(strategy: :gossip)

# Static node list
Discovery.start_link(strategy: :epmd, hosts: [:"a@10.0.0.1", :"b@10.0.0.2"])

# DNS polling (Fly.io, Kubernetes)
Discovery.start_link(strategy: :dns, query: "raxol.internal", node_basename: "raxol")

# Tailscale mesh (automatic peer discovery via tailnet)
Discovery.start_link(strategy: :tailscale, node_basename: "raxol")
Discovery.start_link(strategy: :tailscale, node_basename: "raxol", tag_filter: "tag:raxol")

# Custom libcluster topology
Discovery.start_link(topologies: [my_cluster: [strategy: Cluster.Strategy.Gossip]])

Without libcluster

When the :libcluster dependency is not available, start_link/1 returns {:ok, pid} of a minimal GenServer that does nothing. Nodes must be connected manually via Node.connect/1.

Summary

Functions

Returns a specification to start this module under a supervisor.

Types

preset()

@type preset() :: :gossip | :epmd | :dns | :tailscale

Functions

available?()

@spec available?() :: boolean()

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts \\ [])

@spec start_link(keyword()) :: GenServer.on_start()