Custom interactive tool using panoply as template

Hi,

I am struggling to get a custom interactive tool working. From gitter/admin I got suggested by Bjørn and Helena to base my attempt on existing tools. The panoply tool seemed most suitable to me.

What I have done

  1. Added the panoply tool as it is. Works as expected on our galaxy instance. I use the same job destination definition as my custom tool (interactive_slurm_general, see below).

  2. Testing custom tool outside galaxy:

docker run --rm -p 5800:5800 maikenp/comphep-ubuntu-gui

Runs as expected. I see the comphep tool and can use it.

  1. Implementation in galaxy: First of all the tool exits right away. Putting a sleep 360 I can get it running. However I see: “Proxy target missing” when I try to access the interactive tool running in galaxy. I use the same destination for my custom tool as for the panoply tool.

  1. The docker run command that the galaxy produces for the comphep tool is the following:
docker run -e "GALAXY_SLOTS=$GALAXY_SLOTS" -e "HOME=$HOME" -e "_GALAXY_JOB_HOME_DIR=$_GALAXY_JOB_HOME_DIR" -e "_GALAXY_JOB_TMP_DIR=$_GALAXY_JOB_TMP_DIR" -e "TMPDIR=$TMPDIR" -e "TMP=$TMP" -e "TEMP=$TEMP" -p 5800 --name 88eba70b849646718ebe23e4cb668b88 -v /srv/galaxy/server:/srv/galaxy/server:ro -v /srv/galaxy/local_tools/interactive:/srv/galaxy/local_tools/interactive:ro -v /storage/galaxy/jobs_directory/001/1741:/storage/galaxy/jobs_directory/001/1741:ro -v /storage/galaxy/jobs_directory/001/1741/outputs:/storage/galaxy/jobs_directory/001/1741/outputs:rw -v /storage/galaxy/jobs_directory/001/1741/configs:/storage/galaxy/jobs_directory/001/1741/configs:rw -v /storage/galaxy/jobs_directory/001/1741/working:/storage/galaxy/jobs_directory/001/1741/working:rw -v /storage/galaxy/files:/storage/galaxy/files:rw -v /srv/galaxy/var/tool-data:/srv/galaxy/var/tool-data:ro -v /srv/galaxy/var/tool-data:/srv/galaxy/var/tool-data:ro -v "$_GALAXY_JOB_TMP_DIR:$_GALAXY_JOB_TMP_DIR:rw" -w /storage/galaxy/jobs_directory/001/1741/working --net bridge --rm maikenp/comphep-ubuntu-gui:latest /bin/sh /storage/galaxy/jobs_directory/001/1741/tool_script.sh > ../outputs/tool_stdout 2> ../outputs/tool_stderr; return_code=$?; cd '/storage/galaxy/jobs_directory/001/1741'; 
  1. The docker run command for the panoply tool (which works) is the following:
docker run -e "GALAXY_SLOTS=$GALAXY_SLOTS" -e "HOME=$HOME" -e "_GALAXY_JOB_HOME_DIR=$_GALAXY_JOB_HOME_DIR" -e "_GALAXY_JOB_TMP_DIR=$_GALAXY_JOB_TMP_DIR" -e "TMPDIR=$TMPDIR" -e "TMP=$TMP" -e "TEMP=$TEMP" -p 5800 --name 49e8f15c4be9441593615daa32392a89 -v /srv/galaxy/server:/srv/galaxy/server:ro -v /srv/galaxy/local_tools/interactive:/srv/galaxy/local_tools/interactive:ro -v /storage/galaxy/jobs_directory/001/1742:/storage/galaxy/jobs_directory/001/1742:ro -v /storage/galaxy/jobs_directory/001/1742/outputs:/storage/galaxy/jobs_directory/001/1742/outputs:rw -v /storage/galaxy/jobs_directory/001/1742/configs:/storage/galaxy/jobs_directory/001/1742/configs:rw -v /storage/galaxy/jobs_directory/001/1742/working:/storage/galaxy/jobs_directory/001/1742/working:rw -v /storage/galaxy/files:/storage/galaxy/files:rw -v /srv/galaxy/var/tool-data:/srv/galaxy/var/tool-data:ro -v /srv/galaxy/var/tool-data:/srv/galaxy/var/tool-data:ro -v "$_GALAXY_JOB_TMP_DIR:$_GALAXY_JOB_TMP_DIR:rw" -w /storage/galaxy/jobs_directory/001/1742/working --net bridge --rm quay.io/nordicesmhub/docker-panoply:4.5.1 /bin/sh /storage/galaxy/jobs_directory/001/1742/tool_script.sh > ../outputs/tool_stdout 2> ../outputs/tool_stderr; return_code=$?; cd '/storage/galaxy/jobs_directory/001/1742'; 

