From 92e22bd00676d22ec7a1dee4938688c7b4222eee Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Fri, 28 Jul 2023 15:52:46 +0200 Subject: [PATCH 01/25] add subdomains to ansible-galaxy --- defaults/main.yml | 72 +++++++++++++++++++++++++++++++++++++ tasks/copy_static_files.yml | 18 ++++++++++ tasks/copy_themes.yml | 14 ++++++++ tasks/main.yml | 18 ++++++++++ tasks/setup_static.yml | 49 +++++++++++++++++++++++++ 5 files changed, 171 insertions(+) create mode 100644 tasks/copy_static_files.yml create mode 100644 tasks/copy_themes.yml create mode 100644 tasks/setup_static.yml diff --git a/defaults/main.yml b/defaults/main.yml index b1c88c2..22e49e6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,6 +23,7 @@ galaxy_manage_gravity: "{{ false if __galaxy_major_version is version('22.05', ' galaxy_manage_systemd: no # For Galaxy galaxy_manage_systemd_reports: no # For Reports galaxy_manage_cleanup: no +galaxy_manage_themes: no # Control whether to output verbose task diffs (e.g. when performing a git update) when running Ansible with --diff. @@ -295,6 +296,50 @@ galaxy_app_config_default: # Everything else visualization_plugins_directory: "config/plugins/visualizations" + # Static and themes cofiguration, will only be added if galaxy_manage_themes + enable_static: "{{ galaxy_manage_themes }}" + static_dir_by_host: > + { {% if galaxy_manage_static %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/' + {% end for %} + {% end if %} } + static_images_dir_by_host: > + { {% if galaxy_manage_static %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images' + {% end for %} + {% end if %} } + static_welcome_html_by_host: > + { {% if galaxy_manage_static %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html' + {% end for %} + {% end if %} } + static_scripts_dir_by_host: > + { {% if galaxy_manage_static %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts' + {% end for %} + {% end if %} } + static_favicon_dir_by_host: > + { {% if galaxy_manage_static %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/favicon.ico' + {% end for %} + {% end if %} } + static_robots_txt_by_host: > + { {% if galaxy_manage_static %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/robots.txt' + {% end for %} + {% end if %} } + themes_dir_by_host: > + { {% if galaxy_manage_themes %} + {% for subdomain in galaxy_names_subdomains %} + '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': {{ subdomain.name }}.yml + {% end for %} + {% end if %} } # Need to set galaxy_config_default[galaxy_app_config_section] dynamically but Ansible/Jinja2 does not make this easy galaxy_config_default: "{{ {} | combine({galaxy_app_config_section: galaxy_app_config_default}) }}" galaxy_config_merged: "{{ galaxy_config_default | combine(galaxy_config | default({}), recursive=True) }}" @@ -425,3 +470,30 @@ galaxy_systemd_env: [] # A list of additional python packages to install into galaxy's virtual environment galaxy_additional_venv_packages: [] + +# galaxy themes variables +galaxy_themes_subdomains: {} +# - name: assembly +# tool_sections: +# - "hicexplorer" +# - "graph_display_data" +# - "peak_calling" +# - "assembly" +# - "annotation" +# - "genome_diversity" +# - "multiple_alignments" +# extra_tool_labels: +# - "proteomics" +galaxy_themes_static_keys: + static_dir: "" + static_images_dir: "images/" + static_scripts_dir: "scripts/" + static_welcome_html: "welcome.html/" + static_favicon_dir: "favicon.ico" + static_robots_txt: "robots.txt" +galaxy_themes_conf_path: files/galaxy/config/themes_conf.yml +galaxy_themes_static_path: "{{ galaxy_root }}/server" +galaxy_themes_static_dir: "{{ galaxy_root }}/server/static" +galaxy_themes_welcome_url_prefix: https://usegalaxy-eu.github.io/index- +galaxy_themes_ansible_file_path: files/galaxy/static +galaxy_themes_instance_domain: usegalaxy.eu diff --git a/tasks/copy_static_files.yml b/tasks/copy_static_files.yml new file mode 100644 index 0000000..0364043 --- /dev/null +++ b/tasks/copy_static_files.yml @@ -0,0 +1,18 @@ +--- +- name: Copy static files + ansible.builtin.copy: + src: "{{ item }}" + dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain }}/{{ object.value }}" + mode: '0644' + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + with_fileglob: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain }}/static/{{ object.value }}*" + +- name: Copy files from dist + ansible.builtin.copy: + src: "{{ item }}" + dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain }}/dist/" + mode: '0644' + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + with_fileglob: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain }}/static/dist/*" diff --git a/tasks/copy_themes.yml b/tasks/copy_themes.yml new file mode 100644 index 0000000..09108f6 --- /dev/null +++ b/tasks/copy_themes.yml @@ -0,0 +1,14 @@ +--- + +- name: Copy themes files + ansible.builtin.copy: + src: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain.name }}/themes/{{ subdomain.name }}.yml" + dest: "{{ galaxy_config_dir }}" + mode: '0644' + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + +- name: Append themes_conf.yml to all files in galaxy/config/themes + ansible.builtin.blockinfile: + block: "{{ lookup('ansible.builtin.file', subdomains_themes_conf_path) }}" + path: "{{ galaxy_config_dir }}/{{ subdomain.name }}.yml" diff --git a/tasks/main.yml b/tasks/main.yml index dfb47b3..e351de5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -160,3 +160,21 @@ when: galaxy_manage_cleanup tags: - galaxy_manage_cleanup + +- name: Include Copy static files + ansible.builtin.include_tasks: setup_static.yml + loop: "{{ galaxy_themes_subdomains }}" + loop_control: + loop_var: subdomain + when: galaxy_manage_static + tags: + - galaxy_manage_static + +- name: Include Copy themes files + ansible.builtin.include_tasks: copy_themes.yml + loop: "{{ galaxy_themes_subdomains }}" + loop_control: + loop_var: subdomain + when: galaxy_manage_themes + tags: + - galaxy_manage_themes diff --git a/tasks/setup_static.yml b/tasks/setup_static.yml new file mode 100644 index 0000000..b66ea4d --- /dev/null +++ b/tasks/setup_static.yml @@ -0,0 +1,49 @@ +--- +- name: Create static dirs + ansible.builtin.file: + state: directory + mode: '0755' + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + path: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}" + +- name: Move all contents from static to parent directory + ansible.builtin.command: cp -r {{ galaxy_themes_static_dir }}/. {{ galaxy_themes_static_path }}/static-{{ \ + subdomain.name }} + changed_when: false + +- name: Remove static dirs + ansible.builtin.file: + state: absent + mode: '0755' + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + path: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/static" + +- name: Create welcome.html directory + ansible.builtin.file: + state: directory + mode: '0755' + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + path: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html" + +- name: Check if iframe for subdomain exists + ansible.builtin.uri: + url: "{{ galaxy_themes_welcome_url_prefix }}{{ subdomain.name }}.html" + return_content: true + register: iframe + +- name: Template welcome.html for subdomains + ansible.builtin.template: + src: welcome.html.j2 + dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html/index.html" + owner: "{{ __galaxy_privsep_user_name }}" + group: "{{ __galaxy_privsep_user_group }}" + mode: '0644' + +- name: Copy static files + ansible.builtin.include_tasks: copy_static_files.yml + loop: "{{ galaxy_themes_static_keys | dict2items }}" + loop_control: + loop_var: object From bdeb8776419f30e10dd349e9d1800a6a4da6cbf3 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 14:57:54 +0200 Subject: [PATCH 02/25] add global host filters --- defaults/main.yml | 52 +++++++++++++++++---- tasks/main.yml | 9 +++- tasks/{copy_themes.yml => themes.yml} | 0 templates/global_host_filters.py.j2 | 67 +++++++++++++++++++++++++++ 4 files changed, 118 insertions(+), 10 deletions(-) rename tasks/{copy_themes.yml => themes.yml} (100%) create mode 100644 templates/global_host_filters.py.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 22e49e6..006c9db 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,6 +24,7 @@ galaxy_manage_systemd: no # For Galaxy galaxy_manage_systemd_reports: no # For Reports galaxy_manage_cleanup: no galaxy_manage_themes: no +galaxy_manage_host_filters: no # Control whether to output verbose task diffs (e.g. when performing a git update) when running Ansible with --diff. @@ -296,47 +297,47 @@ galaxy_app_config_default: # Everything else visualization_plugins_directory: "config/plugins/visualizations" - # Static and themes cofiguration, will only be added if galaxy_manage_themes - enable_static: "{{ galaxy_manage_themes }}" + # Static and themes configuration, will only be added if galaxy_manage_themes + enable_static: "{{ galaxy_manage_static }}" static_dir_by_host: > { {% if galaxy_manage_static %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/' {% end for %} {% end if %} } static_images_dir_by_host: > { {% if galaxy_manage_static %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images' {% end for %} {% end if %} } static_welcome_html_by_host: > { {% if galaxy_manage_static %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html' {% end for %} {% end if %} } static_scripts_dir_by_host: > { {% if galaxy_manage_static %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts' {% end for %} {% end if %} } static_favicon_dir_by_host: > { {% if galaxy_manage_static %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/favicon.ico' {% end for %} {% end if %} } static_robots_txt_by_host: > { {% if galaxy_manage_static %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/robots.txt' {% end for %} {% end if %} } themes_dir_by_host: > { {% if galaxy_manage_themes %} - {% for subdomain in galaxy_names_subdomains %} + {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': {{ subdomain.name }}.yml {% end for %} {% end if %} } @@ -497,3 +498,36 @@ galaxy_themes_static_dir: "{{ galaxy_root }}/server/static" galaxy_themes_welcome_url_prefix: https://usegalaxy-eu.github.io/index- galaxy_themes_ansible_file_path: files/galaxy/static galaxy_themes_instance_domain: usegalaxy.eu +galaxy_themes_global_host_filters_path: "{{ galaxy_root }}/server/lib/galaxy/tool_util/toolbox/filters/global_host_filters.py" +galaxy_themes_tool_base_labels: + - "file_and_meta_tools" + - "general_text_tools" + - "genomic_file_manipulation" + - "gff" + - "common_genomics" +galaxy_themes_tool_ngs_labels: + - "specific_genomics" + - "genomics_toolkits" + +# These sections will be displayed in the tool panel for every subdomain +galaxy_themes_tool_base_sections: + - "getext" + - "send" + - "collection_operations" + - "textutil" + - "convert" + - "filter" + - "group" + - "expression_tools" + +# There sections are a collection of general NGS tools and will be used in most but not all subdomains +galaxy_themes_tool_ngs_sections: + - "deeptools" + - "bed" + - "sambam" + - "bxops" + - "fastafastq" + - "fastq_quality_control" + - "picard" + - "mapping" + - "sambam" \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index e351de5..09bf75c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -171,10 +171,17 @@ - galaxy_manage_static - name: Include Copy themes files - ansible.builtin.include_tasks: copy_themes.yml + ansible.builtin.include_tasks: themes.yml loop: "{{ galaxy_themes_subdomains }}" loop_control: loop_var: subdomain when: galaxy_manage_themes tags: - galaxy_manage_themes + +- name: Set global host filters + ansible.builtin.template: + src: "global_host_filters.py.j2" + dest: "{{ galaxy_themes_global_host_filters_path }}" + mode: 0644 + when: galaxy_manage_host_filters diff --git a/tasks/copy_themes.yml b/tasks/themes.yml similarity index 100% rename from tasks/copy_themes.yml rename to tasks/themes.yml diff --git a/templates/global_host_filters.py.j2 b/templates/global_host_filters.py.j2 new file mode 100644 index 0000000..a032289 --- /dev/null +++ b/templates/global_host_filters.py.j2 @@ -0,0 +1,67 @@ +import logging +log = logging.getLogger( __name__ ) + +def per_host_tool_labels( context, label ): + """ + This tool section filter results in different labels being displayed based on + the fqdn the user is making the request to. This could allow a single Galaxy instance + to seem like several different instances hosting different tools based on the fqdn used + to access the Galxy. This can be enabled by renaming this file to examples.py and adding + the following to the ``app:main`` section of ``galaxy.yml``: + + tool_label_filters = examples:per_host_tool_labels + """ + host = context.trans.request.host + subdomain = host.replace('.{{ galaxy_themes_instance_domain }}', '') + # Core tools used by all virtual hosts. + valid_labels = {{ galaxy_themes_tool_base_labels }} + general_ngs_labels = {{ galaxy_themes_tool_ngs_labels }} +{% if galaxy_themes_subdomains is defined %} +{% for subsite in galaxy_themes_subdomains %} + if "{{ subsite.name }}.{{ galaxy_themes_instance_domain }}" in host: + valid_labels += general_ngs_labels +{% if subsite.extra_tool_labels is defined %} + valid_labels += {{ subsite.extra_tool_labels }} +{% endif %} + return label.id in valid_labels +{% endfor %} +{% endif %} + return True + +BASE_SECTIONS = {{ galaxy_themes_tool_base_sections }} + +GENERAL_NGS_SECTIONS = {{ galaxy_themes_tool_ngs_sections }} + +DOMAIN_SECTIONS = { +{% if galaxy_themes_subdomains is defined %} +{% for subdomain in galaxy_themes_subdomains %} +{% if subdomain.tool_sections is defined %} + '{{ subdomain.name }}': GENERAL_NGS_SECTIONS + {{ subdomain.tool_sections }}, +{% endif %} +{% endfor %} +{% endif %} +} + + +def per_host_tool_sections( context, section ): + """ + This tool section filter results in different sections being displayed based on + the fqdn the user is making the request to. This could allow a single Galaxy instance + to seem like several different instances hosting different tools based on the fqdn used + to access the Galxy. This can be enabled by renaming this file to examples.py and adding + the following to the ``app:main`` section of ``galaxy.yml``: + + tool_section_filters = examples:per_host_tool_sections + """ + host = context.trans.request.host + subdomain = host.replace('.{{ galaxy_themes_instance_domain }}', '') + + # Core tools used by all virtual hosts. + # HiCtools mode: published in NAR 2018 + if host == "{{ galaxy_themesinstance_domain }}": + return True + + if subdomain in DOMAIN_SECTIONS: + return section.id in DOMAIN_SECTIONS[subdomain] or section.id in BASE_SECTIONS + else: + return True \ No newline at end of file From 9965b6a0bde4277abdaa41f5f3beca7c96bda7dd Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 14:59:15 +0200 Subject: [PATCH 03/25] fix names --- defaults/main.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 006c9db..fca9cd4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -302,43 +302,43 @@ galaxy_app_config_default: static_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/' + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/' {% end for %} {% end if %} } static_images_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images' + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images' {% end for %} {% end if %} } static_welcome_html_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html' + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html' {% end for %} {% end if %} } static_scripts_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts' + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts' {% end for %} {% end if %} } static_favicon_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/favicon.ico' + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/favicon.ico' {% end for %} {% end if %} } static_robots_txt_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/robots.txt' + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/robots.txt' {% end for %} {% end if %} } themes_dir_by_host: > { {% if galaxy_manage_themes %} {% for subdomain in galaxy_themes_subdomains %} - '{{ subdomain.names }}.{{ galaxy_themes_instance_domain}}': {{ subdomain.name }}.yml + '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': {{ subdomain.name }}.yml {% end for %} {% end if %} } # Need to set galaxy_config_default[galaxy_app_config_section] dynamically but Ansible/Jinja2 does not make this easy From 71df44f8ca62bea8d2ff6c8e4b0a472e1914f367 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 15:19:24 +0200 Subject: [PATCH 04/25] galaxy_manage_static --- defaults/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/defaults/main.yml b/defaults/main.yml index fca9cd4..dc7732a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -24,6 +24,7 @@ galaxy_manage_systemd: no # For Galaxy galaxy_manage_systemd_reports: no # For Reports galaxy_manage_cleanup: no galaxy_manage_themes: no +galaxy_manage_static: no galaxy_manage_host_filters: no From 773ce68ac8ab9e46f018c69bd418873e77799167 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 15:25:52 +0200 Subject: [PATCH 05/25] fix syntax --- defaults/main.yml | 76 +++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index dc7732a..5882e23 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -304,44 +304,44 @@ galaxy_app_config_default: { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/' - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } static_images_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images' - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } static_welcome_html_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html' - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } static_scripts_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts' - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } static_favicon_dir_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/favicon.ico' - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } static_robots_txt_by_host: > { {% if galaxy_manage_static %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/robots.txt' - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } themes_dir_by_host: > { {% if galaxy_manage_themes %} {% for subdomain in galaxy_themes_subdomains %} '{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': {{ subdomain.name }}.yml - {% end for %} - {% end if %} } + {% endfor %} + {% endif %} } # Need to set galaxy_config_default[galaxy_app_config_section] dynamically but Ansible/Jinja2 does not make this easy galaxy_config_default: "{{ {} | combine({galaxy_app_config_section: galaxy_app_config_default}) }}" galaxy_config_merged: "{{ galaxy_config_default | combine(galaxy_config | default({}), recursive=True) }}" @@ -501,34 +501,34 @@ galaxy_themes_ansible_file_path: files/galaxy/static galaxy_themes_instance_domain: usegalaxy.eu galaxy_themes_global_host_filters_path: "{{ galaxy_root }}/server/lib/galaxy/tool_util/toolbox/filters/global_host_filters.py" galaxy_themes_tool_base_labels: - - "file_and_meta_tools" - - "general_text_tools" - - "genomic_file_manipulation" - - "gff" - - "common_genomics" + - "file_and_meta_tools" + - "general_text_tools" + - "genomic_file_manipulation" + - "gff" + - "common_genomics" galaxy_themes_tool_ngs_labels: - - "specific_genomics" - - "genomics_toolkits" + - "specific_genomics" + - "genomics_toolkits" # These sections will be displayed in the tool panel for every subdomain galaxy_themes_tool_base_sections: - - "getext" - - "send" - - "collection_operations" - - "textutil" - - "convert" - - "filter" - - "group" - - "expression_tools" + - "getext" + - "send" + - "collection_operations" + - "textutil" + - "convert" + - "filter" + - "group" + - "expression_tools" # There sections are a collection of general NGS tools and will be used in most but not all subdomains galaxy_themes_tool_ngs_sections: - - "deeptools" - - "bed" - - "sambam" - - "bxops" - - "fastafastq" - - "fastq_quality_control" - - "picard" - - "mapping" - - "sambam" \ No newline at end of file + - "deeptools" + - "bed" + - "sambam" + - "bxops" + - "fastafastq" + - "fastq_quality_control" + - "picard" + - "mapping" + - "sambam" From cad8eedb2ec3419fbbfbf5d3f96372b1191480aa Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 15:37:08 +0200 Subject: [PATCH 06/25] rename --- tasks/main.yml | 2 +- tasks/{setup_static.yml => setup_static_dirs.yml} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tasks/{setup_static.yml => setup_static_dirs.yml} (100%) diff --git a/tasks/main.yml b/tasks/main.yml index 09bf75c..2128858 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -162,7 +162,7 @@ - galaxy_manage_cleanup - name: Include Copy static files - ansible.builtin.include_tasks: setup_static.yml + ansible.builtin.include_tasks: setup_static_dirs.yml loop: "{{ galaxy_themes_subdomains }}" loop_control: loop_var: subdomain diff --git a/tasks/setup_static.yml b/tasks/setup_static_dirs.yml similarity index 100% rename from tasks/setup_static.yml rename to tasks/setup_static_dirs.yml From b660a3678d9d493be349e41f9a54b793c0bb8103 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 15:54:44 +0200 Subject: [PATCH 07/25] variable name --- tasks/themes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/themes.yml b/tasks/themes.yml index 09108f6..85eee2d 100644 --- a/tasks/themes.yml +++ b/tasks/themes.yml @@ -10,5 +10,5 @@ - name: Append themes_conf.yml to all files in galaxy/config/themes ansible.builtin.blockinfile: - block: "{{ lookup('ansible.builtin.file', subdomains_themes_conf_path) }}" + block: "{{ lookup('ansible.builtin.file', galaxy_themes_conf_path) }}" path: "{{ galaxy_config_dir }}/{{ subdomain.name }}.yml" From b828749b8ebcf9deb5099edd84876d5cc89d8900 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 15:58:58 +0200 Subject: [PATCH 08/25] typo --- templates/global_host_filters.py.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/global_host_filters.py.j2 b/templates/global_host_filters.py.j2 index a032289..41ec121 100644 --- a/templates/global_host_filters.py.j2 +++ b/templates/global_host_filters.py.j2 @@ -58,7 +58,7 @@ def per_host_tool_sections( context, section ): # Core tools used by all virtual hosts. # HiCtools mode: published in NAR 2018 - if host == "{{ galaxy_themesinstance_domain }}": + if host == "{{ galaxy_themes_instance_domain }}": return True if subdomain in DOMAIN_SECTIONS: From 7e1a0ff40ca23c00779f87113efc432c7bdf403b Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 16:18:01 +0200 Subject: [PATCH 09/25] fix variable --- tasks/copy_static_files.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/copy_static_files.yml b/tasks/copy_static_files.yml index 0364043..a765719 100644 --- a/tasks/copy_static_files.yml +++ b/tasks/copy_static_files.yml @@ -2,17 +2,17 @@ - name: Copy static files ansible.builtin.copy: src: "{{ item }}" - dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain }}/{{ object.value }}" + dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/{{ object.value }}" mode: '0644' owner: "{{ __galaxy_privsep_user_name }}" group: "{{ __galaxy_privsep_user_group }}" - with_fileglob: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain }}/static/{{ object.value }}*" + with_fileglob: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain.name }}/static/{{ object.value }}*" - name: Copy files from dist ansible.builtin.copy: src: "{{ item }}" - dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain }}/dist/" + dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/dist/" mode: '0644' owner: "{{ __galaxy_privsep_user_name }}" group: "{{ __galaxy_privsep_user_group }}" - with_fileglob: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain }}/static/dist/*" + with_fileglob: "{{ galaxy_themes_ansible_file_path }}/{{ subdomain.name }}/static/dist/*" From 9903e44245ec7c481c577f7cb1228730cbebe9e2 Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 16:31:28 +0200 Subject: [PATCH 10/25] welcome template --- defaults/main.yml | 1 + tasks/setup_static_dirs.yml | 1 + templates/welcome.html.j2 | 39 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 templates/welcome.html.j2 diff --git a/defaults/main.yml b/defaults/main.yml index 5882e23..fa480c1 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -497,6 +497,7 @@ galaxy_themes_conf_path: files/galaxy/config/themes_conf.yml galaxy_themes_static_path: "{{ galaxy_root }}/server" galaxy_themes_static_dir: "{{ galaxy_root }}/server/static" galaxy_themes_welcome_url_prefix: https://usegalaxy-eu.github.io/index- +galaxy_themes_default_welcome: https://galaxyproject.org galaxy_themes_ansible_file_path: files/galaxy/static galaxy_themes_instance_domain: usegalaxy.eu galaxy_themes_global_host_filters_path: "{{ galaxy_root }}/server/lib/galaxy/tool_util/toolbox/filters/global_host_filters.py" diff --git a/tasks/setup_static_dirs.yml b/tasks/setup_static_dirs.yml index b66ea4d..303dd45 100644 --- a/tasks/setup_static_dirs.yml +++ b/tasks/setup_static_dirs.yml @@ -33,6 +33,7 @@ url: "{{ galaxy_themes_welcome_url_prefix }}{{ subdomain.name }}.html" return_content: true register: iframe + failed_when: false - name: Template welcome.html for subdomains ansible.builtin.template: diff --git a/templates/welcome.html.j2 b/templates/welcome.html.j2 new file mode 100644 index 0000000..3ce522d --- /dev/null +++ b/templates/welcome.html.j2 @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + \ No newline at end of file From 3dc101a4fab344ab4b00ea5bb16a21543121844b Mon Sep 17 00:00:00 2001 From: Mira Kuntz Date: Thu, 3 Aug 2023 16:57:26 +0200 Subject: [PATCH 11/25] fix welcome --- templates/welcome.html.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/welcome.html.j2 b/templates/welcome.html.j2 index 3ce522d..79ded41 100644 --- a/templates/welcome.html.j2 +++ b/templates/welcome.html.j2 @@ -29,7 +29,7 @@