Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/artbio/ansible-galaxy into …
Browse files Browse the repository at this point in the history
…main
  • Loading branch information
drosofff committed Dec 28, 2023
2 parents 37ddb62 + e07b036 commit cb65cc3
Show file tree
Hide file tree
Showing 22 changed files with 567 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
- ubuntu:20.04
- ubuntu:22.04
galaxy-version:
- '21.01'
- '22.01'
- '22.05'
- '23.0'
- 'dev'
exclude:
# wheels often don't exist in the combination of old package versions in older galaxy releases for newer
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
# See: https://github.com/ansible/galaxy/issues/46

name: Release
name: Release (by Tag Push)

'on':
push:
Expand All @@ -18,10 +18,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'

Expand Down
35 changes: 21 additions & 14 deletions .github/workflows/slugger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,50 +16,57 @@ name: "Automatic Regular Releases"
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 1'
- cron: '0 0 * * 1'

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the codebase.
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python 3.
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install Ansible.
run: pip3 install ansible-base
run: pip3 install six ansible-base

- name: Check for changes
run: |
MOST_RECENT_TAG=$(git describe --tags --abbrev=0)
CHANGES=$(git diff ${MOST_RECENT_TAG} --name-only | wc -l)
echo "Found ${CHANGES} files"
git diff ${MOST_RECENT_TAG} --name-only
LATEST_TAG=$(git describe --tags --abbrev=0)
echo "The last released tag was ${LATEST_TAG}"
CHANGES=$(git diff ${LATEST_TAG} --name-only | wc -l)
echo "Found ${CHANGES} changed files"
git diff ${LATEST_TAG} --name-only
echo "changed_files=${CHANGES}" >> $GITHUB_ENV
- name: Create a new git tag
run: |
MOST_RECENT_TAG=$(git describe --tags --abbrev=0)
major_minor=$(echo "$MOST_RECENT_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\1/')
patch=$(echo "$MOST_RECENT_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\2/')
LATEST_TAG=$(git describe --tags --abbrev=0)
major_minor=$(echo "$LATEST_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\1/')
patch=$(echo "$LATEST_TAG" | sed 's/\(.*\..*\.\)\(.*\)/\2/')
newpatch=$(echo "$patch + 1" | bc)
NEW_TAG="${major_minor}${newpatch}"
echo "$MOST_RECENT_TAG -> $NEW_TAG"
echo "$LATEST_TAG -> $NEW_TAG"
git config user.name github-actions
git config user.email [email protected]
git tag "$NEW_TAG"
git push --tags
echo "Creating new tag $NEW_TAG" >> $GITHUB_STEP_SUMMARY
if: env.changed_files > 0

# We have to do this step as GHA prevents triggering it's own actions, to prevent runaway loops.
# We have to do this step as GHA prevents triggering it's own actions, to
# prevent runaway loops.
- name: Trigger a new import on Galaxy.
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) --branch main
run: |
org=$(echo ${{ github.repository }} | cut -d/ -f1)
repo=$(echo ${{ github.repository }} | cut -d/ -f2)
key=${{ secrets.GALAXY_API_KEY }}
ansible-galaxy role import --api-key $key $org $repo --branch main
if: env.changed_files > 0
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,44 @@ The handler should "listen" to the topic `"restart galaxy"`.

[gravity]: https://github.com/galaxyproject/gravity

From release 22.01 Galaxy can serve different static content per host (e.g. subdomain) and you can set [themes][themes] per host.

By setting `galaxy_manage_subdomain_static: yes` you enable the creation of static directories and configuration per host and by setting `galaxy_manage_themes: yes` the role will append your themes_config.yml file specified under `galaxy_themes_conf_path` to your themes files after coping them over to your galaxy server and create the respective configuration.

In order to use this feature, you need to create the following directory structure under files/ (customizable with the `galaxy_themes_ansible_file_path` variable):

~~~bash
files/galaxy/static
├──<subdomain-name-1>
│   ├── static
│   │   ├── dist (optional)
│   │   │   └── some-image.png
│   │   ├── images (optional)
│   │   │   └── more-content.jpg
│   │   └── welcome.html (optional, galaxyproject.org will be displayed otherwise.)
│   └── themes
│   └── <subdomain-name-1>.yml
├── <subdomain-name-2>
│   ├── static
│   │   ├── dist (optional)
│   │   │   ├── another-static-image.svg
│   │   │   └── more-static-content-2.svg
│   │   └── welcome.html (optional)
│   └── themes
│   └── <subdomain-name-2>.yml
... (and many more subdomains)
~~~

Where the <subdomain-name-1> should exactly match your subdomain's name. The subdirectories `static` and `themes` are mandatory, as well as the correctly named theme file (if you enabled `galaxy_manage_themes`), while all subdirectories in `static` are optional.
Which subdirectories and files are copied is managed by the `static_galaxy_themes_keys` variable.

Also make sure that you set `galaxy_themes_welcome_url_prefix`, so your welcome pages are templated correctly.

It is mandatory to set the variables under `galaxy_themes_subdomains` as shown in the example in [defaults/main.yml](defaults/main.yml). If you enabled the `galaxy_manage_host_filters` variable, you can also specify the tool sections that should be shown for each individual subdomain.



[themes]: https://training.galaxyproject.org/training-material/topics/admin/tutorials/customization/tutorial.html
**New options for Galaxy 18.01 and later**

- `galaxy_config_style` (default: `yaml`): The type of Galaxy configuration file to write, `yaml` for the YAML format supported by uWSGI or `ini-paste` for the traditional PasteDeploy-style INI file
Expand Down Expand Up @@ -503,3 +541,4 @@ This role was written and contributed to by the following people:
- [John Chilton](https://github.com/jmchilton)
- [Nate Coraor](https://github.com/natefoo)
- [Helena Rasche](https://github.com/hexylena)
- [Mira Kuntz](https://github.com/mira-miracoli)
151 changes: 150 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ 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
galaxy_manage_subdomain_static: no
galaxy_manage_host_filters: no
galaxy_auto_brand: no # automatically sets the subdomain name as brand


# Control whether to output verbose task diffs (e.g. when performing a git update) when running Ansible with --diff.
Expand Down Expand Up @@ -107,13 +111,19 @@ galaxy_dirs:
- "{{ galaxy_tool_data_path }}"
- "{{ galaxy_log_dir }}"

# Additional directories to create as the Galaxy user, so you don't have to copy the default galaxy_dirs
galaxy_extra_dirs: []

# Directories to create as the privilege separated user if galaxy_manage_paths is enabled
galaxy_privsep_dirs:
- "{{ galaxy_venv_dir }}"
- "{{ galaxy_server_dir }}"
- "{{ galaxy_config_dir }}"
- "{{ galaxy_local_tools_dir }}"

# Additional directories to create as the privilege separated user, so you don't have to copy the default galaxy_dirs
galaxy_extra_privsep_dirs: []

# Local (relative to playbook) path to local tools
galaxy_local_tools_src_dir: files/galaxy/tools

Expand Down Expand Up @@ -182,7 +192,7 @@ _galaxy_tmpclean_command:

galaxy_tmpclean_verbose_statement: "{{ galaxy_tmpclean_verbose | ternary(' -v', '') }}"
galaxy_tmpclean_log_statement: >-
{{ (galaxy_tmpclean_log is not true) | ternary(
{{ (galaxy_tmpclean_log != true) | ternary(
((galaxy_tmpclean_log is none) | ternary(
'>/dev/null',
'>>' ~ galaxy_tmpclean_log
Expand Down Expand Up @@ -246,6 +256,7 @@ galaxy_app_config_section: "{{ 'galaxy' if galaxy_config_style in ('yaml', 'yml'

# Galaxy configuration files will be written with these permissions (mode argument to Ansible copy/template module)
galaxy_config_perms: 0640
galaxy_config_perms_public: 0644

# The default Galaxy configuration, ensures that Galaxy can find all of the configs if galaxy_config_dir !=
# galaxy_server_dir
Expand Down Expand Up @@ -288,6 +299,64 @@ galaxy_app_config_default:
# Everything else
visualization_plugins_directory: "config/plugins/visualizations"

# Static and themes configuration, will only be added if galaxy_manage_themes
static_enabled: "{{ galaxy_manage_subdomain_static }}"
static_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/',
{% endfor %}
{% endif %} }
static_images_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/images',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/images',
{% endfor %}
{% endif %} }
static_welcome_html_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/welcome.html',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/welcome.html',
{% endfor %}
{% endif %} }
static_scripts_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static/scripts',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/scripts',
{% endfor %}
{% endif %} }
static_favicon_dir_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}',
{% endfor %}
{% endif %} }
static_robots_txt_by_host: >
{ {% if galaxy_manage_subdomain_static %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_static_path }}/static',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}',
{% endfor %}
{% endif %} }
themes_config_file_by_host: >
{ {% if galaxy_manage_themes %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_conf_file_name }}',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ subdomain.name }}.yml',
{% endfor %}
{% endif %} }
brand_by_host: >
{ {% if galaxy_auto_brand %}
'{{ galaxy_themes_instance_domain }}': '{{ galaxy_themes_instance_domain }}',
{% for subdomain in galaxy_themes_subdomains %}
'{{ subdomain.name }}.{{ galaxy_themes_instance_domain}}': '{{ subdomain.name[0]|upper }}{{ subdomain.name[1:] }}',
{% 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) }}"
Expand All @@ -313,6 +382,8 @@ galaxy_errordocs_prefix: /error
# templates to be installed on the managed host.
galaxy_config_files: []
galaxy_config_templates: []
# Like above, except with world readable permissions
galaxy_config_files_public: []

# Default Gravity configuration
galaxy_gravity_state_dir: "{{ (galaxy_mutable_data_dir, 'gravity') | path_join }}"
Expand Down Expand Up @@ -358,6 +429,9 @@ galaxy_uwsgi_config_default:
# build separately, but this is not guaranteed to work for all version of Galaxy - using `make` is the safer choice.
galaxy_client_make_target: client-production-maps

# Build the client even if it is not out of date
galaxy_client_force_build: false

# If galaxy_client_make_target is null, you can set this to `development` to build the client for development
galaxy_client_node_env: production
galaxy_client_build_steps:
Expand All @@ -369,10 +443,21 @@ galaxy_client_build_steps:
- stageLibs
- plugins

__galaxy_node_version_max:
"redhat7": "16.19.1"
galaxy_node_version_max: >-
{{
(__galaxy_node_version_max[(ansible_os_family | lower) ~ ansible_distribution_major_version]) | default(galaxy_node_version)
}}
#
# systemd options
#

__galaxy_gravity_pm: "{{ (galaxy_config_merged.gravity | default({})).process_manager | default('supervisor') }}"
__galaxy_gravity_instance_name: "{{ (galaxy_config_merged.gravity | default({})).instance_name | default(none) }}"
galaxy_gravity_wrapper_path: "/usr/local/bin/galaxyctl{{ __galaxy_gravity_instance_name | ternary('-' ~ __galaxy_gravity_instance_name, '') }}"

# Currently `mule` (aka uWSGI) and `gravity` (runs Galaxy 22.01+ under gunicorn) are supported
galaxy_systemd_mode: "{{ 'mule' if __galaxy_major_version is version('22.05', '<') else 'gravity' }}"

Expand Down Expand Up @@ -405,3 +490,67 @@ 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_conf_file_name: "{{ galaxy_themes_conf_path | basename }}"
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_symlinks: true
galaxy_themes_symlinks_no_log: false # Hides extended logs for the symlink task in static/dist
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"
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"
Loading

0 comments on commit cb65cc3

Please sign in to comment.