Merge pull request #3328 from bgruening/ie_port_overwrite

IE enhancement
This commit is contained in:
Eric Rasche
2016-12-17 22:32:36 +00:00
committed by GitHub
2 changed files with 17 additions and 3 deletions
@@ -40,3 +40,7 @@ command_inject = --sig-proxy=true -e DEBUG=false -e DEFAULT_CONTAINER_RUNTIME=12
# share data between the IE and Galaxy.
#docker_galaxy_temp_dir = None
# If your Docker container exposes more then one port, Galaxy needs to know to
# which ports it needs to connect. With this option you can specify the port number
# inside your container to which Galaxy should connect the UI.
# docker_connect_port = None
@@ -42,6 +42,7 @@ class InteractiveEnvironmentRequest(object):
self.load_deploy_config()
self.load_allowed_images()
self.attr.docker_hostname = self.attr.viz_config.get("docker", "docker_hostname")
self.attr.docker_connect_port = self.attr.viz_config.get("docker", "docker_connect_port") or None
# Generate per-request passwords the IE plugin can use to configure
# the destination container.
@@ -306,13 +307,22 @@ class InteractiveEnvironmentRequest(object):
port_mappings = self.get_container_port_mapping(inspect_data)
self.attr.docker_hostname = self.get_container_host(inspect_data)
log.debug( "Container host: %s", self.attr.docker_hostname )
host_port = None
if len(port_mappings) > 1:
log.warning("Don't know how to handle proxies to containers with multiple exposed ports. Arbitrarily choosing first")
if self.attr.docker_connect_port is not None:
for _service, _host_ip, _host_port in port_mappings:
if _service == self.attr.docker_connect_port:
host_port = _host_port
else:
log.warning("Don't know how to handle proxies to containers with multiple exposed ports. Arbitrarily choosing first. Please set 'docker_connect_port' in your config file to be more specific.")
elif len(port_mappings) == 0:
log.warning("No exposed ports to map! Images MUST EXPOSE")
return None
# Fetch the first port_mapping
(service, host_ip, host_port) = port_mappings[0]
if host_port is None:
# Fetch the first port_mapping
(service, host_ip, host_port) = port_mappings[0]
# Now we configure our proxy_requst object and we manually specify
# the port to map to and ensure the proxy is available.