Distillery and dynamic node names

Hi all,

I am using distillery to create deployments. In my setup, I have a distributed OTP app of a coordinator node and several worker nodes. The nodes are called worker@127.0.0.1 and coordinator@127.0.0.1, respectively. This is fine so far, if each nodes run on its own machine. But what if I want to change the name of node at runtime? In particular for testing purposes, it would be nice to start several worker nodes on the same physical machine as worker1, worker2 or the like. But how can I do this with deployments created by distillery? Is this something for which a boot hook may be useful?

Thanks in advance,
Klaus.

1 Like

You can provide your own vm.args file which sets the name, you can’t change a node name at runtime, unless the node is started in non-distributed mode first, and then turned into a distributed node with :net_kernel.start/1. You can do the latter using vm.args and set things up to work that way in your code, but I would recommend just setting -name whatever@somehost in your vm.args file before starting each node.

1 Like

Ah, yes, I see. I also tried to set it dynamically via env variables referenced in vm.args. This is a bit clunky, I would prefer to the my application simply with a -name parameter, but it works well enough for testing purposes.

I agree, that for production use a properly generated vm.args-file is an appropriate way of naming nodes.

1 Like