Skip to content

Commit

Permalink
Update Galaxy in CVMFS
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Jun 3, 2016
1 parent 9d2ecd4 commit ade5239
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@
<tool id="testtoolshed.g2.bx.psu.edu/repos/iuc/macs2/macs2_refinepeak/2.1.0.20140616.0" />
</section>
<section id="group" name="Join, Subtract and Group" version="">
<tool id="toolshed.g2.bx.psu.edu/repos/iuc/collection_column_join/collection_column_join/0.0.1" />
<tool id="toolshed.g2.bx.psu.edu/repos/devteam/subtract_query/subtract_query1/0.1" />
<tool id="join1" />
<tool id="comp1" />
Expand Down
129 changes: 84 additions & 45 deletions galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,88 @@

# FIXME: can't notify for restart across plays

- name: Galaxy web code and dependencies, manage static configs
hosts: galaxyservers
remote_user: "{{ galaxy_privileged_user }}"
vars_files:
- "{{ deploy_env }}/secret_vars/galaxyservers.yml"
vars:
instance_root: "{{ galaxy_root }}"
galaxy_config: "{{ galaxy_config_hash }}"
roles:
# set up local galaxy clone and local config
- role: galaxyprojectdotorg.galaxy
galaxy_manage_clone: no
galaxy_manage_static_setup: yes
galaxy_manage_mutable_setup: no
galaxy_manage_database: no
galaxy_fetch_dependencies: no
post_tasks:
# create impersonation config on Main
- name: Set galaxy_config to impersonate_config_hash
set_fact:
galaxy_config: "{{ impersonate_config_hash }}"
when: deploy_env == "production"
- name: Update Galaxy on CVMFS stratum 0 server
hosts: cvmfsstratum0servers
remote_user: "{{ galaxy_user }}"
tasks:
- name: Begin CVMFS transaction
command: /usr/bin/cvmfs_server transaction {{ galaxy_instance_codename }}.galaxyproject.org

- name: Create Galaxy impersonation configuration file
template: src=roles/galaxyprojectdotorg.galaxy/templates/galaxy.ini.j2 dest={{ galaxy_config_dir }}/impersonate.ini backup=yes
when: deploy_env == "production"
- name: Restart docker
service:
name: docker
state: restarted

# create installer config
- name: Set galaxy_config to installer_config_hash
set_fact:
galaxy_config: "{{ installer_config_hash }}"
- name: Fetch Galaxy commit
command: "/usr/bin/git rev-parse HEAD"
args:
chdir: /cvmfs/{{ galaxy_instance_codename }}.galaxyproject.org/galaxy
register: galaxy_commit_old

- name: Create Galaxy installer configuration file
template: src=roles/galaxyprojectdotorg.galaxy/templates/galaxy.ini.j2 dest={{ galaxy_config_dir }}/installer.ini backup=yes
- name: Update Galaxy
# TODO: use docker_container maybe?
command: docker run --rm -v /cvmfs:/cvmfs galaxy/update /cvmfs/{{ galaxy_instance_codename }}.galaxyproject.org/bin/update_galaxy.sh

# create data manager config
- name: Set galaxy_config to datamanager_config_hash
set_fact:
galaxy_config: "{{ datamanager_config_hash }}"
# TODO: store these somewhere in the playbook
- name: Fetch Galaxy version
command: "/usr/bin/docker run --rm -v /cvmfs:/cvmfs -e PYTHONPATH=/cvmfs/{{ galaxy_instance_codename }}.galaxyproject.org/galaxy/lib galaxy/update /cvmfs/{{ galaxy_instance_codename }}.galaxyproject.org/venv/bin/python -c 'from galaxy.version import VERSION; print VERSION'"
register: galaxy_version

- name: Create Galaxy data manager configuration file
template: src=roles/galaxyprojectdotorg.galaxy/templates/galaxy.ini.j2 dest={{ galaxy_config_dir }}/datamanager.ini backup=yes
- name: Fetch Galaxy commit
command: "/usr/bin/git rev-parse HEAD"
args:
chdir: /cvmfs/{{ galaxy_instance_codename }}.galaxyproject.org/galaxy
register: galaxy_commit

- name: Galaxy database and mutable configs
- name: Fetch Galaxy short commit
command: "/usr/bin/git rev-parse --short HEAD"
args:
chdir: /cvmfs/{{ galaxy_instance_codename }}.galaxyproject.org/galaxy
register: galaxy_commit_short

- name: Abort CVMFS transaction
command: /usr/bin/cvmfs_server abort -f {{ galaxy_instance_codename }}.galaxyproject.org
when: galaxy_commit_old.stdout == galaxy_commit.stdout

- name: Exit if no changes
fail:
msg: Galaxy commit ID did not change after updating, transaction aborted
when: galaxy_commit_old.stdout == galaxy_commit.stdout

- name: Store updated version information
local_action:
module: copy
# Fixme: should probably use to_nice_yaml
content: |
---
galaxy_version: {{ galaxy_version.stdout }}
galaxy_commit: {{ galaxy_commit.stdout }}
galaxy_commit_short: {{ galaxy_commit_short.stdout }}
dest: "{{ deploy_env }}/galaxy_version.yml"

