We have an elixir app running in prod. I can SSH onto this box, but is it possible to connect to the app with an iex session? When I run ./bin/foobar start_iex I get an error:
Protocol 'inet_tcp': the name foobar@ip-1-2-3-4.ec2.internal seems to be in use by another Erlang node
I know something about --cookie and --sname to connect to a session, but I do not know how the prod app was started. Is it possible to know the cookie or session from bash command line? And is better to SSH onto box or to connect to remote iex session directly from my local computer?
Hi @dodo! and welcome to the community.
One way you could achieve that is:
Modify systemd service so it starts the application with the name (e.g. prod): elixir --sname prod -S mix phx.server
Now we can connect to it from the same machine with: iex --remsh prod --sname dev
I’ve never run this way in production, though… not sure if this is idiomatic =)