diff --git a/config/plugins/interactive_environments/ipython/config/ipython.ini.sample b/config/plugins/interactive_environments/ipython/config/ipython.ini.sample index b8c9e8ed007..b52d5760911 100644 --- a/config/plugins/interactive_environments/ipython/config/ipython.ini.sample +++ b/config/plugins/interactive_environments/ipython/config/ipython.ini.sample @@ -12,10 +12,10 @@ command = docker # The docker image name that should be started. -image = bgruening/docker-ipython-notebook:0.2 +image = bgruening/docker-ipython-notebook:dev # Additional arguments that are passed to the `docker run` command. -command_inject = --sig-proxy=true +command_inject = --sig-proxy=true -e DEBUG=false # 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 diff --git a/config/plugins/interactive_environments/ipython/templates/ipython.mako b/config/plugins/interactive_environments/ipython/templates/ipython.mako index 8f3a3d6655a..839e0328b33 100644 --- a/config/plugins/interactive_environments/ipython/templates/ipython.mako +++ b/config/plugins/interactive_environments/ipython/templates/ipython.mako @@ -11,8 +11,10 @@ ie_request.load_deploy_config() ie_request.attr.docker_port = 6789 # Create tempdir in galaxy temp_dir = os.path.abspath( tempfile.mkdtemp() ) -# Write out conf file...needs work -ie_request.write_conf_file(temp_dir) + +# Get all configurations +conf = ie_request.get_conf_dict() +ENV = ' '.join(['-e "%s=%s"' % (key.upper(), item) for key, item in conf.items()]) ## IPython Specific # Prepare an empty notebook @@ -34,9 +36,12 @@ else: notebook_access_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/notebooks/ipython_galaxy_notebook.ipynb') notebook_login_url = ie_request.url_template('${PROXY_URL}/ipython/${PORT}/login?next=%2Fipython%2F${PORT}%2Ftree') -docker_cmd = ie_request.docker_cmd(temp_dir) + +# Add all environment variables collected from Galaxy's IE infrastructure +docker_cmd = ie_request.docker_cmd(temp_dir).replace('run', 'run %s' % ENV) ie_request.log.info("Starting IPython docker container with command [%s]" % docker_cmd) subprocess.call(docker_cmd, shell=True) + %> diff --git a/config/plugins/interactive_environments/ipython/templates/notebook.ipynb b/config/plugins/interactive_environments/ipython/templates/notebook.ipynb index 97c8f2970f3..f44ffb39aec 100644 --- a/config/plugins/interactive_environments/ipython/templates/notebook.ipynb +++ b/config/plugins/interactive_environments/ipython/templates/notebook.ipynb @@ -20,7 +20,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "You can access your data via the dataset number. For example, ``handle = get(42)``.", + "You can access your data via the dataset number. For example, ``handle = open(get(42), 'r')``.", "To save data, write your data to a file, and then call ``put('filename.txt')``. The dataset will then be available in your galaxy history.", "Notebooks can be saved to Galaxy by clicking the large green button at the top right of the IPython interface.
", "More help and informations can be found on the project [website](https://github.com/bgruening/galaxy-ipython)." diff --git a/lib/galaxy/web/base/interactive_environments.py b/lib/galaxy/web/base/interactive_environments.py index f14fc7174d2..fddfc7aa2ef 100644 --- a/lib/galaxy/web/base/interactive_environments.py +++ b/lib/galaxy/web/base/interactive_environments.py @@ -6,9 +6,6 @@ import random from galaxy.util.bunch import Bunch from galaxy import web -from galaxy import eggs -eggs.require("PyYAML") -import yaml from galaxy.managers import api_keys import logging @@ -68,9 +65,9 @@ class InteractiveEnviornmentRequest(object): self.attr.APACHE_URLS = _boolean_option("apache_urls") self.attr.SSL_URLS = _boolean_option("ssl") - def write_conf_file(self, output_directory, extra={}): + def get_conf_dict(self, extra={}): """ - Build up a configuration file that is standard for ALL IEs. + Build up a configuration dictionary that is standard for ALL IEs. TODO: replace hashed password with plaintext. """ @@ -92,7 +89,9 @@ class InteractiveEnviornmentRequest(object): else: conf_file['galaxy_url'] = request.application_url.rstrip('/') + '/' web_port = self.attr.galaxy_config.galaxy_infrastructure_web_port - conf_file['galaxy_paster_port'] = web_port or self.attr.galaxy_config.guess_galaxy_port() + conf_file['galaxy_web_port'] = web_port or self.attr.galaxy_config.guess_galaxy_port() + # Galaxy paster port is deprecated + conf_file['galaxy_paster_port'] = conf_file['galaxy_web_port'] if self.attr.PASSWORD_AUTH: # Generate a random password + salt @@ -110,9 +109,7 @@ class InteractiveEnviornmentRequest(object): conf_file[extra_key] = extra[extra_key] self.attr.notebook_pw = notebook_pw - # Write conf - with open( os.path.join( output_directory, 'conf.yaml' ), 'wb' ) as handle: - handle.write( yaml.dump(conf_file, default_flow_style=False) ) + return conf_file def generate_hex(self, length): return ''.join(random.choice('0123456789abcdef') for _ in range(length)) diff --git a/lib/galaxy/web/proxy/js/lib/proxy.js b/lib/galaxy/web/proxy/js/lib/proxy.js index 242c063713e..ad4276d90e3 100644 --- a/lib/galaxy/web/proxy/js/lib/proxy.js +++ b/lib/galaxy/web/proxy/js/lib/proxy.js @@ -36,6 +36,23 @@ var DynamicProxy = function(options) { }; DynamicProxy.prototype.rewriteRequest = function(request) { + if(request.url.indexOf('rstudio') != -1){ + var remap = { + 'content-type': 'Content-Type', + 'content-length': 'Content-Length', + } + // RStudio isn't spec compliant and pitches a fit on NodeJS's http module's lowercase HTTP headers + for(var i = 0; i