Attach an iex shell to a running elixir application
Asked Answered
S

1

7

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?

Suspicious answered 7/9, 2015 at 21:35 Comment(0)
B
6

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.

Bloodshed answered 7/9, 2015 at 22:53 Comment(3)
Exactly. Heroku dynos are not allowed to communicate. That's why projects like Phoenix allow you to do pubsub over redis on Heroku.Boggess
Shame, guess I will need to find a different host. Thanks for the answerSuspicious
I am going to try flynn.io as a heroku replacement for this very reason.Foregone

© 2022 - 2024 — McMap. All rights reserved.