mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Unify the docker command, command_inject, and command_wrapper
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
[main]
|
||||
|
||||
# Following options are ignored if using the Galaxy dynamic proxy but
|
||||
# are useful if mapping a range of ports for environment consumption.
|
||||
#apache_urls = False
|
||||
@@ -7,26 +6,18 @@
|
||||
#ssl = False
|
||||
|
||||
[docker]
|
||||
|
||||
# Command to execute docker. For example `sudo docker` or `docker-lxc`.
|
||||
command = docker
|
||||
# Command to launch docker container. For example `sudo docker` or `docker-lxc`.
|
||||
# If you need to use a command like `sg` you can do that here, just be sure to
|
||||
# wrap all of the docker portion in single quotes. E.g. `sg 'docker' 'docker {docker_args}'`
|
||||
command = docker run --sig-proxy=true -e DEBUG=false {docker_args}
|
||||
|
||||
# The docker image name that should be started.
|
||||
image = bgruening/docker-ipython-notebook:dev
|
||||
|
||||
# Additional arguments that are passed to the `docker run` command.
|
||||
command_inject = --sig-proxy=true -e DEBUG=false
|
||||
|
||||
# Command to wrap around the full docker command.
|
||||
# For example, `sg 'docker' '{cmd}'` where {cmd} will be replaced by the full
|
||||
# docker command. Make sure to surround the {cmd} with single quotes(').
|
||||
# Default: empty
|
||||
#command_wrapper =
|
||||
|
||||
# URL to access the Galaxy API with from the spawn Docker containter, if empty
|
||||
# this falls back to galaxy.ini's galaxy_infrastructure_url and finally to the
|
||||
# Docker host of the spawned container if that is also not set.
|
||||
#galaxy_url =
|
||||
#galaxy_url =
|
||||
|
||||
# The Docker hostname. It can be useful to run the Docker daemon on a different
|
||||
# host than Galaxy.
|
||||
@@ -35,4 +26,4 @@ command_inject = --sig-proxy=true -e DEBUG=false
|
||||
# Try to set the tempdirectory to world execute - this can fix the issue
|
||||
# where 'sudo docker' is not able to mount the folder otherwise.
|
||||
# "finalize namespace chdir to /import permission denied"
|
||||
wx_tempdir = False
|
||||
wx_tempdir = False
|
||||
|
||||
@@ -1,19 +1,30 @@
|
||||
[main]
|
||||
# This cannot be changed
|
||||
password_auth = True
|
||||
# Other
|
||||
apache_urls = False
|
||||
ssl = False
|
||||
# Following options are ignored if using the Galaxy dynamic proxy but
|
||||
# are useful if mapping a range of ports for environment consumption.
|
||||
#apache_urls = False
|
||||
#ssl = False
|
||||
|
||||
[docker]
|
||||
command = docker
|
||||
# Command to launch docker container. For example `sudo docker` or `docker-lxc`.
|
||||
# If you need to use a command like `sg` you can do that here, just be sure to
|
||||
# wrap all of the docker portion in single quotes. E.g. `sg 'docker' 'docker {docker_args}'`
|
||||
command = docker run --sig-proxy=true -e DEBUG=false {docker_args}
|
||||
|
||||
# The docker image name that should be started.
|
||||
image = erasche/docker-rstudio-notebook:dev
|
||||
|
||||
# Additional arguments that are passed to the `docker run` command. `-u`
|
||||
# settings are completely ignored.
|
||||
command_inject = --sig-proxy=true -e DEBUG=false
|
||||
|
||||
# URL to access the Galaxy API with from the spawned Docker container, if empty
|
||||
# URL to access the Galaxy API with from the spawn Docker containter, if empty
|
||||
# this falls back to galaxy.ini's galaxy_infrastructure_url and finally to the
|
||||
# Docker host of the spawned container, if that is also not set.
|
||||
#galaxy_url=
|
||||
# Docker host of the spawned container if that is also not set.
|
||||
#galaxy_url =
|
||||
|
||||
# The Docker hostname. It can be useful to run the Docker daemon on a different
|
||||
# host than Galaxy.
|
||||
#docker_hostname = localhost
|
||||
|
||||
# Try to set the tempdirectory to world execute - this can fix the issue
|
||||
# where 'sudo docker' is not able to mount the folder otherwise.
|
||||
# "finalize namespace chdir to /import permission denied"
|
||||
wx_tempdir = False
|
||||
|
||||
@@ -65,7 +65,6 @@ class InteractiveEnviornmentRequest(object):
|
||||
# will need to be recorded here. The ConfigParser doesn't provide a
|
||||
# .get() that will ignore missing sections, so we must make use of
|
||||
# their defaults dictionary instead.
|
||||
default_dict['command_inject'] = '--sig-proxy=true'
|
||||
default_dict['docker_hostname'] = 'localhost'
|
||||
default_dict['wx_tempdir'] = 'False'
|
||||
default_dict['command_wrapper'] = ''
|
||||
@@ -182,18 +181,23 @@ class InteractiveEnviornmentRequest(object):
|
||||
conf.update(env_override)
|
||||
env_str = ' '.join(['-e "%s=%s"' % (key.upper(), item) for key, item in conf.items()])
|
||||
volume_str = ' '.join(['-v "%s"' % volume for volume in volumes])
|
||||
cmd = '%s run %s -d %s -p %s:%s -v "%s:/import/" %s %s' % \
|
||||
(self.attr.viz_config.get("docker", "command"),
|
||||
env_str,
|
||||
self.attr.viz_config.get("docker", "command_inject"),
|
||||
self.attr.PORT, self.attr.docker_port,
|
||||
temp_dir,
|
||||
volume_str,
|
||||
self.attr.viz_config.get("docker", "image"))
|
||||
cmd_wrapper = self.attr.viz_config.get("docker", "command_wrapper")
|
||||
if cmd_wrapper != '' and '{cmd}' in cmd_wrapper:
|
||||
cmd = cmd_wrapper.format( cmd=cmd )
|
||||
return cmd
|
||||
# This is the basic docker command such as "sudo -u docker docker {docker_args}"
|
||||
# or just "docker {docker_args}"
|
||||
command = self.attr.viz_config.get("docker", "command")
|
||||
# Then we format in the entire docker command in place of
|
||||
# {docker_args}, so as to let the admin not worry about which args are
|
||||
# getting passed
|
||||
command = command.format(docker_args='{environment} -d -p {port_ext}:{port_int} -v "{temp_dir}:/import/" {volume_str} {image}')
|
||||
# Once that's available, we format again with all of our arguments
|
||||
command = command.format(
|
||||
environment=env_str,
|
||||
port_ext=self.attr.PORT,
|
||||
port_int=self.attr.docker_port,
|
||||
temp_dir=temp_dir,
|
||||
volume_str=volume_str,
|
||||
image=self.attr.viz_config.get("docker", "image")
|
||||
)
|
||||
return command
|
||||
|
||||
def launch(self, raw_cmd=None, env_override={}, volumes=[]):
|
||||
if raw_cmd is None:
|
||||
|
||||
Reference in New Issue
Block a user