Skip to content

Commit

Permalink
moved all tasks (except nginx) from galaxyextras repo
Browse files Browse the repository at this point in the history
  • Loading branch information
jyotipm29 committed Nov 5, 2024
1 parent b8bc58c commit 298ee36
Show file tree
Hide file tree
Showing 38 changed files with 1,879 additions and 173 deletions.
91 changes: 24 additions & 67 deletions galaxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ENV GALAXY_RELEASE=${GALAXY_RELEASE:-release_24.1} \

ENV GALAXY_CONFIG_FILE=$GALAXY_CONFIG_DIR/galaxy.yml \
GALAXY_CONFIG_JOB_CONFIG_FILE=$GALAXY_CONFIG_DIR/job_conf.xml \
GALAXY_CONFIG_JOB_METRICS_CONFIG_FILE=$GALAXY_CONFIG_DIR/job_metrics_conf.xml \
GALAXY_CONFIG_JOB_METRICS_CONFIG_FILE=$GALAXY_CONFIG_DIR/job_metrics_conf.yml \
GALAXY_CONFIG_TOOL_CONFIG_FILE=$GALAXY_CONFIG_DIR/tool_conf.xml \
GALAXY_CONFIG_TOOL_DATA_TABLE_CONFIG_PATH=$GALAXY_CONFIG_DIR/tool_data_table_conf.xml \
GALAXY_CONFIG_WATCH_TOOL_DATA_DIR=True \
Expand Down Expand Up @@ -92,19 +92,11 @@ RUN groupadd -r postgres -g $GALAXY_POSTGRES_GID \
&& curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - \
&& add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \
&& apt-get update -qq \
## && apt-get purge -y software-properties-common gpg-agent \
## && apt-get install postgresql-10 --no-install-recommends -y \
&& apt-get install nginx-extras nginx-common --no-install-recommends -y \
&& apt-get install docker-ce --no-install-recommends -y \
&& apt-get install nano --no-install-recommends -y \
&& apt-get install git --no-install-recommends -y \
&& apt-get install gridengine-common gridengine-drmaa1.0 --no-install-recommends -y \
&& apt-get install --no-install-recommends -y libswitch-perl supervisor \
&& apt-get purge -y software-properties-common gpg-agent systemd \
&& apt-get install --no-install-recommends -y nano git gridengine-common gridengine-drmaa1.0 libswitch-perl \
&& apt-get purge -y software-properties-common gpg-agent \
&& apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && rm -rf ~/.cache/ \
&& mkdir -p /etc/supervisor/conf.d/ /var/log/supervisor/ \
# we will recreate this later
## && rm -rf $PG_DATA_DIR_DEFAULT \
&& groupadd -r $GALAXY_USER -g $GALAXY_GID \
&& useradd -u $GALAXY_UID -r -g $GALAXY_USER -d $GALAXY_HOME -c "Galaxy user" --shell /bin/bash $GALAXY_USER \
&& usermod -aG docker $GALAXY_USER \
Expand Down Expand Up @@ -177,86 +169,51 @@ RUN apt update -qq && apt install --no-install-recommends -y software-properties
&& apt install --no-install-recommends -y ansible \
&& apt purge -y systemd && apt-get autoremove -y && apt-get clean

# Install postgresql
RUN ansible-playbook /ansible/postgresql_provision.yml

# Install tusd
RUN ansible-playbook /ansible/tusd_provision.yml \
&& mkdir -p $GALAXY_CONFIG_TUS_UPLOAD_STORE \
&& chown $GALAXY_USER:$GALAXY_USER $GALAXY_CONFIG_TUS_UPLOAD_STORE
# to be removed after adding nginx role
RUN ansible-playbook /ansible/nginx.yml \
--extra-vars nginx_use_remote_header=True \
--tags=nginx,proxy_prefix -c local

# Install flower
# Install flower separately as systemd tasks (tagged with 'service') have to be skipped
RUN export PATH=$GALAXY_CONDA_PREFIX/bin/:$PATH \
&& ansible-playbook /ansible/flower_provision.yml --skip-tags service \
&& ansible-playbook /ansible/flower.yml --skip-tags service \
--extra-vars flower_venv_dir=$GALAXY_VIRTUAL_ENV \
--extra-vars flower_db_file=$GALAXY_ROOT_DIR/database/flower.db \
--extra-vars flower_user=$GALAXY_USER \
--extra-vars flower_group=$GALAXY_USER \
--extra-vars flower_venv_user=$GALAXY_USER \
--extra-vars flower_venv_group=$GALAXY_USER

