Skip to content

Commit

Permalink
Merge pull request galaxyproject#198 from mira-miracoli/themes
Browse files Browse the repository at this point in the history
Symlinks reduce disk usage
  • Loading branch information
natefoo authored Dec 5, 2023
2 parents 94ac81e + aceb4eb commit 06cbe3f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ galaxy_themes_static_keys:
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
Expand Down
35 changes: 34 additions & 1 deletion tasks/static_subdomain_dirs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,40 @@
mode: '0755'
owner: "{{ __galaxy_privsep_user_name }}"
group: "{{ __galaxy_privsep_user_group }}"
path: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}"
path: "{{ galaxy_themes_static_path }}/{{ item }}"
with_items:
- "static-{{ subdomain.name }}"
- "static-{{ subdomain.name }}/dist"

- name: Register files in static/dist
ansible.builtin.find:
paths: "{{ galaxy_themes_static_path }}/static/dist"
file_type: file
when: galaxy_themes_symlinks
register: dist_files

- name: "Symlink files static-{{ subdomain.name }}/dist to static/dist"
ansible.builtin.file:
src: "{{ item.path }}"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/dist/{{ item.path | basename }}"
state: link
when: galaxy_themes_symlinks
no_log: "{{ galaxy_themes_symlinks_no_log }}"
with_items: "{{ dist_files.files }}"

- name: "Symlink directory {{ item }} from static-{{ subdomain.name }}/{{ item }} to static/{{ item }}"
ansible.builtin.file:
src: "{{ galaxy_themes_static_path }}/static/{{ item }}"
dest: "{{ galaxy_themes_static_path }}/static-{{ subdomain.name }}/{{ item }}"
state: link
when: galaxy_themes_symlinks
ignore_errors: true
with_items:
- "plugins"
- "patmat"
- "toolshed"
- "wymeditor"
- "style"

- name: Synchronize contents from static to static-"{{ subdomain.name }}"
ansible.posix.synchronize:
Expand Down

0 comments on commit 06cbe3f

Please sign in to comment.