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 is a one-time setup task for using SSH. Follow the instructions.
fly ssh issue --agent
With SSH configured, let's open a console.
fly ssh console --pty -C "/app/bin/hello_elixir remote"
Connecting to hello_elixir.internal... complete 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
--ptyflag tells the SSH server to run the command in a pseudo-terminal. You will generally need this only when running interactive commands, like IEx.
With another quick update we can prepare our application for clustering by naming our nodes differently.
Next up, Naming Your Elixir Node!