Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Attach an iex shell to a running elixir application

I have an elixir (mix) application running on heroku

I'm having issues attaching a remote iex shell to this application

The application is launched via this command :

web: MIX_ENV=prod elixir --sname server -S mix run --no-halt

I have no trouble attaching a shell locally

MIX_ENV=prod elixir --sname server -S mix run --no-halt
iex --sname console --remsh server@mru2

However, when trying it on heroku I'm having the following issue :

heroku run "iex --sname console --remsh server@41959264-bef2-4d2e-b5de-6dcf618efa44"
Running `iex --sname console --remsh server@41959264-bef2-4d2e-b5de-6dcf618efa44` attached to terminal... up, run.4421
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]

Could not contact remote node server@41959264-bef2-4d2e-b5de-6dcf618efa44, reason: :nodedown. Aborting...

It seems like the instance launched by heroku run cannot connect to the one running the server. I tried enforcing a common cookie, but to no avail.

What am I missing?

like image 994
MrRuru Avatar asked Sep 07 '15 21:09

MrRuru


1 Answers

I'm almost positive that nodes running on Heroku dynos aren't permitted to communicate with each other. But as long as the cookie is shared between the two nodes and you are connecting to the right fully-qualified name, then the steps you took above are correct.

like image 169
bitwalker Avatar answered Nov 13 '22 04:11

bitwalker