Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 431064

Summary: [terminal] Need to expose host ports from the terminal to the client
Product: [ECD] Orion Reporter: Anthony Hunter <ahunter.eclipse>
Component: DockerAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 6.0   
Target Milestone: 6.0 M1   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Anthony Hunter CLA 2014-03-24 18:07:45 EDT
When you start an application in the terminal, the host port should be exposed to the client.

As an example, now that we have a terminal for node.js developers with node and node-inspector, we need to expose these ports to the client.

By default, node-inspector is started on port 5858.

Also by default, node applications starts on port 8080.

Since there are many terminals (docker containers) running on the docker server, we need to take advantage of the exposed ports and mappings feature of docker (http://docs.docker.io/en/latest/use/port_redirection/).
Comment 1 Anthony Hunter CLA 2014-03-24 18:29:21 EDT
Delivered this new enhancement to the terminal with commits:
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=52b9a64e53d2148e780763299b08c12d9ff6978e
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=e846bc46afb4eed0be43ea68df7916d3a9cfff26

First change is to the dockerServer configuration on the Orion server. The administrator must specify two settings in the orion.conf:
orion.core.docker.port.start=12000
orion.core.docker.port.end=13000

This specifies the range of ports that can be exposed on the Docker server. In this case, we specify ports 12000-13000 can be used by the terminal.

Second change is to specify which ports should be exposed for the user in the Dockerfile. In this case, we added two ports to the Docker.user template, one for the "server" and one for the "debug server". Given we are targeting node.js developers, we added:
EXPOSE 8080
EXPOSE 5858

Third set of changes is to hook into the Docker remote API to do the port mappings.

Fourth set of changes was to update the informational /docker/image, /docker/container, and /docker/containers handlers to list the ExposedPorts.

In the default case as described above, the end user will be able to run node and node-inspector as follows:

In the terminal node-inspector is started on port 5858, it will map to exposed host port 12000 by default.
The user also starts the node application, on port 8080, it will map to exposed port 12001 by default.

So the user tests the running node application on a client browser using http://localhost:12001 and debugs using node-inspector at http://localhost:12001/debug?port=12000