Sorc96

Sorc96

Basic setup for distributed application using mix release

I haven’t been able to find a simple example for this. Let’s say we have a regular project with Phoenix that is deployed by building a mix release and copying that to a server.

Now if we want to run that application on two nodes, it is unclear what exactly needs to change I know it is necessary to set the RELEASE_DISTRIBUTION env var to name and set a unique RELEASE_NODE. The cookie should be the same, since it is set when the release is built.

But I’m wondering about the best way to actually connect the nodes when they are started. Also, is there anything else I’m missing?

Marked As Solved

D4no0

D4no0

The easiest way is to use libcluster for this, it does automatically a lot of things, like automatic connection, discovery etc.

Make sure to read about the available clustering strategies, the default one used by erlang is EPMD. Outside of EPMD, I’ve personally used in production Cluster.Strategy.Gossip with docker containers and it works out of the box.

Also Liked

joram

joram

The Phoenix generator, as of 1.7.8, includes dns_cluster. It’s a lot less featureful than libcluster, but if it does what you need it’s very convenient. With the minimal setup the Phoenix generator includes you only need to set the environment variable DNS_CLUSTER_QUERY to make it work.

Last Post!

Sorc96

Sorc96

That looks like it should be just enough for a simple use case. Thank you!

Where Next?

Popular in Questions Top

hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New

Other popular topics Top

New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

We're in Beta

About us Mission Statement