Skip to content

Commit

Permalink
Merge pull request #56 from galaxyproject/usegalaxy-privileged-extras
Browse files Browse the repository at this point in the history
Support for installing local tools and dynamic job rules from the playbook
  • Loading branch information
hexylena authored Jan 27, 2019
2 parents e759adb + ba8284d commit b16be13
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 5 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ Options for configuring Galaxy and controlling which version is installed.
file. See the Example Playbooks below for usage.
- `galaxy_config_files`: List of hashes (with `src` and `dest` keys) of files to copy from the control machine.
- `galaxy_config_templates`: List of hashes (with `src` and `dest` keys) of templates to fill from the control machine.
- `galaxy_local_tools`: List of local tool files or directories to copy from the control machine, relative to
`galaxy_local_tools_src_dir` (default: `files/galaxy/tools` in the playbook).
- `galaxy_local_tools_dir`: Directory on the Galaxy server where local tools will be installed.
- `galaxy_dynamic_job_rules`: List of dynamic job rules to copy from the control machine, relative to
`galaxy_dynamic_job_rules_src_dir` (default: `files/galaxy/dynamic_job_rules` in the playbook).
- `galaxy_dynamic_job_rules_dir` (default: `{{ galaxy_server_dir }}/lib/galaxy/jobs/rules`): Directory on the Galaxy
server where dynamic job rules will be installed. If changed from the default, ensure the directory is on Galaxy's
`$PYTHONPATH` (e.g. in `{{ galaxy_venv_dir }}/lib/python2.7/site-packages`) and configure the dynamic rules plugin in
`job_conf.xml` accordingly.
- `galaxy_repo` (default: `https://github.com/galaxyproject/galaxy.git`): Upstream Git repository from which Galaxy
should be cloned.
- `galaxy_commit_id` (default: `master`): A commit id, tag, branch, or other valid Git reference that Galaxy should be
Expand Down Expand Up @@ -311,4 +320,4 @@ This role was written and contributed to by the following people:
- [Simon Belluzzo](https://github.com/simonalpha)
- [John Chilton](https://github.com/jmchilton)
- [Nate Coraor](https://github.com/natefoo)
- [Helena Rasche](https://github.com/erasche)
- [Helena Rasche](https://github.com/erasche)
20 changes: 19 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,19 @@ galaxy_privsep_dirs:
- "{{ galaxy_venv_dir }}"
- "{{ galaxy_server_dir }}"
- "{{ galaxy_config_dir }}"
- "{{ galaxy_local_tools_dir }}"

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

# Local (relative to playbook) path to dynamic job rules
galaxy_dynamic_job_rules_src_dir: files/galaxy/dynamic_job_rules

# Remote path to dynamic job rules (must be on Galaxy's $PYTHONPATH if not the default)
galaxy_dynamic_job_rules_dir: "{{ galaxy_server_dir }}/lib/galaxy/jobs/rules"

# List of dynamic rules to install
galaxy_dynamic_job_rules: []

#
# Version control
Expand Down Expand Up @@ -125,6 +138,11 @@ galaxy_download_url: "{{ galaxy_repo | replace('.git', '') }}/archive/{{ galaxy_
# Directory layout for deployment (legacy is the default)
#galaxy_layout: legacy

# List of tool configs to load
galaxy_tool_config_files:
- "{{ galaxy_server_dir }}/config/tool_conf.xml.sample"
- "{{ galaxy_shed_tool_conf_file }}"

# The shed tool conf path is needed separate from the value of tool_conf for instantiation
galaxy_shed_tool_conf_file: "{{ galaxy_mutable_config_dir }}/shed_tool_conf.xml"

Expand Down Expand Up @@ -176,7 +194,7 @@ galaxy_app_config_default:
tool_dependency_dir: "{{ galaxy_tool_dependency_dir }}"

# Static config files
tool_config_file: "{{ galaxy_server_dir }}/config/tool_conf.xml.sample,{{ galaxy_shed_tool_conf_file }}"
tool_config_file: "{{ galaxy_tool_config_files | join(',') }}"

# Everything else
visualization_plugins_directory: "config/plugins/visualizations"
Expand Down
1 change: 1 addition & 0 deletions tasks/layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- galaxy_mutable_config_dir
- galaxy_shed_tools_dir
- galaxy_cache_dir
- galaxy_local_tools_dir

- name: Check that any explicitly set Galaxy config options match the values of explicitly set variables
assert:
Expand Down
41 changes: 41 additions & 0 deletions tasks/static_setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,47 @@
backup: "{{ galaxy_backup_configfiles }}"
with_items: "{{ galaxy_config_templates }}"

- name: Install local tools
copy:
src: "{{ galaxy_local_tools_src_dir }}/{{ item }}"
dest: "{{ galaxy_local_tools_dir }}/{{ item }}"
with_items: "{{ galaxy_local_tools | default([]) }}"
when: galaxy_local_tools is defined

- name: Install local_tool_conf.xml
template:
src: local_tool_conf.xml.j2
dest: "{{ galaxy_config_dir }}/local_tool_conf.xml"
when: galaxy_local_tools is defined

- name: Append local_tool_conf.xml to tool_config_file Galaxy config option
set_fact:
galaxy_tool_config_files: "{{ galaxy_tool_config_files }} + ['{{ galaxy_config_dir ~ '/local_tool_conf.xml' }}']"
when: galaxy_local_tools is defined

- name: Ensure dynamic job rules paths exists
file:
path: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}"
state: directory
loop_control:
label: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}"
with_items: "{{ galaxy_dynamic_job_rules }}"

- name: Install dynamic job rules
copy:
src: "{{ galaxy_dynamic_job_rules_src_dir }}/{{ item }}"
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item }}"
with_items: "{{ galaxy_dynamic_job_rules }}"

- name: Ensure dynamic rule __init__.py's exist
copy:
content: ""
dest: "{{ galaxy_dynamic_job_rules_dir }}/{{ item | dirname }}/__init__.py"
force: no
loop_control:
label: "{{ galaxy_dynamic_job_rules_dir }}/{{ ((item | dirname) != '') | ternary ((item | dirname) ~ '/', '') }}__init__.py"
with_items: "{{ galaxy_dynamic_job_rules }}"

- name: Create Galaxy configuration file
template:
src: "{{ galaxy_config_file_template }}"
Expand Down
8 changes: 8 additions & 0 deletions templates/local_tool_conf.xml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version='1.0' encoding='utf-8'?>
<toolbox monitor="true" tool_path="{{ galaxy_local_tools_dir }}">
{% for tool in galaxy_local_tools %}
{% if tool.endswith('.xml') %}
<tool file="{{ tool }}" />
{% endif %}
{% endfor %}
</toolbox>
1 change: 1 addition & 0 deletions vars/layout-custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Layout defaults
__galaxy_mutable_config_dir: "{{ galaxy_mutable_data_dir }}/config"
__galaxy_cache_dir: "{{ galaxy_mutable_data_dir }}/cache"
__galaxy_local_tools_dir: null
__galaxy_shed_tools_dir: "{{ galaxy_mutable_data_dir }}/shed_tools"

# These correspond to galaxy config options
Expand Down
1 change: 1 addition & 0 deletions vars/layout-legacy-improved.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __galaxy_config_dir: "{{ galaxy_server_dir }}/config"
__galaxy_mutable_data_dir: "{{ galaxy_server_dir }}/database"
__galaxy_mutable_config_dir: "{{ galaxy_server_dir }}/config"
__galaxy_cache_dir: "{{ galaxy_mutable_data_dir }}"
__galaxy_local_tools_dir: null
__galaxy_shed_tools_dir: "{{ galaxy_mutable_data_dir }}/shed_tools"

# These correspond to galaxy config options
Expand Down
1 change: 1 addition & 0 deletions vars/layout-legacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __galaxy_config_dir: "{{ galaxy_server_dir }}"
__galaxy_mutable_data_dir: "{{ galaxy_server_dir }}/database"
__galaxy_mutable_config_dir: "{{ galaxy_server_dir }}"
__galaxy_cache_dir: "{{ galaxy_mutable_data_dir }}"
__galaxy_local_tools_dir: null
__galaxy_shed_tools_dir: "{{ galaxy_server_dir }}/../shed_tools"

# These correspond to galaxy config options
Expand Down
7 changes: 4 additions & 3 deletions vars/layout-opt.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---

# Layout defaults
__galaxy_server_dir: "/opt/galaxy/server"
__galaxy_venv_dir: "/opt/galaxy/venv"
__galaxy_server_dir: "/opt/galaxy"
__galaxy_venv_dir: "/var/opt/galaxy/venv"
__galaxy_config_dir: "/etc/opt/galaxy"
__galaxy_mutable_data_dir: "/var/opt/galaxy"
__galaxy_mutable_data_dir: "/var/opt/galaxy/data"
__galaxy_mutable_config_dir: "{{ galaxy_mutable_data_dir }}/config"
__galaxy_cache_dir: "{{ galaxy_mutable_data_dir }}/cache"
__galaxy_local_tools_dir: "/var/opt/galaxy/local_tools"
__galaxy_shed_tools_dir: "{{ galaxy_mutable_data_dir }}/shed_tools"

# These correspond to galaxy config options
Expand Down
1 change: 1 addition & 0 deletions vars/layout-root-dir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ __galaxy_config_dir: "{{ galaxy_root }}/config"
__galaxy_mutable_data_dir: "{{ galaxy_root }}/var"
__galaxy_mutable_config_dir: "{{ galaxy_mutable_data_dir }}/config"
__galaxy_cache_dir: "{{ galaxy_mutable_data_dir }}/cache"
__galaxy_local_tools_dir: "{{ galaxy_root }}/local_tools"
__galaxy_shed_tools_dir: "{{ galaxy_mutable_data_dir }}/shed_tools"

# These correspond to galaxy config options
Expand Down

0 comments on commit b16be13

Please sign in to comment.