IEx into Your Running App

Elixir supports getting a IEx shell into a running production node. How cool is that?

SSH Into Our App

To do this, we will login with SSH to our application VM. There are a couple one-time setup tasks for using SSH. Follow the instructions.

fly ssh establish
fly ssh issue --agent

With SSH configured, let's open a console.

fly ssh console
Connecting to hello_elixir.internal... complete
/ #

If all went smoothly, you have a shell to the machine!

Run IEx

Now we just need to launch our remote IEx shell. The command is named for your application. For this example it is:

app/bin/hello_elixir remote
Erlang/OTP 23 [erts-11.2.1] [source] [64-bit] [smp:1:1] [ds:1:1:10] [async-threads:1]

Interactive Elixir (1.11.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(hello_elixir@fdaa:0:1da8:a7b:ac4:b204:7e29:2)1>

You have a live IEx shell into your application!

Tip: One of several ways to exit the IEx shell is to hit Ctrl+C, Ctrl+C; to log out of the VM console, use Ctrl+D or exit.

What's Next?

With another quick update we can prepare our application for clustering by naming our nodes differently.

Next up, Naming Your Elixir Node!