- There is one service running, a directory - listing. (We originally had more but the github repository - for the flask app we were using disappeared.) -
- - - -And here we'll run that service in our ``startup.sh`` file - -.. code-block:: bash - - #!/bin/bash - # First, replace the PROXY_PREFIX value in /proxy.conf with the value from - # the environment variable. - sed -i "s|PROXY_PREFIX|${PROXY_PREFIX}|" /proxy.conf; - # Then copy into the default location for ubuntu+nginx - cp /proxy.conf /etc/nginx/sites-enabled/default; - - # Here you would normally start whatever service you want to start. In our - # example we start a simple directory listing service on port 8000 - cd /import/ && python -mSimpleHTTPServer & - - # Launch traffic monitor which will automatically kill the container if - # traffic stops - /monitor_traffic.sh & - # And finally launch nginx in foreground mode. This will make debugging - # easier as logs will be available from `docker logs ...` - nginx -g 'daemon off;' - -Lastly, our ``monitor_traffic.sh`` file is often re-used between containers, the only adjustment being the port that is looked at - -.. code-block:: bash - - #!/bin/bash - while true; do - sleep 60 - if [ `netstat -t | grep -v CLOSE_WAIT | grep ':80' | wc -l` -lt 3 ] - then - pkill nginx - fi - done - -With those files, ``monitor_traffic.sh``, ``Dockerfile``, ``startup.sh``, and ``proxy.conf``, you should be able to build your ``hello-ie`` container - -.. code-block:: bash - - $ cd hello-ie - $ docker build -t hello-ie . - -Now, if everything went smoothly, you should be able to restart Galaxy and try out your new GIE on a tabular or text file! - -Debugging ---------- - -When you launch your new GIE in Galaxy, your Galaxy logs should show something like the following: - -.. code-block:: console - - Starting docker container for IE helloworld with command [docker run --sig-proxy=true -e DEBUG=false -e "GALAXY_URL=http://localhost/galaxy/" -e "CORS_ORIGIN=http://localhost" -e "GALAXY_WEB_PORT=8000" -e "HISTORY_ID=f2db41e1fa331b3e" -e "CUSTOM=42" -e "GALAXY_PASTER_PORT=8000" -e "PROXY_PREFIX=/galaxy/gie_proxy" -e "API_KEY=1712364174a0ff79b34e9a78fee3ca1c" -e "REMOTE_HOST=127.0.0.1" -e "USER_EMAIL=hxr@local.host" -d -P -v "/home/hxr/work/galaxy/database/tmp/tmp5HaqZy:/import/" -v "/home/hxr/work/galaxy/database/files/000/dataset_68.dat:/import/file.dat:ro" hello-ie] - -Here's the docker command written out in a more readable manner: - -.. code-block:: console - - $ docker run --sig-proxy=true \ - -d -P \ - -e "API_KEY=1712364174a0ff79b34e9a78fee3ca1c" \ - -e "CORS_ORIGIN=http://localhost" \ - -e "CUSTOM=42" \ - -e "DEBUG=false" \ - -e "GALAXY_PASTER_PORT=8000" \ - -e "GALAXY_URL=http://localhost/galaxy/" \ - -e "GALAXY_WEB_PORT=8000" \ - -e "HISTORY_ID=f2db41e1fa331b3e" \ - -e "PROXY_PREFIX=/galaxy/gie_proxy" \ - -e "REMOTE_HOST=127.0.0.1" \ - -e "USER_EMAIL=hxr@local.host" \ - -v "/home/hxr/work/galaxy/database/tmp/tmp5HaqZy:/import/" \ - -v "/home/hxr/work/galaxy/database/files/000/dataset_68.dat:/import/file.dat:ro" \ - hello-ie - -As you can see, a LOT is going on! We'll break it down further: - -- ``-d`` runs the container in daemon mode, it launches and the client - submitting the container finished -- ``-P`` randomly assigns an unused port to the container for each ``EXPOSE``d - port from our ``Dockerfile``. This is why you must expose a port, and only - one port. -- A large number of environment variables are set: - - - The user's API key is provided, allowing you to access datasets and - submit jobs on their behalf. If you have an environment like - Jupyter/RStudio, it is **highly recommended** that you provide some magic - by which the user can use their API key without embedding it in the - notebook. If you do embed it somehow in a document that gets saved to - their history, anyone can impersonate that user if they get a hold of it. - In the Jupyter GIE we have a variable that just runs - ``os.environ.get('API_KEY')`` to avoid embedding it in their notebook. - - A CORS Origin is provided for very strict servers, but it may be easier - to simply void CORS requirements within the nginx proxy in your - container. - - Custom variables specified in your ``launch()`` command are available - - A ``DEBUG`` environment variable should be used to help admins debug - existing containers. You should use it to increase logging, not cleanup - temporary files, and so on. - - ``GALAXY_PASTER_PORT`` (deprecated) and ``GALAXY_WEB_PORT`` are the raw - port that Galaxy is listening on. You can use this to help decide how to - talk to Galaxy. - - ``GALAXY_URL`` is the URL that Galaxy should be accessible at. For - various reasons this may not be true. We recommend looking at our - implementation of `galaxy.py -