nelson.gui icon indicating copy to clipboard operation
nelson.gui copied to clipboard

nelson.cli in other cotainer

Open antonionardella opened this issue 7 years ago • 8 comments

Hello Roman,

I'm again trying to build a docker-compose file. My setup:

  • docker server IP 10.0.0.x
    • 4 containers:
      • iri
      • nelson.cli with hostname=nelson.cli
      • nelson.mon with hostname=nelson.mon
      • nelson.gui with hostname=nelson.gui

nelson.mon is connecting to nelson.cli:18600 and works fine. nelson.gui runs on 10.0.0.x:5000 and can ping nelson.cli if I'm inside the cotainer, but is not able to connect to nelson.cli:18600. I've also tried: http://10.0.0.x:5000/nelson.cli/18600, with no success.

From what I understand (please bear with me, I'm not a developer), the nelson.gui is trying to connect to localhost:18600 through my browser, therefore cannot see the server. If i go to http://10.0.0.x:5000/nelson.cli/18600 it's still my browser trying to connect to nelson.cli. My browser is running on my notebook, while nelson.cli is running on my server and my notebook doesn't know anything about nelson.cli. This means that the nelson.gui is not talking to nelson.cli, but my notebook is, this may never work for similar setups. Please tell me if I'm wrong with this assumption.

To make it work, I had to give nelson.cli a public hostname like nelsoncli.mydomain.com and modify /src/redux/nelson-api.js to point to this url. At this point the nelson.gui started working.

Is this by design or am I just hacking around in the blind and there is an easier way?

Thanks, Antonio

antonionardella avatar Dec 22 '17 12:12 antonionardella

Hi Antonio, you have to run nelson.cli with "--apiHostname 0.0.0.0" so that it listens to non-local connections.

Then you run nelson.gui and access it in your browser like:

http://<nelson-gui-host-or-ip>:<nelson-gui-port>/<nelson-cli-host-or-ip>/<nelson-cli-api-port>

romansemko avatar Dec 22 '17 14:12 romansemko

Hi,

my nelson.cli is running on 0.0.0.0 inside a docker container with hostname nelson.cli, nelson.mon is working with this setup.

But from my understanding nelson.gui if I set http://SERVERIP:5000/nelson.cli/18600 makes my browser which run on my notebook (not server), try to connect to the host nelson.cli. The notebook does not know this host, since it is a docker container on the server and therefore not reachable from the outside. The nelson.cli is reachable from the server instance, that is why nelson.mon works if it points to nelson.cli.

All the best, Antonio

antonionardella avatar Dec 22 '17 15:12 antonionardella

Then, instead of "nelson.cli" you have to use your server ip: http://SERVERIP:5000/SERVERIP/18600

romansemko avatar Dec 22 '17 15:12 romansemko

OMG, of course.. that's clear! Thanks again!

antonionardella avatar Dec 22 '17 15:12 antonionardella

Sorry, have to reopen it. Curl is working, the nelson.gui is not: https://imgur.com/a/0wn7w

antonionardella avatar Dec 22 '17 16:12 antonionardella

This IP address looks like an internal/local address. Is your browser running on a machine in the same network so it knows how to access that IP?

romansemko avatar Dec 23 '17 16:12 romansemko

Yes, the browser has access to that IP. Today after updating the docker images it works like a charm!

antonionardella avatar Dec 23 '17 22:12 antonionardella

Hi,

I've tried with the new version and added username and password. Tried the following links:

http://antonionardella.eu:5000/antonionardella.eu/18600/#/nelsonuser:nelsonpass

gives:

Cannot GET /antonionardella.eu/18600/

This one:

http://antonionardella.eu:5000/#/nelsonuser:nelsonpass/antonionardella.eu/18600/

Gives a blank page.

antonionardella avatar Feb 26 '18 11:02 antonionardella