Using the Erlang Observer App with a remote Elixir Phoenix server inside Docker Using the Erlang Observer App with a remote Elixir Phoenix server inside Docker docker docker

Using the Erlang Observer App with a remote Elixir Phoenix server inside Docker


Can I start a Phoenix server without needing to know the IP address and still be able to remotely connect with Observer?

Yes, with DNS you can. Of course you will at least need to know the fully qualified domain name of the server running the Erlang node. While not quite as short as an Erlang node short name (e.g. node@server) it's still probably better than an IP address. I'm not too familiar with Docker, so it may be easier to stick with an IP address. In this situation it doesn't get you a whole lot.

Once I have that running then I expect to run Observer like this

erl -name observe@127.0.0.1 -setcookie random_cookie -run observer

What server are you running this command on? It will need to be on a machine that has Erlang compiled with Wx support. If this is on a different machine than the one you are running your Phoenix server on this will not work (which is what I understand to be the case).

You will need to do something like this instead:

  1. Find the epmd port on the container running phoenix

    $ ssh phoenix-host "epmd -names"epmd: up and running on port 4369 with data:name some_phoenix_node at port 58769

    Note the port for epmd itself and the port of the node you're interested in debugging. Reconnect to the phoenix host with the ports you found forwarded:

    $ ssh -L 4369:localhost:4369 -L 58769:localhost:58769 phoenix-host
  2. On your machine, start a hidden Erlang node running the observer app:

    $ iex -name debug@127.0.0.1 -setcookie <phoenix-server-cookie> -hidden -run observer

    The app should open up and you should be able to select the node running the phoenix server.

Source: https://gist.github.com/pnc/9e957e17d4f9c6c81294

Update 2/20/2017

I wrote a script that can do the above automatically. All ports epmd knows about are forwarded to localhost: https://github.com/Stratus3D/dotfiles/blob/master/scripts/tools/epmd_port_forwarder