Questions:
a) At the moment I dont need anything actually done in the tool except that it should run. Can the comand field of the tool wrapper be more or less empty as I have it now? It seems not, as the tool then exits right away? Or could the exit be due to other underlying problems?

b) Can you spot other things that don’t seem right with the Dockerfile/startapp.sh/tool-wrapper?

Dockerfile:

FROM jlesage/baseimage-gui:ubuntu-18.04
MAINTAINER Maiken Pedersen, maikenp@uio.no

RUN apt-get update -y && \
     DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
         build-essential \
	 libx11-dev \
	 libgfortran5 \
	 emacs \
	 wget \ 
	 gfortran && \
     rm -rf /var/lib/apt/lists/*

USER root
COPY startapp.sh /startapp.sh

RUN mkdir -p /opt/comphep && cd /opt/comphep/ && wget https://theory.sinp.msu.ru/lib/exe/fetch.php/comphep/download/comphep-4.5.2.tgz && tar -zxf  comphep-4.5.2.tgz && \
    cd /opt/comphep/comphep-4.5.2 && \
    ./configure && \
    make && \
    make setup WDIR=/opt/comphep_wd

ENV APP_NAME="COMPHEP"
RUN chown 1000:1000 -R /opt/comphep_wd
WORKDIR /opt/comphep_wd

startapp.sh:

#!/bin/sh
cd  /opt/comphep_wd
exec /opt/comphep_wd/comphep

tool-wrapper:

<tool id="interactive_tool_comphep_gui" tool_type="interactive" name="COMPHEP ubuntu-gui" version="1.0.0">
    <requirements>
      <container type="docker">maikenp/comphep-ubuntu-gui:latest</container>
    </requirements>
    <entry_points>
        <entry_point name="COMPHEP" requires_domain="True">
            <port>5800</port>
        </entry_point>
    </entry_points>
    
    <command detect_errors="exit_code">
    <![CDATA[
        mkdir output &&
	sleep 360
    ]]>
    </command>

    <outputs>
      <data name="outputs" label="COMPHEP outputs">
	<discover_datasets pattern="__name_and_ext__"  directory="output"/>
      </data>
    </outputs>
    
</tool>

job_conf.xml relevant section for the destination:

<destination id="interactive_slurm_general" runner="slurm">
            <param id="nativeSpecification">--time=72:00:00 --mem-per-cpu=8</param>
            <param id="docker_enabled">true</param>
            <param id="docker_volumes">$defaults</param>
            <param id="docker_sudo">false</param>
            <param id="docker_net">bridge</param>
            <param id="docker_auto_rm">true</param>
            <param id="docker_set_user"></param>
            <param id="require_container">true</param>
        </destination>

Thanks to Anne she pointed out that I was missing /init statement which is needed by galaxy.

That solved it all, everything seems to be working perfectly.

So my tool now looks like:

<tool id="interactive_tool_comphep_gui" tool_type="interactive" name="COMPHEP ubuntu-gui" version="1.0.0">
    <requirements>
      <container type="docker">maikenp/comphep-ubuntu-gui:latest</container>
    </requirements>
    <entry_points>
        <entry_point name="COMPHEP" requires_domain="True">
            <port>5800</port>
        </entry_point>
    </entry_points>
    
    <command detect_errors="exit_code">
    <![CDATA[
        mkdir output &&
	cd - &&
        /init ;
	touch output/test.txt &&
        echo "Hi!" > output/test.txt &&
	sleep 360
    ]]>
    </command>

    <outputs>
      <data name="outputs" label="COMPHEP outputs">
	<discover_datasets pattern="__name_and_ext__"  directory="output"/>
      </data>
    </outputs>