I am doing something similar in dev, in production however I use a different strategy.
I have this in my runtime.exs:
topology_hosts =
System.get_env("PARTNERS") ||
raise """
environment variable PARTNERS is missing, no cluster will be active
"""
config :gratwifi,
topology: [
ipc: [
strategy: Cluster.Strategy.Epmd,
config: [
hosts: topology_hosts |> String.split(",") |> Enum.map(&String.to_atom/1)
]
]
]
And then in application.exs:
def start(_type, _args) do
topologies = Application.get_env(:gratwifi, :topology)
...
children =
[
...
{Cluster.Supervisor, [topologies, [name: GratWiFi.ClusterSupervisor]]},
...
]
The PARTNERS environment variable is set to a comma-separated list of all my nodes.
AND very important the access to the epmd port is restricted to these hosts on all my nodes.


















