Skip to content

Commit

Permalink
Support external (outside the venv) Gravity
Browse files Browse the repository at this point in the history
  • Loading branch information
natefoo committed Feb 5, 2024
1 parent 7650a92 commit 347748d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ galaxy_node_version_max: >-
__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, '') }}"
galaxy_gravity_command: "{{ galaxy_venv_dir }}/bin/galaxyctl"

# 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
4 changes: 2 additions & 2 deletions handlers/gravity_22.05.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# handlers for gravity as used in galaxy version 22.05

- name: galaxy gravity restart
command: "{{ galaxy_venv_dir }}/bin/galaxyctl graceful"
command: "{{ galaxy_gravity_command }} graceful"
environment:
GRAVITY_STATE_DIR: "{{ galaxy_gravity_state_dir }}"
listen: "restart galaxy"

- name: galaxyctl update
command: "{{ galaxy_venv_dir }}/bin/galaxyctl update"
command: "{{ galaxy_gravity_command }} update"
environment:
GRAVITY_STATE_DIR: "{{ galaxy_gravity_state_dir }}"
listen: "galaxyctl update"
4 changes: 2 additions & 2 deletions handlers/gravity_23.0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# handlers for gravity as used in galaxy version 23.0

- name: galaxyctl update
command: "{{ galaxy_venv_dir }}/bin/galaxyctl -c {{ galaxy_config_file }} update"
command: "{{ galaxy_gravity_command }} -c {{ galaxy_config_file }} update"
listen: "galaxyctl update"
become: yes
become_user: "{{ (__galaxy_gravity_pm == 'systemd' and galaxy_systemd_root) | ternary('root', __galaxy_user_name) }}"

- name: galaxy gravity restart
command: "{{ galaxy_venv_dir }}/bin/galaxyctl -c {{ galaxy_config_file }} graceful"
command: "{{ galaxy_gravity_command }} -c {{ galaxy_config_file }} graceful"
listen: "restart galaxy"
become: yes
become_user: "{{ (__galaxy_gravity_pm == 'systemd' and galaxy_systemd_root) | ternary('root', __galaxy_user_name) }}"
4 changes: 2 additions & 2 deletions tasks/gravity.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
block:

- name: Register Galaxy config with Gravity (Gravity < 1)
command: "{{ galaxy_venv_dir }}/bin/galaxyctl register {{ galaxy_config_file }}"
command: "{{ galaxy_gravity_command }} register {{ galaxy_config_file }}"
args:
creates: "{{ galaxy_gravity_state_dir }}/configstate.yaml"

Expand All @@ -21,7 +21,7 @@
content: |
#!/usr/bin/env sh
export GRAVITY_CONFIG_FILE={{ galaxy_config_file | quote }}
exec {{ (galaxy_venv_dir ~ '/bin/galaxyctl') | quote }} "$@"
exec {{ galaxy_gravity_command | quote }} "$@"
dest: "{{ galaxy_gravity_wrapper_path }}"
mode: "0755"
when: galaxy_gravity_wrapper_path is not none
Expand Down

0 comments on commit 347748d

Please sign in to comment.