I’m trying to stand up a very basic example of distributed elixir using docker and epmd.
I chose to use libcluster and followed the readme with the example of the two nodes
email@example.com and firstname.lastname@example.org
Heres the app in github here
GitHub - joshchernoff/cluster_example: Just trying to start more than one phoenix app.
In short, everything works besides libcluster.
I can manually connect the nodes via Node.connect and list the nodes by hand but when running libcluster I get
If I had to guess I would think its related to something running too soon. IE maybe I need to wait to boot the other container first before the other?
I’m hoping I just overlooked something basic.
I was mistaken I can’t
Node.connect by hand after all. I was connecting the node to the same app thus is was saying true, I didn’t notice I was giving the wrong node name to connect to. When trying to use the correct node name I found it would return false thus the prob here is likely epmd is not able to connect because of docker.
See this other topic to see if addresses your issue:
So, let’s start with the manual connection in docker. Once it works on your side we can move to libcluster
We run two iex in two different containers, connected to the same elixir network and passing the same ERLANG_COOKIE via env variable
First let’s create the bridge network (something that docker-compose creates automatically)
docker network create elixir
Then run the first container in a terminal, attaching it to the elixir network. The container’s name is app1 which is…