- name: Publish CVMFS transaction
command: /usr/bin/cvmfs_server publish -a "galaxy_{{ galaxy_version.stdout }}_{{ galaxy_commit_short.stdout }}" -m "Update Galaxy to version {{ galaxy_version.stdout }} commit {{ galaxy_commit.stdout }} via Ansible" {{ galaxy_instance_codename }}.galaxyproject.org

- name: Snapshot CVMFS changes on stratum 1 servers
hosts: cvmfsstratum1servers
remote_user: "{{ galaxy_user }}"
tasks:
- name: CVMFS snapshot
command: /usr/bin/cvmfs_server snapshot {{ galaxy_instance_codename }}.galaxyproject.org

- name: Clear squid cache (restart)
service:
name: squid
state: restarted

- name: Wipe CVMFS cache on Galaxy servers
hosts: galaxyservers
remote_user: "{{ galaxy_user }}"
tasks:
- name: Wipe CVMFS cache
command: /usr/local/bin/cvmfs_wipecache

- name: Galaxy database and interactive environments
hosts: galaxyservers
remote_user: "{{ galaxy_user }}"
vars_files:
Expand All @@ -58,24 +96,25 @@
- role: galaxyprojectdotorg.galaxy
galaxy_manage_clone: no
galaxy_manage_static_setup: no
galaxy_manage_mutable_setup: yes
galaxy_manage_mutable_setup: no
galaxy_manage_database: yes
galaxy_fetch_eggs: no
when: inventory_hostname in groups['galaxymasters']
# fetch and distribute mutable configs (needs the galaxy_mutable_configs
# var set in galaxyprojectdotorg.galaxy)
- role: usegalaxy
# Set up interactive environments
# FIXME: clone the version in galaxy_version.yml
- role: galaxyprojectdotorg.interactive_environments
post_tasks:
# FIXME: still need to kill hung uWSGI workers
- name: Restart Galaxy
command: /home/g2{{ galaxy_instance_codename }}/bin/galaxy graceful

- name: Galaxy privileged user tasks and static content setup
- name: Update version in welcome.html
hosts: galaxyservers
remote_user: "{{ galaxy_privileged_user }}"
vars_files:
- "{{ deploy_env }}/secret_vars/galaxyservers.yml"
- "{{ deploy_env }}/galaxy_version.yml"
roles:
- role: usegalaxy_privileged
# welcome page
- role: usegalaxy_static

- name: Update Galaxy on Pulsar servers
Expand Down
2 changes: 2 additions & 0 deletions galaxy_static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

- hosts: galaxyservers
remote_user: "{{ galaxy_privileged_user }}"
vars_files:
- "{{ deploy_env }}/galaxy_version.yml"
roles:
- role: usegalaxy_static
4 changes: 4 additions & 0 deletions stage/galaxy_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
galaxy_version: 16.07.dev
galaxy_commit: 789c3009369c0f3712cc140d404ad0a8b1151f48
galaxy_commit_short: 789c300
1 change: 1 addition & 0 deletions stage/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ deploy_env: stage
galaxy_changeset_id: 25a26d8c9c4f21e84e39741c98755f10c4519d8b
galaxy_vcs: git
galaxy_instance_codename: test
galaxy_user: g2test
1 change: 0 additions & 1 deletion stage/group_vars/galaxyservers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ galaxy_log_dir: "{{ galaxy_root }}/log"


## used by: the play itself
galaxy_user: g2test
# As of Ansible 2.0, a variable name matching a word used in a with_items loop
# (as in supervisord_group_configs) will be expanded, despite the fact that
# bare word expansion is deprecated. D=
Expand Down
8 changes: 8 additions & 0 deletions stage/inventory
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ radegast.galaxyproject.org

[virtualhosts]
radegast.galaxyproject.org

[cvmfsstratum0servers]
cvmfs0-tacc0.galaxyproject.org

[cvmfsstratum1servers]
cvmfs1-tacc0.galaxyproject.org
cvmfs1-iu0.galaxyproject.org
cvmfs1-psu0.galaxyproject.org
2 changes: 1 addition & 1 deletion templates/galaxy/common/static/welcome.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

<p style="font-size: 90%;">This is a free, public, internet accessible resource. Data transfer and data storage are not encrypted. If there are restrictions on the way your research data can be stored and used, please consult your local institutional review board or the project PI before uploading it to any public site, including this Galaxy server. If you have protected data, large data storage requirements, or short deadlines you are encouraged to setup your own <a href="http://getgalaxy.org/" target="_blank">local Galaxy instance</a> or run <a href="http://usegalaxy.org/cloud" target="_blank">Galaxy on the cloud</a>.</p>

<p class="text-center"><small>Galaxy version {{ version_major.stdout }}, commit <code><a href="https://github.com/galaxyproject/galaxy/commit/{{ galaxy_changeset_id }}" target="_blank">{{ galaxy_changeset_id }}</a></code></small></p>
<p class="text-center"><small>Galaxy version {{ galaxy_version }}, commit <code><a href="https://github.com/galaxyproject/galaxy/commit/{{ galaxy_commit }}" target="_blank">{{ galaxy_commit }}</a></code></small></p>

</div>
</div>
Expand Down

0 comments on commit ade5239

Please sign in to comment.