# Install redis
RUN ansible-playbook /ansible/redis_provision.yml \
--extra-vars redis_venv_dir=$GALAXY_VIRTUAL_ENV \
--extra-vars redis_user=$GALAXY_USER

# Install slurm
RUN ansible-playbook /ansible/slurm_provision.yml \
--extra-vars galaxy_user_name=$GALAXY_USER

# Install htcondor
RUN ansible-playbook /ansible/htcondor_provision.yml \
--extra-vars galaxy_user_name=$GALAXY_USER

# Install proftpd
RUN ansible-playbook /ansible/proftpd_provision.yml \
--extra-vars galaxy_user_name=$GALAXY_USER \
--extra-vars proftpd_sql_db=galaxy@galaxy \
--extra-vars proftpd_sql_user=$GALAXY_USER \
--extra-vars proftpd_sql_password=$GALAXY_USER \
--extra-vars galaxy_ftp_upload_dir=$EXPORT_DIR/ftp

# Install cvmfs
RUN ansible-playbook /ansible/cvmfs_provision.yml

# Install rabbitmq
RUN ansible-playbook /ansible/rabbitmq_provision.yml

RUN mkdir -p /shed_tools \
&& chown $GALAXY_USER:$GALAXY_USER /shed_tools \
RUN mkdir -p /shed_tools $GALAXY_CONFIG_TUS_UPLOAD_STORE \
&& chown $GALAXY_USER:$GALAXY_USER /shed_tools $GALAXY_CONFIG_TUS_UPLOAD_STORE \
&& ln -s /tool_deps/ $EXPORT_DIR/tool_deps \
# Configure Galaxy to use the Tool Shed
&& chown $GALAXY_USER:$GALAXY_USER $EXPORT_DIR/tool_deps \
&& ansible-playbook /ansible/provision.yml \
--extra-vars galaxy_server_dir=$GALAXY_ROOT_DIR \
--extra-vars galaxy_venv_dir=$GALAXY_VIRTUAL_ENV \
--extra-vars galaxy_log_dir=$GALAXY_LOGS_DIR \
--extra-vars galaxy_logs_dir=$GALAXY_LOGS_DIR \
--extra-vars galaxy_user_name=$GALAXY_USER \
--extra-vars galaxy_config_file=$GALAXY_CONFIG_FILE \
--extra-vars galaxy_config_dir=$GALAXY_CONFIG_DIR \
--extra-vars gravity_config_file=$GRAVITY_CONFIG_FILE \
--extra-vars galaxy_job_conf_path=$GALAXY_CONFIG_JOB_CONFIG_FILE \
--extra-vars galaxy_job_metrics_conf_path=$GALAXY_CONFIG_JOB_METRICS_CONFIG_FILE \
--extra-vars supervisor_manage_slurm="" \
--extra-vars galaxy_extras_config_condor=True \
--extra-vars galaxy_extras_config_condor_docker=True \
--extra-vars galaxy_extras_config_rabbitmq=True \
--extra-vars galaxy_extras_config_redis=True \
--extra-vars galaxy_extras_config_flower=True \
--extra-vars galaxy_extras_config_tusd=True \
--extra-vars galaxy_extras_config_cvmfs=True \
--extra-vars galaxy_extras_config_gravity=True \
--extra-vars galaxy_extras_docker_legacy=False \
--extra-vars postgresql_version=$PG_VERSION \
--extra-vars supervisor_postgres_config_path=$PG_CONF_DIR_DEFAULT/postgresql.conf \
--extra-vars supervisor_postgres_autostart=false \
--extra-vars nginx_use_remote_header=True \
--extra-vars redis_venv_dir=$GALAXY_VIRTUAL_ENV \
--extra-vars redis_venv_user=$GALAXY_USER \
--extra-vars galaxy_user_name=$GALAXY_USER \
--extra-vars proftpd_sql_db=galaxy@galaxy \
--extra-vars proftpd_sql_user=$GALAXY_USER \
--extra-vars proftpd_sql_password=$GALAXY_USER \
--extra-vars galaxy_ftp_upload_dir=$EXPORT_DIR/ftp \
--extra-vars tus_upload_store_path=$GALAXY_CONFIG_TUS_UPLOAD_STORE \
--extra-vars gx_it_proxy_sessions_path=$GALAXY_CONFIG_INTERACTIVETOOLS_MAP \
--extra-vars use_pbkdf2=True \
--tags=galaxyextras --skip-tags=tusd,flower,redis,slurm,condor,proftpd,cvmfs,rabbitmq -c local \
&& . $GALAXY_VIRTUAL_ENV/bin/activate \
&& pip install WeasyPrint \
&& deactivate \
# TODO: no clue why this is needed here again
# this is needed here again to install any conditional dependencies
&& cd $GALAXY_ROOT_DIR && ./scripts/common_startup.sh \
&& cd config && find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + \
&& find . -name '.cache' -type d -prune -exec rm -rf '{}' + \
Expand All @@ -268,6 +225,7 @@ RUN mkdir -p /shed_tools \
&& find $GALAXY_VIRTUAL_ENV -name '*.pyc' -delete | true \
&& rm -rf /tmp/* /root/.cache/ /var/cache/* $GALAXY_ROOT_DIR/client/node_modules/ $GALAXY_VIRTUAL_ENV/src/ /home/galaxy/.cache/ /home/galaxy/.npm


# Include all needed scripts from the host
ADD ./setup_postgresql.py /usr/local/bin/setup_postgresql.py

Expand Down Expand Up @@ -372,7 +330,7 @@ EXPOSE 9002
VOLUME ["/export/", "/data/", "/var/lib/docker"]

ADD startup.sh /usr/bin/startup
ENV SUPERVISOR_POSTGRES_AUTOSTART=True \
ENV SUPERVISOR_POSTGRES_AUTOSTART=False \
SUPERVISOR_MANAGE_POSTGRES=True \
SUPERVISOR_MANAGE_CRON=True \
SUPERVISOR_MANAGE_PROFTP=True \
Expand All @@ -386,7 +344,6 @@ ENV SUPERVISOR_POSTGRES_AUTOSTART=True \
GRAVITY_MANAGE_TUSD=True \
GRAVITY_MANAGE_REPORTS=True \
HOST_DOCKER_LEGACY= \
GALAXY_EXTRAS_CONFIG_POSTGRES=True \
STARTUP_EXPORT_USER_FILES=True

ENTRYPOINT ["/sbin/tini", "--"]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
- hosts: localhost
connection: local
remote_user: root
vars_files:
- vars/main.yml
tasks:
- name: Install CernVM apt key
apt_key:
Expand All @@ -20,7 +18,7 @@
- name: Install CernVM-FS client (apt)
apt:
name: ['cvmfs', 'cvmfs-config']
state: present
state: "{{ galaxy_apt_package_state }}"
update_cache: yes

- name: Make CernVM-FS key directories
Expand Down
15 changes: 15 additions & 0 deletions galaxy/ansible/flower.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
- hosts: localhost
connection: local
remote_user: root
vars:
flower_python_package_version: 1.2.0
flower_custom_logging: false
flower_conf_dir: "{{ flower_conf_path | dirname }}"
flower_ui_users: []
roles:
- role: galaxy-flower
tasks:
- name: Add url prefix to flower config
lineinfile:
path: "{{ flower_conf_path }}"
line: 'url_prefix = "{{ flower_url_prefix }}"'
23 changes: 0 additions & 23 deletions galaxy/ansible/flower_provision.yml

This file was deleted.

32 changes: 32 additions & 0 deletions galaxy/ansible/galaxy_extra_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
- hosts: localhost
connection: local
remote_user: root
tasks:
- name: "Install most of the conditional dependencies"
# https://github.com/galaxyproject/galaxy/blob/dev/lib/galaxy/dependencies/conditional-requirements.txt
pip:
name: "{{item}}"
virtualenv: "{{ galaxy_venv_dir }}"
virtualenv_command: "{{ pip_virtualenv_command | default( 'virtualenv' ) }}"
extra_args: --index-url https://wheels.galaxyproject.org/simple --extra-index-url https://pypi.python.org/simple
become: True
become_user: "{{ galaxy_user_name }}"
with_items:
- "psycopg2-binary==2.9.9"
- "mysqlclient"
- "fluent-logger"
- "sentry-sdk[fastapi]"
- "pbs_python"
- "drmaa"
- "statsd"
- "azure-storage-blob==12.19.1"
- "python-irodsclient==2.0.0"
- "python-ldap==3.4.0"
- "ldap3==2.9.1"
- "python-pam"
- "galaxycloudrunner"
- "pkce"
- "total-perspective-vortex>=2.3.2,<3"
- "pykube-ng==21.3.0"
- "kamaki"
- "boto3"
10 changes: 10 additions & 0 deletions galaxy/ansible/galaxy_job_conf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- hosts: localhost
connection: local
remote_user: root
tasks:
- name: "Install Galaxy job conf"
template: src=job_conf.xml.j2 dest={{ galaxy_job_conf_path }} owner={{ galaxy_user_name }} group={{ galaxy_user_name }}

- name: "Install Galaxy container resolution configuration"
template: src=container_resolvers_conf.yml.j2 dest={{ galaxy_container_resolvers_conf_path }} owner={{ galaxy_user_name }} group={{ galaxy_user_name }}
when: galaxy_container_resolution | bool
6 changes: 6 additions & 0 deletions galaxy/ansible/galaxy_job_metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- hosts: localhost
connection: local
remote_user: root
tasks:
- name: "Setup job metrics"
template: src=job_metrics_conf.yml.j2 dest={{ galaxy_job_metrics_conf_path }} owner={{ galaxy_user_name }} group={{ galaxy_user_name }}
24 changes: 24 additions & 0 deletions galaxy/ansible/galaxy_root.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- hosts: localhost
connection: local
remote_user: root
tasks:
- name: "Run common_startup.sh to build the galaxy client"
shell: scripts/common_startup.sh
environment:
GALAXY_VIRTUAL_ENV: "{{ galaxy_venv_dir }}"
args:
chdir: "{{ galaxy_server_dir }}"
become: True
become_user: "{{ galaxy_user_name }}"

- name: "Install watchdog for galaxy"
pip:
name: "watchdog"
virtualenv: "{{ galaxy_venv_dir }}"
virtualenv_command: "{{ pip_virtualenv_command | default( 'virtualenv' ) }}"
extra_args: --index-url https://wheels.galaxyproject.org/simple --extra-index-url https://pypi.python.org/simple
become: True
become_user: "{{ galaxy_user_name }}"

- name: Ensure galaxy_logs dir exists
file: path={{ galaxy_logs_dir }} state=directory owner={{ galaxy_user_name }} group={{ galaxy_user_name }}
24 changes: 24 additions & 0 deletions galaxy/ansible/galaxy_scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
- hosts: localhost
connection: local
remote_user: root
tasks:
- name: "Install galaxy user creation script."
template: src=create_galaxy_user.py.j2 dest=/usr/local/bin/create_galaxy_user.py mode=a+x

- name: "Install galaxy check database script."
template: src=check_database.py.j2 dest=/usr/local/bin/check_database.py mode=a+x

- name: "Install export user files script."
template: src=export_user_files.py.j2 dest=/usr/local/bin/export_user_files.py mode=a+x

- name: "Install add_tool_shed script."
template: src=add_tool_shed.py.j2 dest=/usr/local/bin/add-tool-shed mode=a+x

- name: "Install startup lite script."
template: src=startup_lite.sh.j2 dest=/usr/bin/startup_lite mode=a+x

- name: "Install cgroupfs_mount.sh for startup script."
template: src=cgroupfs_mount.sh.j2 dest=/root/cgroupfs_mount.sh mode=a+x

- name: "Install update_yaml_value script."
template: src=update_yaml_value.py.j2 dest=/usr/local/bin/update_yaml_value mode=a+x
28 changes: 28 additions & 0 deletions galaxy/ansible/gravity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
- hosts: localhost
connection: local
remote_user: root
tasks:
- name: "Install gravity for galaxy"
pip:
name: gravity
version: 1.0.6
virtualenv: "{{ galaxy_venv_dir }}"
virtualenv_command: "{{ pip_virtualenv_command | default( 'virtualenv' ) }}"
extra_args: "--index-url https://wheels.galaxyproject.org/ --extra-index-url https://pypi.python.org/simple"
become: True
become_user: "{{ galaxy_user_name }}"

- name: Deploy galaxyctl wrapper script
copy:
content: |
#!/usr/bin/env sh
export GRAVITY_CONFIG_FILE={{ gravity_config_file }}
export GRAVITY_STATE_DIR={{ gravity_state_dir }}
exec sudo -E -u $GALAXY_USER {{ galaxy_venv_dir }}/bin/galaxyctl "$@"
dest: "/usr/local/bin/galaxyctl"
mode: "0755"
become: True
become_user: root

- name: "Install Gravity conf"
template: src=gravity.yml.j2 dest={{ gravity_config_file }} owner={{ galaxy_user_name }} group={{ galaxy_user_name }}
Loading

0 comments on commit 298ee36

Please sign in to comment.