diff --git a/README.md b/README.md index 117bf11..ffce92c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ paprikant.beacon ```yaml script_user: beacon-import -script_dir: /opt/beacon-import/ +script_dir: /opt/beacon-import/ galaxy_api_key: 123213hiufho12h31h321 galaxy_api_url: usegalaxy.eu diff --git a/files/beacon-import.py b/files/beacon-import.py index 0ba3bb3..350d170 100755 --- a/files/beacon-import.py +++ b/files/beacon-import.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python3.9 +#!/usr/bin/env python3 """Pushes genomic variant information from a galaxy to a beacon instance. Usage: diff --git a/files/requirements.txt b/files/requirements.txt index 4addbf0..cbf1cf1 100644 --- a/files/requirements.txt +++ b/files/requirements.txt @@ -1,11 +1,11 @@ argparse asyncio -asyncpg datetime dataclasses -numpy typing -git+https://github.com/CSCfi/beacon-python +asyncpg>=0.28.0 +numpy bioblend -cyvcf2 - +cyvcf2>=0.32.1 +aiohttp>=3.8.6 +uvloop>=0.17.0 diff --git a/tasks/main.yml b/tasks/main.yml index 1949f51..37b40ce 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,23 +1,22 @@ ---- # tasks file for beacon # - - name: Install python ansible.builtin.package: name: "{{ item }}" state: present loop: - - python39 + - python3 - python3-pip - python3-setuptools - + - python3-devel + - gcc - name: Install cronie ansible.builtin.package: name: cronie state: present -- name: Ensure script user exists +- name: Ensure script user exists ansible.builtin.user: name: "{{ script_user }}" create_home: true @@ -40,24 +39,42 @@ ansible.builtin.package: name: git state: present - # this is no mistake + +- name: Create virtualenv and bootstrap pip tooling + ansible.builtin.pip: + name: + - pip + - setuptools + - wheel + state: latest + virtualenv: "{{ script_dir }}/venv" + virtualenv_command: /usr/bin/python3 -m venv + +- name: Install beacon-python without deps + ansible.builtin.pip: + name: "git+https://github.com/CSCfi/beacon-python" + extra_args: "--no-deps" + virtualenv: "{{ script_dir }}/venv" + virtualenv_command: /usr/bin/python3 -m venv + - name: Install python deps ansible.builtin.pip: requirements: "{{ script_dir }}/requirements.txt" - executable: /usr/bin/pip3.9 + virtualenv: "{{ script_dir }}/venv" + virtualenv_command: /usr/bin/python3 -m venv -- name: Create a cronjob for daily executions +- name: Create a cronjob for daily executions ansible.builtin.cron: user: "{{ script_user }}" name: "check dirs" minute: "0" hour: "5" - job: "{{ script_dir }}/beacon-import.py -k {{ galaxy_api_key }} -u {{ galaxy_api_url }} rebuild -H {{ beacon_db_host }} -P {{ beacon_db_port }} -U {{beacon_db_user }} -W {{ beacon_db_password }} -N {{ beacon_db_name }} || touch /tmp/job_error" + job: "{{ script_dir }}/venv/bin/python {{ script_dir }}/beacon-import.py -k {{ galaxy_api_key }} -u {{ galaxy_api_url }} rebuild -H {{ beacon_db_host }} -P {{ beacon_db_port }} -U {{ beacon_db_user }} -W {{ beacon_db_password }} -N {{ beacon_db_name }} || touch /tmp/job_error" - name: Make sure crond is started and enabled ansible.builtin.systemd: - name: crond + name: crond state: started enabled: yes