Peerage v0.3.0 Peerage
Peerage is a cluster formation library. That is to say, it helps your nodes find each other.
It supports DNS-based discovery, which means you can use it out of the box with Kubernetes (and probably also Weave, discoverd, Swarm, and other things anything else with dns-based service discovery).
It also supports UDP-based discovery, so that nodes on the same network (like docker containers on the same host) can find each other.
It’s also easy to extend: adding a new Provider can be as simple as writing a single function.
Usage
config :peerage, via: Peerage.Via.$SOME_PROVIDER
There are several providers. See the docs on those modules, as well as the project README.md, for more information.
I use List or Udp in development, and Dns in production.
Writing Your Own Providers
defmodule MyWayToFindHomies do
@behaviour Peerage.Provider # (optional)
def poll, do: [ :"node@somewhere" ] # implementation
end
And in config:
config :peerage, via: MyWayToFindHomies
If your Provider is an OTP process and should be run supervised,
config :peerage, via: MyWayToFindHomies, serves: true
Peerage.Via.Udp
, a GenServer, is a complete example
of a more complex, stateful approach; it
uses broadcast, and records nodes it’s seen.
Summary
Functions
Callback implementation for Application.start/2
Functions
Callback implementation for Application.start/2
.