mgwidmann

mgwidmann

Running local observer against a remote Docker

Having a lot of trouble getting this to work with a local Docker instance… I am trying to basically do the following:

  1. Run docker-compose up (on my machine or a remote)
  2. Start a local iex and start :observer
  3. Use the observer gui to connect to the remote host

I have figured out I need to do the following (but theres likely more I’m missing)

  • Add :runtime_tools to the :extra_applications section of my mix.exs file.
  • Expose the epmd port 4369 (maybe? I read somewhere it doesn’t allow external connections)
  • Set the cookie and name of the app

I cannot get a Node.ping/1 from my local to the docker instance to go through. Connecting from within the docker instance works fine but it doesnt have the display necessary to run observer (and I don’t want to forward it because I plan to use this against a remote docker in prod and I dont want the observer gui included). What am I missing?

Here are some of the resources I’ve come across (none of which have been any help)

First 7 of 7 Posts! Switch mode

bitwalker

bitwalker

Leader

My recommendation would be to use ssh and forward the ports across that connection, it won’t require you to expose the node, the connection will be encrypted, and you can secure it much better. To connect remotely though, you need to expose the epmd port, as well as the ephemeral range used for individual sessions, and make sure to configure that range in the kernel settings for distribution (you can find those in the erlang man page for the kernel app). I believe that’s all that’s needed. You can definitely connect to epmd remotely, that’s key to how erlang distribution works.

mgwidmann

mgwidmann

Yeah so I changed the epmd port in my docker instance so it wouldn’t conflict with the one running on my local machine by setting the environment variable ERL_EPMD_PORT to 43699 instead of the default 4369. But it sounds like I need to expose the port in which erlang distribution connects through. When I connect to the docker instance and run epmd -names it outputs a random port value, how can I set that to a specific range that I can then expose through docker?

mgwidmann

mgwidmann

Ok so I found how to set the min and max ports, heres my vm.args file:

-sname myapp
-kernel inet_dist_listen_min 6000 inet_dist_listen_max 6999
-cookie myapp

And my Dockerfile has

EXPOSE 6000-6100

With my docker-compose.yml

    ports:
      - "4000:4000"
      - "43699:43699"
      - "6000-6100:6000-6100"

And when I connect to my docker instance and run epmd -names I see the following:

$ docker exec -it f231ddad1d52 /bin/bash                                                                 ‹ruby-2.3.3›
root@f231ddad1d52:/app# epmd -names
epmd: up and running on port 43699 with data:
name myapp at port 6000
root@f231ddad1d52:/app#

But when I connect from my local:

$ ERL_EPMD_PORT=43699 iex --sname myapp --cookie myapp --hidden                                        ‹ruby-2.3.3›
Protocol 'inet_tcp': register/listen error: epmd_close

:cry:

matiso

matiso

The reason it doesn’t work is because epmd will only listen on the loopback interface. When connecting from your machine, docker binds the exposed port over the bridge interface, and epmd rejects it because of that.

So far I haven’t found a working solution, but I’m on it. Will report back if I get it running.

mgwidmann

mgwidmann

Found anything on this? I’m not sure I understand how EPMD would work if it only ever listened on loopback, how would machines connect then?

OvermindDL1

OvermindDL1

I have them communicate via SSH Tunnels, but you can always set ‘public’ names -name too. I highly recommend having EPMD communicate over tunnels as even just being publicly accessible can crash the BEAM systems via a variety of ways even before they connect a node.

kaashyapan

kaashyapan

This has been a lifesaver

https://github.com/chazsconi/connect-remote-elixir-docker

Where Next?

Trending in Questions Top

jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
michallepicki
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New

We're in Beta

About us Mission Statement