diff --git a/config/plugins/interactive_environments/phinch/config/phinch.ini.sample b/config/plugins/interactive_environments/phinch/config/phinch.ini.sample new file mode 100644 index 00000000000..be08cb60848 --- /dev/null +++ b/config/plugins/interactive_environments/phinch/config/phinch.ini.sample @@ -0,0 +1,21 @@ +[main] +# Unused + +[docker] +# Command to execute docker. For example `sudo docker` or `docker-lxc`. +command = docker {docker_args} + +# The docker image name that should be started. +image = shiltemann/docker-phinch-galaxy:16.04 + +# Additional arguments that are passed to the `docker run` command. +#command_inject = --sig-proxy=true -e DEBUG=false + +# URL to access the Galaxy API with from the spawn Docker container, 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 = + +# The Docker hostname. It can be useful to run the Docker daemon on a different +# host than Galaxy. +#docker_hostname = localhost diff --git a/config/plugins/interactive_environments/phinch/config/phinch.xml b/config/plugins/interactive_environments/phinch/config/phinch.xml new file mode 100644 index 00000000000..3af1eee586b --- /dev/null +++ b/config/plugins/interactive_environments/phinch/config/phinch.xml @@ -0,0 +1,15 @@ + + + + + + HistoryDatasetAssociation + Biom1 + dataset_id + + + + dataset_id + + phinch.mako + \ No newline at end of file diff --git a/config/plugins/interactive_environments/phinch/static/js/phinch.js b/config/plugins/interactive_environments/phinch/static/js/phinch.js new file mode 100644 index 00000000000..1b4c993e554 --- /dev/null +++ b/config/plugins/interactive_environments/phinch/static/js/phinch.js @@ -0,0 +1,51 @@ +function load_notebook(url){ + $( document ).ready(function() { + test_ie_availability(url, function(){ + append_notebook(url) + }); + }); +} + +function append_notebook(url){ + clear_main_area(); + $('#main').append('' + ); +} + + +function keep_alive(notebook_access_url){ + /** + * This is needed to keep the container alive. If the user leaves this site + * this function is not constantly pinging the container, the container will + * terminate itself. + */ + + var request_count = 0; + interval = setInterval(function(){ + $.ajax({ + url: notebook_access_url, + xhrFields: { + withCredentials: true + }, + type: "GET", + timeout: 500, + success: function(){ + console.log("Connected to IE, returning"); + }, + error: function(jqxhr, status, error){ + request_count++; + console.log("Request " + request_count); + if(request_count > 30){ + clearInterval(interval); + clear_main_area(); + toastr.error( + "Could not connect to IE, contact your administrator", + "Error", + {'closeButton': true, 'timeOut': 20000, 'tapToDismiss': false} + ); + } + } + }); + }, 10000); +} + diff --git a/config/plugins/interactive_environments/phinch/templates/phinch.mako b/config/plugins/interactive_environments/phinch/templates/phinch.mako new file mode 100644 index 00000000000..c446bf7d6e5 --- /dev/null +++ b/config/plugins/interactive_environments/phinch/templates/phinch.mako @@ -0,0 +1,46 @@ +<%namespace name="ie" file="ie.mako" /> +<% + +import os + +# Sets ID and sets up a lot of other variables +ie_request.load_deploy_config() + + +# Launch the IE. This builds and runs the docker command in the background. +ie_request.launch(env_override={ + 'dataset_hid': hda.hid, + 'dataset_filename': hda.file_name +}) + +# Only once the container is launched can we template our URLs. The ie_request +# doesn't have all of the information needed until the container is running. +url = ie_request.url_template('${PROXY_URL}/phinch/') + + +%> + + +${ ie.load_default_js() } + + + +
+
+ +