Hello Erlangers,<div><br></div><div>I'm fairly new to Erlang and I'm trying to brainstorm an architecture for an ideally masterless system, mainly how to achieve it on top of Erlang and OTP. The main components are 1..n nodes as public web based authentication services  and 1..n nodes as the ultimate hosts of the client, over a long lived tcp connection.  The web service nodes do registration and authentication, and decide which host the client will connect to. The authentication nodes need to be aware of all host nodes, and need to realize when new host nodes get added. The host nodes provide a notification mechanism for usage statistics, and each auth node registers for this notification in order to figure out some heuristics on deciding where to forward a client when they want to connect.</div>
<div><br></div><div>My main issue is with figuring out if when a new node joins the cluster, does it/will it run the host_service application? If I can't make that guarantee then I would need to periodically scan all nodes an see if host_service is running on them. This seems like a bad design. Is there an OTP or standardized erlang pattern to achieve this?</div>
<div><br></div><div>Right now the only idea I came up with is having an application running on all my nodes that specify the "feature" of the node, so when a node joins the cluster, the web service app checks the capabilities of the node, and either ignores or it grabs the host_service process, or if the host_service happens to be dead periodically checks until it's alive.</div>
<div><br></div><div>Lastly I'm also debating if this complexity is worth the effort, it seems that using a global process as a host_service registry would be much easier.</div><div><br></div><div>Thanks for any advice, and also keep in mind this is mostly a personal academic exercises in building distributed systems and learning Erlang.</div>