Elixir Clustering with Mix Releases and libcluster

We finally have a Mix clustering guide to go with Phoenix deployment with Mix Releases.

Deploy an Elixir Cluster with Mix Releases and libcluster

The finished code for the guide is available at https://github.com/render-examples/elixir_cluster.

Meta: the Mix team has done a wonderful job learning from Distillery and making it even easier to cluster nodes, especially on platforms like Render (where I work) because we can auto-populate clustering variables for you.

14 Likes

How are you keeping separate customer’s Erlang clusters. K8s network policies? It would be good to add TLS usage to the tutorial.

Yes, firewalling through network policies. Regarding SSL, we terminate TLS at our L4 load balancer. Do you need e2e TLS?

I mean TLS for distributed erlang so that all communication is encrypted. http://erlang.org/doc/apps/ssl/ssl_distribution.html

Makes sense. We’ll add a guide for it.

This is really great, anuragg! Say I have a horizontally distributed application with microservices sitting in other pods. To connect the main application to the microservices, would I just add multiple topologies for them to connect to each other?

If so, as Render uses IP instead of FQDN for the DNS resolution, how would I send messages to and from the different topologies? Since the IP isn’t guaranteed to be the same each time a service goes up and down, I can’t quite call :rpc.call(node_name, :"Module", :function, [:"args"]) or Node.spawn(:"servicename@127.0.0.1", :"Module", fun, args).

How would you recommend passing messages between topologies in this situation?

Each Render service gets a unique internal-only URL of the type service-slug:port. You will see it on the dashboard once the service is deployed. You can connect to this URL from other services in your account; think of it as a built-in automatic VPC with preconfigured DNS. It sounds like this will work for your use case.

1 Like