3

This is embarassing, but I am totally stuck and wasted the better part of this morning. I have an Erlang app release created by relx, deployed and running in a Docker container. I need to get to the shell on the running node, but I'm failing to do so. Here is what happens:

$ docker exec -it 770b497d7f27 /bin/bash
[root@ff /]# /app/bin/ff 
Usage: ff {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|escript|rpc|rpcterms}
[root@ff /]# /app/bin/ff ping
pong
[root@ff /]# /app/bin/ff attach
Can't access pipe directory /tmp/erl_pipes/ff@127.0.0.1/: No such file or directory
[root@ff /]# /app/bin/ff remote_console
Eshell V7.1  (abort with ^G)
(remshfbfbd4dd-ff@127.0.0.1)1> ^G
Eshell V7.1  (abort with ^G)
(remshfbfbd4dd-ff@127.0.0.1)1> 

And that's it - I can exit with q()..

There is no erl_pipes in /tmp.

Control-G seems to be captured by Docker. I cannot get to the "User switch command" menu.

Even running a pure Erlang shell is not so easy:

[root@ff /]# /app/erts-7.1/bin/erl
{"init terminating in do_boot",{'cannot get bootfile','/app/bin/start.boot'}}

Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()

I have run out of ideas. Any help would be appreciated.

egbokul
  • 3,944
  • 7
  • 36
  • 54
  • `remote_shell` is giving you a remote shell, but you also need ^G to work? – Michael Jan 07 '16 at 13:01
  • I'm trying to run a function defined in a module in the application, but the node seems to be empty - is this the same node the application is running on? If so, how do I access the application modules? – egbokul Jan 07 '16 at 15:17
  • I would certainly expect `remote_console` to connect you to the running nodes shell (sorry, I said 'remote_shell' above didn't I, but you knew what I meant I expect). If `remshfbfbd4dd-ff@127.0.0.1` isn't your node though then I guess it's not doing as I expect or not working. You can try manually by running `erl -name 'some_name@127.0.0.1' -cookie YOUR_COOKIE -remsh 'AppNodeName@127.0.0.1'`, which is going to be more or less what `/app/bin/ff remote_console` is doing. – Michael Jan 07 '16 at 15:30
  • Nope, it doesn't give me the app node's shell, just the one that starts it... – egbokul Jan 07 '16 at 15:42

1 Answers1

3

Found a workaround, managed to get ^G working by overriding the default "dumb" terminal docker sets:

export TERM=xterm

After this ^G works, starting a remote shell works, and I'm a happy camper! Would be glad to know why neither the attach nor the remote_console commands work though.

egbokul
  • 3,944
  • 7
  • 36
  • 54