Iex --remsh with autocomplete

I’ve got my app deployed in a Docker container running on AWS. It’s working fine. I also got it set up so I could iex --remsh in using a static port. This command gets me to an iex prompt:

iex --name "me@remote.example.edu" --remsh "app@app.example.edu" --cookie MY_RELEASE_COOKIE

And from there I can do whatever I need to do. However, if I try to tab-complete anything, I get:

Interactive Elixir (1.9.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(app@app.example.edu)1> *** ERROR: Shell process terminated! (^G to start new job) ***

09:09:41.645 [error] Process #PID<0.76.0> on node :"me@remote.example.edu" raised an exception
** (BadFunctionError) function #Function<24.134130798/1 in IEx.Autocomplete> is invalid, likely because it points to an old version of the code
    (kernel) error_handler.erl:65: :error_handler.undefined_lambda/3
    (kernel) group.erl:596: :group.get_line1/5
    (kernel) group.erl:471: :group.get_chars_loop/9
    (kernel) group.erl:181: :group.io_request/6
    (kernel) group.erl:117: :group.server_loop/3

Which in and of itself isn’t terrible, because I can live without remote autocomplete. But I seem to lack the discipline to avoid hitting the tab key entirely, which borks my whole remsh session.

Any suggestions on how to make autocomplete work, or at least to swallow the tab without crashing my remote shell?

1 Like

Not exactly the answer you’re looking for, but one of the reasons I like using releases even inside docker is built in ./my_app remote_console. It just works. Perhaps looking at the command it runs will help guide you to what is missing from your --remsh effort?

Oh, we’re building (and using) a release inside docker. Maybe I just need to grab a copy of the same image and use it to run remote_console locally instead of trying to make this work on my own. Thanks!

Ah, the iex you’re running is on your computer and you’re trying to connect to a remote node? Are you exposing ports on the remote node for EPMD or are you doing SSH port forwarding?

For remote console I generally docker exec -ti some_container ./bin/my_app remote_console. Technically these days it’s all inside kubernetes so it’s kubectl exec -ti some_pod ./bin/my_app remote_console. If you want to docker exec you’ll need to have SSHed up (what I did back in the day) or port forwarded things properly (never got working).

Yes, I’m trying to connect to a remote node from my laptop. I’m just exposing the ports and using an AWS security group to lock down access to those ports to the right set of machines. There’s no SSH access at all. I can’t even docker exec into the running container because I don’t have a prompt on the host. We’re not using kube yet (though it’s on the roadmap) so I can’t do any fancy pod stuff either.

Problem Solved

Turned out to be much simpler (and more obvious) than I expected. My local elixir and OTP versions weren’t exactly the same as what was running on the server I was remsh-ing into. Fixed that, and I can now tab complete on the remote.

4 Likes