# `Cluster.Supervisor`
[🔗](https://github.com/bitwalker/libcluster/blob/3.6.0/lib/supervisor.ex#L1)

This module handles supervising the configured topologies, and is designed
to support being started within your own supervision tree, as shown below:

    defmodule MyApp.App do
      use Application

      def start(_type, _args) do
        topologies = [
          example: [
            strategy: Cluster.Strategy.Epmd,
            config: [hosts: [:"a@127.0.0.1", :"b@127.0.0.1"]],
          ]
        ]
        children = [
          {Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]},
          ..other children..
        ]
        Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor)
      end
    end

The `topologies` configuration structure shown above can be built manually,
like shown, so that you can load config at runtime in a way that best
suits your application; or if you don't need to do any special config
handling, you can use the Mix config file, and just use
`Application.get_env(:libcluster, :topologies)`. That config would look like so:

    config :libcluster,
      topologies: [
        example: [...]
      ]

Use the method most convenient for you.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

Start a new instance of this supervisor. This is the callback indicated in
the child specification returned by `child_spec/1`. It expects a list of
the form `[config, supervisor_opts]`, or `[config]`. The former allows you
to provide options for the supervisor like with `Supervisor.start_link/3`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
