EC2 Distributed Elixir Nodes. Releases

Hello, community!
We are making distributed nodes of elixir application at EC2.
Reading running node names and connect them all together done via hex package
The only work we have to do is to start a named server in the release and set cookie.

We update file rel/ and put set global variables there, such as:

export RELEASE_NODE=<%= %>@IP

Finally our question:

  1. Is it proper way to get an IP of running instance?
  2. After we start named server node (via ./prod/rel/app/bin/app start) we lost opportunity to connect to it via prod/rel/app/bin/app remote. An error is Could not contact remote node app@IP, reason: :nodedown. Aborting...

We definitely doing something wrong, any advise appreciated )

FYI How to prevent a node becoming distributed if started by a release?

I’m currently studying this fantastic example repo from for deploying distillery releases on EC2 instances. It is definitely a lot to take in at first, but I’ve tried to highlight the relevant parts for you below.

In this example, they are using:

setup-network-environment is run as a systemd unit, it sets network info to several env vars, and it is configured to start before your elixir application here:

Then you can rely on REPLACE_OS_VARS to set it in your vm.args file, ie:

we will try it, sounds like it may be easily done, i will give a feedback as we try

1 Like