From b2821fdc3cf497f0fbe0693c8f1683ea0a0c5797 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 1 Oct 2024 19:01:35 +0200 Subject: [PATCH] Support singularity --- galaxysrv.yml | 2 ++ requirements.yml | 2 ++ templates/galaxy/config/job_conf.yml.j2 | 26 +++++++++++++++++++++++++ vars/src_galaxy_vars.yml | 2 +- 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/galaxysrv.yml b/galaxysrv.yml index 7b83d19..55b529b 100644 --- a/galaxysrv.yml +++ b/galaxysrv.yml @@ -27,6 +27,8 @@ roles: - role: geerlingguy.docker when: not _molecule_active and _galaxy_jobs_docker + - role: usegalaxy_eu.apptainer and _galaxy_jobs_singularity + when: not _molecule_active - role: uusrc.general.nginx_reverse_proxy vars: nginx_reverse_proxy_locations: "{{ galaxy_nginx_vhost_config }}" diff --git a/requirements.yml b/requirements.yml index 3dee623..447456d 100644 --- a/requirements.yml +++ b/requirements.yml @@ -11,6 +11,8 @@ roles: version: 1.2.0 - src: geerlingguy.docker version: 6.1.0 + - src: usegalaxy_eu.apptainer + version: 0.0.2 collections: - name: community.general diff --git a/templates/galaxy/config/job_conf.yml.j2 b/templates/galaxy/config/job_conf.yml.j2 index a2c5a7c..d76f5b6 100644 --- a/templates/galaxy/config/job_conf.yml.j2 +++ b/templates/galaxy/config/job_conf.yml.j2 @@ -21,6 +21,32 @@ execution: docker_destination_id: docker_local default_destination_id: local + singularity: + singularity_volumes: "$galaxy_root:ro,$tool_directory:ro,$working_directory:rw,$job_directory:rw,{{ galaxy_mutable_data_dir }}:rw" + runner: local_runner + singularity_enabled: true + container_resolvers: + - type: cached_explicit_singularity + cache_directory: "{{ galaxy_mutable_data_dir }}/cache/singularity/explicit/" + - type: cached_mulled_singularity + cache_directory: "{{ galaxy_mutable_data_dir }}/cache/singularity/mulled/" + - type: mulled_singularity + auto_install: False + cache_directory: "{{ galaxy_mutable_data_dir }}/cache/singularity/mulled/" + - type: build_mulled_singularity + auto_install: False + cache_directory: "{{ galaxy_mutable_data_dir }}/cache/singularity/built/" + env: + # Ensuring a consistent collation environment is good for reproducibility. + - name: LC_ALL + value: C + # The cache directory holds the docker containers that get converted + - name: APPTAINER_CACHEDIR + value: /tmp/singularity + # Apptainer uses a temporary directory to build the squashfs filesystem + - name: APPTAINER_TMPDIR + value: /tmp + tools: - class: local # these special tools that aren't parameterized for remote execution - expression tools, upload, etc environment: local_env diff --git a/vars/src_galaxy_vars.yml b/vars/src_galaxy_vars.yml index 9b68aca..2102185 100644 --- a/vars/src_galaxy_vars.yml +++ b/vars/src_galaxy_vars.yml @@ -12,8 +12,8 @@ _galaxy_custom_repo_branch: "{{ src_galaxy_custom_repo_branch | default('main', _galaxy_api_exposed: "{{ src_galaxy_api_exposed | default(true, true) }}" _galaxy_use_interactive_tools: "{{ src_galaxy_interactive_tools | default(true, true) | bool }}" _galaxy_server_fqdn: "{{ workspace_fqdn | default('localhost', true) }}" +_galaxy_jobs_singularity: "{{ src_galaxy_jobs_singularity | default(false, false) | bool }}" _galaxy_jobs_docker: "{{ _galaxy_use_interactive_tools or (src_galaxy_jobs_docker | default(true, false) | bool ) }}" -_galaxy_jobs_pulsar_embedded: "{{ src_galaxy_pulsar_embedded | default(_galaxy_use_interactive_tools, true) | bool }}" # Build the final lists of tool and workflow installation files _galaxy_tool_files: "{{ src_galaxy_tool_files | default('', true) | split(',') | select() + _galaxy_default_tool_files_list }}" # select() necessary because split on the default '' yields ['']