visualixir icon indicating copy to clipboard operation
visualixir copied to clipboard

How to visualize another app?

Open jaimeiniesta opened this issue 6 years ago • 13 comments

Hello!

I'm trying to visualize a Elixir 1.6 / Phoenix app I have running in my machine. I launch it like this:

elixir --sname myapp -S mix phx.server

and then I run visualixir like this:

elixir --sname visualixir --hidden -S mix phoenix.server

Then I add the node in the GUI (myapp@holly) but nothing happens on the GUI. I see this on the logs:

[debug] INCOMING "add" on "nodes" to VisualixirWeb.NodesChannel
  Transport:  Phoenix.Transports.WebSocket
  Parameters: "myapp@holly"
[debug] Pinging node myapp@holly returned :pang

What am I doing wrong?

jaimeiniesta avatar May 15 '18 09:05 jaimeiniesta

[debug] Pinging node myapp@holly returned :pang

Does the first node actually return myapp@holly (or rather in Elixir :"myapp@holly") when you run node(). (in Elixir :erlang.node())?

OvermindDL1 avatar May 15 '18 14:05 OvermindDL1

If I run iex --sname hello then I get:

Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Interactive Elixir (1.6.4) - press Ctrl+C to exit (type h() ENTER for help)
iex(hello@MacBook-Pro-van-Luc)1>

So my node name would be hello@MacBook-Pro-van-Luc. Fill that in when running visualixir and it should work? What does your terminal show you when running above command?

luc-tielen avatar May 15 '18 20:05 luc-tielen

I start my app with:

iex --sname myapp -S mix phx.server

From iex, the node is:

iex(myapp@holly)2> :erlang.node()
:myapp@holly

I have tried both myapp@holly and :myapp@holly and I still get the [debug] Pinging node :myapp@holly returned :pang log message.

jaimeiniesta avatar May 16 '18 11:05 jaimeiniesta

Curious.

From the visualixir iex session, does Node.ping(:"myapp@holly") also give you :pang?

I wonder if epmd isn't running for some reason.

koudelka avatar May 16 '18 12:05 koudelka

From the visualixir iex session, does Node.ping(:"myapp@holly") also give you :pang?

Yes, it takes some seconds to respond, and finally returns :pang.

jaimeiniesta avatar May 16 '18 13:05 jaimeiniesta

It's interesting that it takes a few seconds… it sounds like maybe it's trying to connect to an external host. Does holly have an entry in /etc/hosts?

What does epmd -names give you, with both nodes running?

koudelka avatar May 16 '18 15:05 koudelka

It's interesting that it takes a few seconds…

5 seconds should be the normal timeout so that makes sense.

What does epmd -names give you, with both nodes running?

This is definitely the next step.

OvermindDL1 avatar May 16 '18 15:05 OvermindDL1

Does holly have an entry in /etc/hosts?

No it doesn't. holly is the name of my computer (OSX).

What does epmd -names give you, with both nodes running?

➔ epmd -names
epmd: up and running on port 4369 with data:
name visualixir at port 57596
name myapp at port 57590

jaimeiniesta avatar May 17 '18 08:05 jaimeiniesta

I'm a little stumped.

Does nc -w 0 localhost 57596 && echo $? give you 0?

koudelka avatar May 17 '18 16:05 koudelka

Does nc -w 0 localhost 57596 && echo $? give you 0?

No, it doesn't return 0, it returns $.

jaimeiniesta avatar May 29 '18 11:05 jaimeiniesta

No, it doesn't return 0, it returns $.

Uh, echo $? should return an integral value, and $ is not integral... What shell are you using?

OvermindDL1 avatar May 29 '18 16:05 OvermindDL1

hi, i have the same problem here

I am running on a MacOS Mojave 10.14.4 with elixir/mix 1.8.1 using Zsh (as a shell)

my app is started with elixir --sname myapp -S mix run --no-halt since it is not using the full phoenix framework, but only Plug, Cowboy and Absinthe

it is discoverable using epmd -names and nc -w 0 localhost 57596 && echo $? (using the correct port number) returns 0

Siiiimon avatar Apr 08 '19 22:04 Siiiimon

I was also having problems on OSX - seems related to this https://github.com/elixir-lang/elixir/issues/3955

I did get it to work doing the following:

  • make sure sname has localhost elixir --sname visualixir@localhost -S mix phx.server
  • same for the second app iex --sname having_fun@localhost
  • manually connect Node.connect :visualixir@localhost

Once I manually connected, refresh page and the node appears.

gregors avatar Aug 17 '19 04:08 gregors