zenchild

zenchild

Libcluster-dynamic-srv - Clustering with SRV and Dynamic Ports with Custom EPMd

Announcing libcluster_dynamic_srv: Dynamic Port Clustering for Elixir

I’ve been working on a way to cluster Elixir nodes in dynamic environments without needing to set static ports. This work was heavily inspired by the Caravan package, but differs in one key way: you don’t need to specify a port in the node name. The port can be completely dynamic and is discovered using DNS SRV records. It also has a libcluster DNS strategy for clustering with the SRV records. It is very similar to the K8s strategy in the core libcluster library, but is a bit more flexible around service naming.

I’m currently using this with Nomad and Consul, and I’ve also created a demo lab that uses Docker + Consul if you want to play around with it.

How It Works

Unlike traditional Elixir clustering approaches that require fixed ports, this library leverages DNS SRV records to discover both the host and port information for each node. This makes it perfect for containerized environments where ports are often dynamically assigned.

Future Possibilities

This approach should also work with Kubernetes, though I’m not as experienced with K8s. If someone is interested in exploring this integration, I’d love any feedback on the approach or contributions to the examples folder!

Cheers,
Dan Wanek

Links

Where Next?

Popular in Announcing Top

zachdaniel
Hey folks! AshEvents Release We’ve just released the first version of AshEvents, an Event Sourcing tool for Ash Framework apps. Check o...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
New
johantell
Ever struggled with mocking external HTTP services in Elixir tests? Found yourself writing brittle mocks that don’t catch real-world enco...
New
mikehostetler
Hey everyone! I’m excited to share ReqLLM - a new approach to LLM interactions in Elixir that I’ve been working on. After building agent...
New
garrison
Hobbes is a scalable, fault-tolerant transactional record store written in Elixir. Hobbes is designed to be: Scalable - Hobbes can sha...
New
rms.mrcs
Hi there :waving_hand: Just dropping by to share PhonixLiveState, a lib I’ve just published. It’s still VERY RAW, but already in a reas...
New
fhunleth
Elixir Circuits is a set of libraries for interacting with hardware. We previously announced Circuits.UART, and now we’re ready to announ...
New
mudspot
Hi folks, I’d like to announce the release of Prometheus Agents, a set of subagents for Claude Code that cater to the Elixir Phoenix pro...
New
taro
I took lessons from the last discussion and cobbled together an example as a proof-of-concept. Mar demonstrates a Flask-like web dev int...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement