diff --git a/.dive-ci b/.dive-ci new file mode 100644 index 00000000..6893808a --- /dev/null +++ b/.dive-ci @@ -0,0 +1,13 @@ +rules: + # If the efficiency is measured below X%, mark as failed. + # Expressed as a ratio between 0-1. + lowestEfficiency: 0.95 + + # If the amount of wasted space is at least X or larger than X, mark as failed. + # Expressed in B, KB, MB, and GB. + # highestWastedBytes: 20MB + + # If the amount of wasted space makes up for X% or more of the image, mark as failed. + # Note: the base image layer is NOT included in the total image size. + # Expressed as a ratio between 0-1; fails if the threshold is met or crossed. + highestUserWastedPercent: 0.10 diff --git a/.github/workflows/single.sh b/.github/workflows/single.sh index 3104f1d8..7cc01e98 100755 --- a/.github/workflows/single.sh +++ b/.github/workflows/single.sh @@ -12,6 +12,11 @@ sudo apt-get update -qq #sudo apt-get install docker-ce --no-install-recommends -y -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" sudo apt-get install sshpass --no-install-recommends -y +DIVE_VERSION=$(curl -sL "https://api.github.com/repos/wagoodman/dive/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') +curl -OL https://github.com/wagoodman/dive/releases/download/v${DIVE_VERSION}/dive_${DIVE_VERSION}_linux_amd64.deb +sudo apt install ./dive_${DIVE_VERSION}_linux_amd64.deb +rm ./dive_${DIVE_VERSION}_linux_amd64.deb + pip3 install ephemeris docker --version @@ -100,31 +105,27 @@ date > time.txt # Test FTP Server get #curl -v --fail ftp://localhost:8021 --user $GALAXY_USER:$GALAXY_USER_PASSWD +# Test SFTP Server +sshpass -p $GALAXY_USER_PASSWD sftp -v -P 8022 -o User=$GALAXY_USER -o "StrictHostKeyChecking no" localhost <<< $'put time.txt' + # Test CVMFS docker_exec bash -c "service autofs start" docker_exec bash -c "cvmfs_config chksetup" docker_exec bash -c "ls /cvmfs/data.galaxyproject.org/byhand" -# Test SFTP Server -sshpass -p $GALAXY_USER_PASSWD sftp -v -P 8022 -o User=$GALAXY_USER -o "StrictHostKeyChecking no" localhost <<< $'put time.txt' - # Run a ton of BioBlend test against our servers. cd "$WORKING_DIR/test/bioblend/" && . ./test.sh && cd "$WORKING_DIR/" -# not working anymore in 18.01 -# executing: /galaxy_venv/bin/uwsgi --yaml /etc/galaxy/galaxy.yml --master --daemonize2 galaxy.log --pidfile2 galaxy.pid --log-file=galaxy_install.log --pid-file=galaxy_install.pid -# [uWSGI] getting YAML configuration from /etc/galaxy/galaxy.yml -# /galaxy_venv/bin/python: unrecognized option '--log-file=galaxy_install.log' -# getopt_long() error -# cat: galaxy_install.pid: No such file or directory -# tail: cannot open ‘galaxy_install.log’ for reading: No such file or directory -#- | -# if [ "${COMPOSE_SLURM}" ] || [ "${KUBE}" ] || [ "${COMPOSE_CONDOR_DOCKER}" ] || [ "${COMPOSE_SLURM_SINGULARITY}" ] -# then -# # Test without install-repository wrapper -# sleep 10 -# docker_exec_run bash -c 'cd $GALAXY_ROOT_DIR && python ./scripts/api/install_tool_shed_repositories.py --api admin -l http://localhost:80 --url https://toolshed.g2.bx.psu.edu -o devteam --name cut_columns --panel-section-name BEDTools' -# fi +# Test without install-repository wrapper +curl -v --fail POST -H "Content-Type: application/json" -H "x-api-key: fakekey" -d \ + '{ + "tool_shed_url": "https://toolshed.g2.bx.psu.edu", + "name": "cut_columns", + "owner": "devteam", + "changeset_revision": "cec635fab700", + "new_tool_panel_section_label": "BEDTools" + }' \ +"http://localhost:8080/api/tool_shed_repositories" # Test the 'new' tool installation script @@ -132,6 +133,8 @@ docker_exec install-tools "$SAMPLE_TOOLS" # Test the Conda installation docker_exec_run bash -c 'export PATH=$GALAXY_CONFIG_TOOL_DEPENDENCY_DIR/_conda/bin/:$PATH && conda --version && conda install samtools -c bioconda --yes' +# analyze image using dive tool +CI=true dive quay.io/bgruening/galaxy docker stop galaxy docker rm -f galaxy diff --git a/README.md b/README.md index fef2eb1d..efc2d62d 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ docker run -p 8080:80 -v /data/galaxy-data:/export --name b ```sh cd /data/galaxy-data/.distribution_config -for f in *; do echo $f; diff $f ../galaxy-central/config/$f; read; done +for f in *; do echo $f; diff $f ../galaxy/config/$f; read; done ``` 4. Upgrade the database schema @@ -239,19 +239,19 @@ With this method, you keep a backup in case you decide to downgrade, but require ``` $ cd /data/galaxy-data/.distribution_config - $ for f in *; do echo $f; diff $f ../../galaxy-data-old/galaxy-central/config/$f; read; done + $ for f in *; do echo $f; diff $f ../../galaxy-data-old/galaxy/config/$f; read; done ``` 8. Copy all the users' datasets to the new instance ``` - $ sudo rsync -var /data/galaxy-data-old/galaxy-central/database/files/* /data/galaxy-data/galaxy-central/database/files/ + $ sudo rsync -var /data/galaxy-data-old/galaxy/database/files/* /data/galaxy-data/galaxy/database/files/ ``` 9. Copy all the installed tools ``` $ sudo rsync -var /data/galaxy-data-old/tool_deps/* /data/galaxy-data/tool_deps/ - $ sudo rsync -var /data/galaxy-data-old/galaxy-central/database/shed_tools/* /data/galaxy-data/galaxy-central/database/shed_tools/ - $ sudo rsync -var /data/galaxy-data-old/galaxy-central/database/config/* /data/galaxy-data/galaxy-central/database/config/ + $ sudo rsync -var /data/galaxy-data-old/galaxy/database/shed_tools/* /data/galaxy-data/galaxy/database/shed_tools/ + $ sudo rsync -var /data/galaxy-data-old/galaxy/database/config/* /data/galaxy-data/galaxy/database/config/ ``` 10. Copy the welcome page and all its files. @@ -328,7 +328,7 @@ exit ```sh cd /data/galaxy-data/.distribution_config -for f in *; do echo $f; diff $f ../galaxy-central/config/$f; read; done +for f in *; do echo $f; diff $f ../galaxy/config/$f; read; done ``` 7. Upgrade the database schema (= step 4 of the "The quick upgrade method" above) @@ -470,11 +470,11 @@ docker run -p 8080:80 \ bgruening/galaxy-stable ``` -Note, that if you would like to run any of the [cleanup scripts](https://galaxyproject.org/admin/config/performance/purge-histories-and-datasets/), you will need to add the following to `/export/galaxy-central/config/galaxy.yml`: +Note, that if you would like to run any of the [cleanup scripts](https://galaxyproject.org/admin/config/performance/purge-histories-and-datasets/), you will need to add the following to `/export/galaxy/config/galaxy.yml`: ``` database_connection = postgresql://galaxy:galaxy@localhost:5432/galaxy -file_path = /export/galaxy-central/database/files +file_path = /export/galaxy/database/files ``` ## Security Configuration @@ -492,7 +492,7 @@ Additionally Galaxy encodes various internal values that can be part of output u id_secret: d5c910cc6e32cad08599987ab64dcfae ``` -You should change all three configuration variables above manually in `/export/galaxy-central/config/galaxy.yml`. +You should change all three configuration variables above manually in `/export/galaxy/config/galaxy.yml`. Alternatively you can pass the security configuration when running the image but please note that it is a security problem. E.g. if a tool exposes all `env`'s your secret API key will also be exposed. @@ -598,47 +598,47 @@ The easiest way is to create a `/export` mount point on the cluster and mount th #### Not using the /export mount point on the cluster. The docker container sets up all its files on the /export directory, but this directory may not exist on the cluster filesystem. This can be solved with symbolic links on the cluster filesystem but it can also be solved within the container itself. -In this example configuration the cluster file system has a directory `/cluster_storage/galaxy` which is accessible for the galaxy user in the container (UID 1450) and the user starting the container. +In this example configuration the cluster file system has a directory `/cluster_storage/galaxy_data` which is accessible for the galaxy user in the container (UID 1450) and the user starting the container. The container should be started with the following settings configured: ```bash docker run -d -p 8080:80 -p 8021:21 \ --v /cluster_storage/galaxy/galaxy_export:/export \ # This makes sure all galaxy files are on the cluster filesystem --v /cluster_storage/galaxy:/cluster_storage/galaxy \ # This ensures the links within the docker container and on the cluster fs are the same +-v /cluster_storage/galaxy_data/galaxy_export:/export \ # This makes sure all galaxy files are on the cluster filesystem +-v /cluster_storage/galaxy_data:/cluster_storage/galaxy_data \ # This ensures the links within the docker container and on the cluster fs are the same # The following settings make sure that each job is configured with the paths on the cluster fs instead of /export --e GALAXY_CONFIG_TOOL_DEPENDENCY_DIR="/cluster_storage/galaxy/galaxy_export/tool_deps" \ --e GALAXY_CONFIG_TOOL_DEPENDENCY_CACHE_DIR="/cluster_storage/galaxy/galaxy_export/tool_deps/_cache" \ --e GALAXY_CONFIG_FILE_PATH="/cluster_storage/galaxy/galaxy_export/galaxy-central/database/files" \ --e GALAXY_CONFIG_TOOL_PATH="/cluster_storage/galaxy/galaxy_export/galaxy-central/tools" \ --e GALAXY_CONFIG_TOOL_DATA_PATH="/cluster_storage/galaxy/galaxy_export/galaxy-central/tool-data" \ --e GALAXY_CONFIG_SHED_TOOL_DATA_PATH="/cluster_storage/galaxy/galaxy_export/galaxy-central/tool-data" \ +-e GALAXY_CONFIG_TOOL_DEPENDENCY_DIR="/cluster_storage/galaxy_data/galaxy_export/tool_deps" \ +-e GALAXY_CONFIG_TOOL_DEPENDENCY_CACHE_DIR="/cluster_storage/galaxy_data/galaxy_export/tool_deps/_cache" \ +-e GALAXY_CONFIG_FILE_PATH="/cluster_storage/galaxy_data/galaxy_export/galaxy/database/files" \ +-e GALAXY_CONFIG_TOOL_PATH="/cluster_storage/galaxy_data/galaxy_export/galaxy/tools" \ +-e GALAXY_CONFIG_TOOL_DATA_PATH="/cluster_storage/galaxy_data/galaxy_export/galaxy/tool-data" \ +-e GALAXY_CONFIG_SHED_TOOL_DATA_PATH="/cluster_storage/galaxy_data/galaxy_export/galaxy/tool-data" \ # The following settings are for directories that can be anywhere on the cluster fs. --e GALAXY_CONFIG_JOB_WORKING_DIRECTORY="/cluster_storage/galaxy/galaxy_export/galaxy-central/database/job_working_directory" \ #IMPORTANT: needs to be created manually. Can also be placed elsewhere, but is originally located here --e GALAXY_CONFIG_NEW_FILE_PATH="/cluster_storage/galaxy/tmp" \ # IMPORTANT: needs to be created manually. This needs to be writable by UID=1450 and have its flippy bit set (chmod 1777 for world-writable with flippy bit) +-e GALAXY_CONFIG_JOB_WORKING_DIRECTORY="/cluster_storage/galaxy_data/galaxy_export/galaxy/database/job_working_directory" \ #IMPORTANT: needs to be created manually. Can also be placed elsewhere, but is originally located here +-e GALAXY_CONFIG_NEW_FILE_PATH="/cluster_storage/galaxy_data/tmp" \ # IMPORTANT: needs to be created manually. This needs to be writable by UID=1450 and have its flippy bit set (chmod 1777 for world-writable with flippy bit) -e GALAXY_CONFIG_OUTPUTS_TO_WORKING_DIRECTORY=False \ # Writes Job scripts, stdout and stderr to job_working_directory. -e GALAXY_CONFIG_RETRY_JOB_OUTPUT_COLLECTION=5 \ #IF your cluster fs uses nfs this may introduce latency. You can set galaxy to retry if a job output is not yet created. # Conda settings. IMPORTANT! --e GALAXY_CONFIG_CONDA_PREFIX="/cluster_storage/galaxy/_conda" \ # Can be anywhere EXCEPT cluster_storage/galaxy/galaxy_export! +-e GALAXY_CONFIG_CONDA_PREFIX="/cluster_storage/galaxy_data/_conda" \ # Can be anywhere EXCEPT cluster_storage/galaxy/galaxy_export! # Conda uses $PWD to determine where the virtual environment is. If placed inside the export directory conda will determine $PWD to be a subirectory of the /export folder which does not exist on the cluster! -e GALAXY_CONFIG_CONDA_AUTO_INIT=True # When the necessary environment can not be found a new one will automatically be created ``` ### Setting up a Python virtual environment on the cluster [[toc]](#toc) The Python environment in the container is not accessible from the cluster. So it needs to be created beforehand. -In this example configuration the Python virtual environment is created on `/cluster_storage/galaxy/galaxy_venv` and the export folder on `/cluster_storage/galaxy/galaxy_export`. To create the virtual environment: -1. Create the virtual environment `virtualenv /cluster_storage/galaxy/galaxy_venv` -2. Activate the virtual environment `source /cluster_storage/galaxy/galaxy_venv/bin/activate` -3. Install the galaxy requirements `pip install --index-url https://wheels.galaxyproject.org/simple --only-binary all -r /cluster_storage/galaxy/galaxy-central//lib/galaxy/dependencies/pinned-requirements.txt` +In this example configuration the Python virtual environment is created on `/cluster_storage/galaxy_data/galaxy_venv` and the export folder on `/cluster_storage/galaxy_data/galaxy_export`. To create the virtual environment: +1. Create the virtual environment `virtualenv /cluster_storage/galaxy_data/galaxy_venv` +2. Activate the virtual environment `source /cluster_storage/galaxy_data/galaxy_venv/bin/activate` +3. Install the galaxy requirements `pip install --index-url https://wheels.galaxyproject.org/simple --only-binary all -r /cluster_storage/galaxy_data/galaxy/lib/galaxy/dependencies/pinned-requirements.txt` * Make sure to upgrade the environment with the new requirements when a new version of galaxy is released. -To make the Python environment usable on the cluster, create your custom `job_conf.xml` file and put it in `/cluster_storage/galaxy/galaxy_export/galaxy-central/config`. +To make the Python environment usable on the cluster, create your custom `job_conf.xml` file and put it in `/cluster_storage/galaxy_data/galaxy_export/galaxy/config`. In the destination section the following code should be added: ```xml - - /cluster_storage/galaxy/galaxy_export/galaxy-central - /cluster_storage/galaxy/galaxy_export/galaxy-central/lib - /cluster_storage/galaxy/galaxy_export/galaxy-central/lib + + /cluster_storage/galaxy_data/galaxy_export/galaxy + /cluster_storage/galaxy_data/galaxy_export/galaxy/lib + /cluster_storage/galaxy_data/galaxy_export/galaxy/lib True ``` @@ -655,7 +655,7 @@ It is often convenient to configure Galaxy to use a high-performance cluster for 1. munge.key 2. slurm.conf -These files from the cluster must be copied to the `/export` mount point (i.e., `/cluster_storage/galaxy/galaxy_export/` on the host if using below command) accessible to Galaxy before starting the container. This must be done regardless of which Slurm daemons are running within Docker. At start, symbolic links will be created to these files to `/etc` within the container, allowing the various Slurm functions to communicate properly with your cluster. In such cases, there's no reason to run `slurmctld`, the Slurm controller daemon, from within Docker, so specify `-e "NONUSE=slurmctld"`. Unless you would like to also use Slurm (rather than the local job runner) to run jobs within the Docker container, then alternatively specify `-e "NONUSE=slurmctld,slurmd"`. +These files from the cluster must be copied to the `/export` mount point (i.e., `/cluster_storage/galaxy_data/galaxy_export/` on the host if using below command) accessible to Galaxy before starting the container. This must be done regardless of which Slurm daemons are running within Docker. At start, symbolic links will be created to these files to `/etc` within the container, allowing the various Slurm functions to communicate properly with your cluster. In such cases, there's no reason to run `slurmctld`, the Slurm controller daemon, from within Docker, so specify `-e "NONUSE=slurmctld"`. Unless you would like to also use Slurm (rather than the local job runner) to run jobs within the Docker container, then alternatively specify `-e "NONUSE=slurmctld,slurmd"`. Importantly, Slurm relies on a shared filesystem between the Docker container and the execution nodes. To allow things to function correctly, checkout the basic filesystem setup above. @@ -804,7 +804,7 @@ ENV GALAXY_CONFIG_BRAND deepTools ENV http_proxy 'http://yourproxyIP:8080' ENV https_proxy 'http://yourproxyIP:8080' -WORKDIR /galaxy-central +WORKDIR /galaxy RUN add-tool-shed --url 'http://testtoolshed.g2.bx.psu.edu/' --name 'Test Tool Shed' @@ -933,7 +933,7 @@ RabbitMQ is configured with: You can clone this repository with: ```sh -git clone --recursive https://github.com/bgruening/docker-galaxy-stable.git +git clone https://github.com/bgruening/docker-galaxy-stable.git ``` This repository uses various [Ansible](http://www.ansible.com/) roles as specified in [requirements.yml](galaxy/ansible/requirements.yml) to manage configurations and dependencies. You can install these roles with the following command: @@ -949,6 +949,12 @@ If you simply want to change the Galaxy repository and/or the Galaxy branch, fro --build-arg GALAXY_REPO=https://github.com/manabuishii/galaxy ``` +To keep docker images lean and optimize storage, we recommend using [Dive](https://github.com/wagoodman/dive). It provides an interactive UI that lets you explore each layer of the image, helping you quickly identify files and directories that take up significant space. To install Dive, follow the installation instructions provided in the [Dive GitHub repository](https://github.com/wagoodman/dive?tab=readme-ov-file#installation). After building your docker image, use Dive to analyze it: + +```bash +dive +``` + # Requirements [[toc]](#toc) - [Docker](https://www.docker.io/gettingstarted/#h_installation) diff --git a/docs/Running_jobs_outside_of_the_container.md b/docs/Running_jobs_outside_of_the_container.md index 00ea6831..7ad53c13 100644 --- a/docs/Running_jobs_outside_of_the_container.md +++ b/docs/Running_jobs_outside_of_the_container.md @@ -6,18 +6,18 @@ It is often convenient to configure Galaxy to use a high-performance cluster for 1. munge.key 2. slurm.conf -These files from the cluster must be copied to the `/export` mount point (i.e., `/data/galaxy` on the host if using below command) accessible to Galaxy before starting the container. This must be done regardless of which Slurm daemons are running within Docker. At start, symbolic links will be created to these files to `/etc` within the container, allowing the various Slurm functions to communicate properly with your cluster. In such cases, there's no reason to run `slurmctld`, the Slurm controller daemon, from within Docker, so specify `-e "NONUSE=slurmctld"`. Unless you would like to also use Slurm (rather than the local job runner) to run jobs within the Docker container, then alternatively specify `-e "NONUSE=slurmctld,slurmd"`. +These files from the cluster must be copied to the `/export` mount point (i.e., `/data/galaxy-data` on the host if using below command) accessible to Galaxy before starting the container. This must be done regardless of which Slurm daemons are running within Docker. At start, symbolic links will be created to these files to `/etc` within the container, allowing the various Slurm functions to communicate properly with your cluster. In such cases, there's no reason to run `slurmctld`, the Slurm controller daemon, from within Docker, so specify `-e "NONUSE=slurmctld"`. Unless you would like to also use Slurm (rather than the local job runner) to run jobs within the Docker container, then alternatively specify `-e "NONUSE=slurmctld,slurmd"`. -Importantly, Slurm relies on a shared filesystem between the Docker container and the execution nodes. To allow things to function correctly, each of the execution nodes will need `/export` and `/galaxy-central` directories to point to the appropriate places. Suppose you ran the following command to start the Docker image: +Importantly, Slurm relies on a shared filesystem between the Docker container and the execution nodes. To allow things to function correctly, each of the execution nodes will need `/export` and `/galaxy` directories to point to the appropriate places. Suppose you ran the following command to start the Docker image: ```sh - docker run -d -e "NONUSE=slurmd,slurmctld" -p 80:80 -v /data/galaxy:/export bgruening/galaxy-stable + docker run -d -e "NONUSE=slurmd,slurmctld" -p 80:80 -v /data/galaxy-data:/export bgruening/galaxy-stable ``` You would then need the following symbolic links on each of the nodes: - 1. `/export` → `/data/galaxy` - 2. `/galaxy-central` → `/data/galaxy/galaxy-central` + 1. `/export` → `/data/galaxy-data` + 2. `/galaxy` → `/data/galaxy-data/galaxy` A brief note is in order regarding the version of Slurm installed. This Docker image uses Ubuntu 14.04 as its base image. The version of Slurm in the Unbuntu 14.04 repository is 2.6.5 and that is what is installed in this image. If your cluster is using an incompatible version of Slurm then you will likely need to modify this Docker image. @@ -83,10 +83,10 @@ and munge.key files are needed. These file will be automatically generated by th docker slurm container and placed into the /export folder. To make them available to the galaxy container, we start the slurm container -with a host directory (`/data/galaxy`) mounted to `/export`. +with a host directory (`/data/galaxy-data`) mounted to `/export`. (If there is a real cluster available, this would be a network share): ```sh -docker run -d -v /data/galaxy:/export \ +docker run -d -v /data/galaxy-data:/export \ --name slurm \ --hostname slurm \ slurm @@ -101,7 +101,7 @@ docker run -d -e "NONUSE=slurmd,slurmctld" \ --name galaxy-slurm-test \ --link slurm \ -p 80:80 \ - -v /data/galaxy:/export \ + -v /data/galaxy-data:/export \ bgruening/galaxy-stable ``` Note the --link slurm, this will allow the galaxy container to talk to the slurm container. @@ -114,9 +114,9 @@ This should return the hostname of the slurm container, slurm. But we still need to instruct galaxy on how to interface with slurm. We therefore need to adjust the job_conf.xml file. A sample job_conf.xml is in [/test/slurm/job_conf.xml](../test/slurm/job_conf.xml). -We can copy this file to /data/galaxy/galaxy-central/config: +We can copy this file to /data/galaxy-data/galaxy/config: ``` -cp job_conf.xml /data/galaxy/galaxy-central/config +cp job_conf.xml /data/galaxy-data/galaxy/config ``` We restart galaxy inside the container ```sh @@ -143,8 +143,8 @@ docker exec -it slurm bash Inside the container we switch to the galaxy user, source the virtualenv, upgrade pip and install the required dependencies: ```sh -source /galaxy-central/.venv/bin/activate && pip install --upgrade pip -pip install -r /galaxy-central/requirements.txt --index-url https://wheels.galaxyproject.org/simple +source /galaxy/.venv/bin/activate && pip install --upgrade pip +pip install -r /galaxy/requirements.txt --index-url https://wheels.galaxyproject.org/simple ``` Now quit the slurm container, edit the job_conf.xml and set ``` diff --git a/galaxy/Dockerfile b/galaxy/Dockerfile index 08bb6755..4cf1b607 100644 --- a/galaxy/Dockerfile +++ b/galaxy/Dockerfile @@ -21,7 +21,6 @@ ENV GALAXY_ROOT_DIR=/galaxy \ # Install miniforge and then virtualenv from conda FROM build_base AS build_miniforge -RUN mkdir $GALAXY_HOME ADD ./bashrc $GALAXY_HOME/.bashrc RUN curl -s -L https://github.com/conda-forge/miniforge/releases/download/$MINIFORGE_VERSION/Miniforge3-$MINIFORGE_VERSION-Linux-x86_64.sh > ~/miniforge.sh \ @@ -34,6 +33,7 @@ RUN curl -s -L https://github.com/conda-forge/miniforge/releases/download/$MINIF && conda config --add channels bioconda \ && conda install virtualenv pip ephemeris \ && conda clean --packages -t -i \ + && cp -r ~/.conda $GALAXY_HOME && cp ~/.condarc $GALAXY_HOME \ && find $GALAXY_CONDA_PREFIX -name '*.pyc' -delete @@ -55,8 +55,8 @@ RUN mkdir $GALAXY_ROOT_DIR $GALAXY_VIRTUAL_ENV \ && . $GALAXY_VIRTUAL_ENV/bin/activate \ && pip install "weasyprint>=61.2" watchdog --index-url https://wheels.galaxyproject.org/simple --extra-index-url https://pypi.python.org/simple \ && deactivate \ - && cd config && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + \ - && find . -name '.cache' -type d -prune -exec rm -rf '{}' + \ + # cleanup + && find config \( -name 'node_modules' -o -name '.cache' -o -name '.parcel-cache' \) -type d -prune -exec rm -rf '{}' + \ && find $GALAXY_ROOT_DIR -name '*.pyc' -delete && find $GALAXY_VIRTUAL_ENV -name '*.pyc' -delete \ && rm -rf $GALAXY_ROOT_DIR/client/node_modules/ $GALAXY_VIRTUAL_ENV/src/ @@ -89,7 +89,7 @@ ENV GALAXY_CONFIG_FILE=$GALAXY_CONFIG_DIR/galaxy.yml \ PG_CONF_DIR_DEFAULT=/etc/postgresql/$PG_VERSION/main/ \ PG_DATA_DIR_HOST=$EXPORT_DIR/postgresql/$PG_VERSION/main/ -ADD ./common_cleanup.sh /usr/bin/common_cleanup.sh +ADD --chmod=755 ./common_cleanup.sh /usr/bin/common_cleanup.sh RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup \ && echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache \ @@ -97,7 +97,6 @@ RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup \ && apt-get -qq update && apt-get install -y locales \ && locale-gen en_US.UTF-8 && dpkg-reconfigure locales \ && apt-get autoremove -y && apt-get clean \ - && chmod +x /usr/bin/common_cleanup.sh \ && /usr/bin/common_cleanup.sh ADD ansible/ /ansible/ @@ -183,7 +182,7 @@ ENV GALAXY_CONFIG_MANAGED_CONFIG_DIR=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/c GALAXY_CONFIG_BOOTSTRAP_ADMIN_API_KEY=HSNiugRFvgT574F43jZ7N9F3 \ GALAXY_CONFIG_BRAND="Galaxy Docker Build" \ GALAXY_CONFIG_STATIC_ENABLED=False \ - GALAXY_INTERACTIVE_TOOLS_CONFIG_FILE=$GALAXY_CONFIG_DIR/tools_conf_interactive.xml \ + GALAXY_INTERACTIVE_TOOLS_CONFIG_FILE=$GALAXY_CONFIG_DIR/tool_conf_interactive.xml \ # The following ENV var can be used to set the number of gunicorn workers GUNICORN_WORKERS=2 \ # The following ENV var can be used to set the number of celery workers @@ -204,11 +203,11 @@ COPY --chown=$GALAXY_USER:$GALAXY_USER --from=build_galaxy $GALAXY_VIRTUAL_ENV $ COPY --chown=$GALAXY_USER:$GALAXY_USER --from=build_miniforge $GALAXY_HOME $GALAXY_HOME COPY --chown=$GALAXY_USER:$GALAXY_USER --from=build_miniforge /etc/profile.d/conda.sh /etc/profile.d/conda.sh -ADD ./reports.yml.sample $GALAXY_CONFIG_DIR/reports.yml -ADD sample_tool_list.yaml $GALAXY_HOME/ephemeris/sample_tool_list.yaml +ADD --chown=$GALAXY_USER:$GALAXY_USER ./reports.yml.sample $GALAXY_CONFIG_DIR/reports.yml +ADD --chown=$GALAXY_USER:$GALAXY_USER ./sample_tool_list.yaml $GALAXY_HOME/ephemeris/sample_tool_list.yaml # Activate Interactive Tools during runtime -ADD ./tools_conf_interactive.xml.sample $GALAXY_INTERACTIVE_TOOLS_CONFIG_FILE +ADD --chown=$GALAXY_USER:$GALAXY_USER ./tool_conf_interactive.xml.sample $GALAXY_INTERACTIVE_TOOLS_CONFIG_FILE RUN mkdir -p $GALAXY_CONFIG_TUS_UPLOAD_STORE \ && ln -s /tool_deps/ $GALAXY_CONFIG_TOOL_DEPENDENCY_DIR \ @@ -236,17 +235,14 @@ RUN cd / \ && service postgresql start \ && service postgresql stop -# The following commands will be executed as the galaxy user -USER $GALAXY_USER - WORKDIR $GALAXY_ROOT_DIR # Updating genome informations from UCSC -#RUN export GALAXY=$GALAXY_ROOT_DIR && sh ./cron/updateucsc.sh.sample +# RUN su $GALAXY_USER -c "export GALAXY=$GALAXY_ROOT_DIR && sh ./cron/updateucsc.sh.sample" ENV GALAXY_CONFIG_JOB_WORKING_DIRECTORY=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/job_working_directory \ GALAXY_CONFIG_FILE_PATH=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/files \ - GALAXY_CONFIG_NEW_FILE_PATH=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/files \ + GALAXY_CONFIG_NEW_FILE_PATH=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/tmp \ GALAXY_CONFIG_TEMPLATE_CACHE_PATH=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/compiled_templates \ GALAXY_CONFIG_CITATION_CACHE_DATA_DIR=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/database/citations/data \ GALAXY_CONFIG_FTP_UPLOAD_DIR=$EXPORT_DIR/ftp \ @@ -262,22 +258,16 @@ ENV GALAXY_CONFIG_JOB_WORKING_DIRECTORY=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/databas GALAXY_CONFIG_ENABLE_QUOTAS=True \ GALAXY_CONFIG_GALAXY_INFRASTRUCTURE_URL=http://$GALAXY_DOMAIN \ GALAXY_CONFIG_OUTPUTS_TO_WORKING_DIRECTORY=True \ - # We need to set $HOME for some Tool Shed tools (e.g Perl libs with $HOME/.cpan) - HOME=$GALAXY_HOME \ GALAXY_CONDA_PREFIX=$GALAXY_CONFIG_TOOL_DEPENDENCY_DIR/_conda # Container Style -ADD GalaxyDocker.png $GALAXY_CONFIG_DIR/web/welcome_image.png -ADD welcome.html $GALAXY_CONFIG_DIR/web/welcome.html - -# Switch back to User root -USER root +ADD --chown=$GALAXY_USER:$GALAXY_USER GalaxyDocker.png $GALAXY_CONFIG_DIR/web/welcome_image.png +ADD --chown=$GALAXY_USER:$GALAXY_USER welcome.html $GALAXY_CONFIG_DIR/web/welcome.html # Activate additional Tool Sheds # Activate the Test Tool Shed during runtime, useful for testing repositories. -ADD ./tool_sheds_conf.xml $GALAXY_HOME/tool_sheds_conf.xml -RUN chown $GALAXY_USER:$GALAXY_USER $GALAXY_HOME/tool_sheds_conf.xml && chmod 0644 $GALAXY_HOME/tool_sheds_conf.xml +ADD --chown=$GALAXY_USER:$GALAXY_USER ./tool_sheds_conf.xml $GALAXY_HOME/tool_sheds_conf.xml # Script that enables easier downstream installation of tools (e.g. for different Galaxy Docker flavours) ADD install_tools_wrapper.sh /usr/bin/install-tools @@ -291,13 +281,11 @@ RUN chmod +x /usr/bin/install-tools /usr/bin/install-biojs && \ ADD https://github.com/krallin/tini/releases/download/v0.18.0/tini /sbin/tini RUN chmod +x /sbin/tini -ADD run.sh $GALAXY_ROOT_DIR/run.sh -RUN chmod +x $GALAXY_ROOT_DIR/run.sh && \ - chown $GALAXY_USER:$GALAXY_USER $GALAXY_ROOT_DIR/run.sh +ADD --chown=$GALAXY_USER:$GALAXY_USER --chmod=755 ./run.sh $GALAXY_ROOT_DIR/run.sh # This needs to happen here and not above, otherwise the Galaxy start # (without running the startup.sh script) will crash because integrated_tool_panel.xml could not be found. -ENV GALAXY_CONFIG_INTEGRATED_TOOL_PANEL_CONFIG $EXPORT_DIR/${GALAXY_ROOT_DIR#/}/integrated_tool_panel.xml +ENV GALAXY_CONFIG_INTEGRATED_TOOL_PANEL_CONFIG=$EXPORT_DIR/${GALAXY_ROOT_DIR#/}/integrated_tool_panel.xml # Expose port 80, 443 (webserver), 21 (FTP server), 4002 (Proxy), 9002 (supvisord web app) EXPOSE 21 diff --git a/galaxy/ansible/gravity.yml b/galaxy/ansible/gravity.yml index 4de66c35..b66a65bc 100644 --- a/galaxy/ansible/gravity.yml +++ b/galaxy/ansible/gravity.yml @@ -18,7 +18,7 @@ #!/usr/bin/env sh export GRAVITY_CONFIG_FILE={{ gravity_config_file }} export GRAVITY_STATE_DIR={{ gravity_state_dir }} - exec sudo -E -u $GALAXY_USER {{ galaxy_venv_dir }}/bin/galaxyctl "$@" + exec sudo -E -H -u $GALAXY_USER {{ galaxy_venv_dir }}/bin/galaxyctl "$@" dest: "/usr/local/bin/galaxyctl" mode: "0755" become: True diff --git a/galaxy/ansible/group_vars/all.yml b/galaxy/ansible/group_vars/all.yml index be4d2c83..12a3e10e 100644 --- a/galaxy/ansible/group_vars/all.yml +++ b/galaxy/ansible/group_vars/all.yml @@ -58,7 +58,7 @@ galaxy_k8s_jobs_fs_group_id: 0 galaxy_k8s_jobs_pull_policy: IfNotPresent # Point at the existing Galaxy configuration. -galaxy_server_dir: "/galaxy-central" +galaxy_server_dir: "/galaxy" galaxy_job_conf_path: "{{ galaxy_server_dir }}/config/job_conf.xml" galaxy_container_resolvers_conf_path: "{{ galaxy_server_dir }}/config/container_resolvers_conf.yml" galaxy_job_metrics_conf_path: "{{ galaxy_server_dir }}/config/job_metrics_conf.yml" diff --git a/galaxy/common_cleanup.sh b/galaxy/common_cleanup.sh index 0459e9f5..09ab78c3 100644 --- a/galaxy/common_cleanup.sh +++ b/galaxy/common_cleanup.sh @@ -7,8 +7,9 @@ set -x find / -name '*.pyc' -delete find / -name '*.log' -delete -find / -name '.cache' -delete -find / -name '.npm' -delete +find / -name '.cache' -type d -prune -exec rm -rf '{}' + +find / -name '.npm' -type d -prune -exec rm -rf '{}' + +find / -name '.launchpadlib' -type d -prune -exec rm -rf '{}' + rm -rf /var/lib/apt/lists/* rm -rf /var/cache/* rm -rf /tmp/* diff --git a/galaxy/install_tools_wrapper.sh b/galaxy/install_tools_wrapper.sh index 19755341..004ced26 100644 --- a/galaxy/install_tools_wrapper.sh +++ b/galaxy/install_tools_wrapper.sh @@ -28,7 +28,7 @@ else echo "starting Galaxy" # Unset SUDO_* vars otherwise conda run chown based on that - sudo -E -u galaxy -- bash -c "unset SUDO_UID; \ + sudo -E -H -u galaxy -- bash -c "unset SUDO_UID; \ unset SUDO_GID; \ unset SUDO_COMMAND; \ unset SUDO_USER; \ @@ -67,7 +67,7 @@ fi if ! pgrep "supervisord" > /dev/null then # stop everything - sudo -E -u galaxy ./run.sh --stop --pidfile galaxy_install.pid + sudo -E -H -u galaxy ./run.sh --stop --pidfile galaxy_install.pid rm $install_log service postgresql stop fi diff --git a/galaxy/startup.sh b/galaxy/startup.sh index bc0b155f..90b59fac 100755 --- a/galaxy/startup.sh +++ b/galaxy/startup.sh @@ -171,7 +171,7 @@ fi if [[ ! -z $LOAD_GALAXY_CONDITIONAL_DEPENDENCIES ]] then echo "Installing optional dependencies in galaxy virtual environment..." - sudo -E -u $GALAXY_USER bash -c ' + sudo -E -H -u $GALAXY_USER bash -c ' . $GALAXY_VIRTUAL_ENV/bin/activate : ${GALAXY_WHEELS_INDEX_URL:="https://wheels.galaxyproject.org/simple"} : ${PYPI_INDEX_URL:="https://pypi.python.org/simple"} @@ -183,7 +183,7 @@ fi if [[ ! -z $LOAD_GALAXY_CONDITIONAL_DEPENDENCIES ]] && [[ ! -z $LOAD_PYTHON_DEV_DEPENDENCIES ]] then echo "Installing development requirements in galaxy virtual environment..." - sudo -E -u $GALAXY_USER bash -c ' + sudo -E -H -u $GALAXY_USER bash -c ' . $GALAXY_VIRTUAL_ENV/bin/activate : ${GALAXY_WHEELS_INDEX_URL:="https://wheels.galaxyproject.org/simple"} : ${PYPI_INDEX_URL:="https://pypi.python.org/simple"} @@ -389,6 +389,9 @@ function start_supervisor { wait_for_rabbitmq echo "Configuring rabbitmq users" ansible-playbook -c local /usr/local/bin/configure_rabbitmq_users.yml &> /dev/null + + echo "Restarting rabbitmq" + supervisorctl restart rabbitmq fi fi diff --git a/galaxy/tools_conf_interactive.xml.sample b/galaxy/tool_conf_interactive.xml.sample similarity index 100% rename from galaxy/tools_conf_interactive.xml.sample rename to galaxy/tool_conf_interactive.xml.sample diff --git a/test/slurm/Dockerfile b/test/slurm/Dockerfile index d5bb58aa..f4c98c7b 100644 --- a/test/slurm/Dockerfile +++ b/test/slurm/Dockerfile @@ -21,8 +21,8 @@ ADD startup.sh /usr/bin/startup.sh ADD supervisor_slurm.conf /etc/supervisor/conf.d/slurm.conf RUN chmod +x /usr/bin/startup.sh #RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales -ENV GALAXY_DIR=/export/galaxy-central \ - SYMLINK_TARGET=/galaxy-central \ +ENV GALAXY_DIR=/export/galaxy \ + SYMLINK_TARGET=/galaxy \ SLURM_USER_NAME=galaxy \ SLURM_UID=1450 \ SLURM_GID=1450 \ diff --git a/test/slurm/job_conf.xml b/test/slurm/job_conf.xml index 0344ab4c..d8a389b4 100644 --- a/test/slurm/job_conf.xml +++ b/test/slurm/job_conf.xml @@ -14,7 +14,7 @@ -p work -n 2 False - + False False