Release with distillery and sname not able to remote connect

I was able to build a release with distillery and provide a sname instead of a name

## Node name
-sname myapp

## Node cookie, used for distribution
-setcookie 123

I started this on my local machine for testing. Now I tried to connect via remote shell and get the following error:

2017-08-19 14:38:32 ** System NOT running to use fully qualified hostnames **~n** Hostname ~ts is illegal **~n

I tried the following options:

iex --sname debug --cookie '123' --remsh myapp@`hostname`
iex --sname debug --cookie '123' --remsh myapp@localhost
iex --sname debug --cookie '123' --remsh myapp@127.0.0.1
iex --sname debug --cookie '123' --remsh myapp@192.168.178.20

Always yielding the same error. Am I doing something wrong?

What’s the hostname of your machine? For example, if I start a release with --sname foo, on my macbook, which has a hostname of mymachine.local, I can connect to it with --remsh foo@mymachine. As you can see it’s dropping the TLD. My recommendation is to always use -name and specify the hostname to use – as long as it’s routable on the machine, (i.e. 127.0.0.1 or localhost) it will work for remote shells started on that machine. If you need to access it from another machine, then it needs to be routable from that machine, so using a DNS name makes more sense.

That worked, thatnks a lot! The name option would have been my backup, I’ll see what’s more convenient in production.

OK follow up. I’m running my release in a docker container and specified the name like this:

-name <%= release_name %>@${HOSTNAME}

I started the app with REPLACE_OS_VARS=true and verified that the name was set correctly:

# vm.args
-name myapp@66277af8dc0e

But now when I connect from a different docker container (same network, same subnet) via:

iex --name debug --cookie 'secretcookie' --remsh myapp@66277af8dc0e

I get the error:

2017-08-19 18:57:25 Can't set long node name!
Please check your configuration

The same happens if I set the name via -sname:

#vm.args
-sname <%= release_name %>

I figured out a way to connect to the node via the local ip address:

basically make sure that name contains the ip address (not the hostname) like described here: Dynamic node naming with distillery?. then i can connect via:

iex --name debug --cookie 'secretcookie' --remsh myapp@172.16.0.109

that works but is not ideal. Is there any way to call the remote shell via the hostname?

You need to specify the host name with --name debug@<hostname_or_ip>, that’s why it’s complaining about not being able to set the long node name. Otherwise it should work fine as long as the hostnames are routable (i.e. you should be able to ping the hostname from the host attempting the remote connection, assuming your network is allowing ICMP traffic).

Mmmh played around a little more. I just don’t get it to work.

I’m using this command:

iex --name debug@`hostname` --cookie 'secretcookie' --remsh myapp@172.16.0.109

that works, it only works when I specify name with --name with debug@<something> doesn’t matter but it only works with the long name. debug alone does not work.

I’d like to rename the remsh parameter though with the hostname. I did not get to work it at all. I always get the error:

2017-08-19 23:00:16 ** System running to use fully qualified hostnames **~n** Hostname ~ts is illegal **~n
        "6760f2ccdb70"

The name configuration when starting the app is the following:

-name <%= release_name %>@${IP_ADDR}

and all variables are replaced correctly

It seems as if the beam is not recognizing the containers name as a valid fully qualified domain name. It seems to want a dot and a tld in there.

An nslookup 6760f2ccdb70 revealed:

Address 1: 172.16.0.109 6760f2ccdb70.hypernetes

(I’m running on hyper.sh). Setting the hostname in the vm.args to that and then using it in the iex command worked like a charm.

Not sure which solution I prefer though…