Peerage v1.0.3 Peerage

Peerage is a cluster formation library. It helps your nodes find each other and connect, and it tries to keep things simple.

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.

Custom Providers

… are easy! See the code for the included providers. If you’re just polling something, it can be easy as a module with one function:

defmodule MyWayToFindHomies do
  @behaviour Peerage.Provider         # (optional)
  def poll, do: [ :"node@somewhere" ] # implementation
end

And in config:

config :peerage, via: MyWayToFindHomies

Have something a bit more complex? If your Provider is an OTP process and should be run supervised, just add serves: true:

config :peerage, via: MyWayToFindHomies, serves: true

Peerage.Via.Udp, a GenServer, is a complete example of a stateful approach; it uses broadcast, and records nodes it’s seen.

Summary

Functions

Callback implementation for Application.start/2

Functions

start(type, args)

Callback implementation for Application.start/2.