Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to visualize another app? #20

Open
jaimeiniesta opened this issue May 15, 2018 · 13 comments
Open

How to visualize another app? #20

jaimeiniesta opened this issue May 15, 2018 · 13 comments

Comments

@jaimeiniesta
Copy link

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?

@OvermindDL1
Copy link

[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())?

@luc-tielen
Copy link
Contributor

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?

@jaimeiniesta
Copy link
Author

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.

@koudelka
Copy link
Owner

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.

@jaimeiniesta
Copy link
Author

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.

@koudelka
Copy link
Owner

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?

@OvermindDL1
Copy link

OvermindDL1 commented May 16, 2018

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.

@jaimeiniesta
Copy link
Author

jaimeiniesta commented May 17, 2018

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

@koudelka
Copy link
Owner

I'm a little stumped.

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

@jaimeiniesta
Copy link
Author

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

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

@OvermindDL1
Copy link

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

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

@Siiiimon
Copy link

Siiiimon commented Apr 8, 2019

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

@gregors
Copy link

gregors commented Aug 17, 2019

I was also having problems on OSX - seems related to this elixir-lang/elixir#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants