Skip to content

Commit

Permalink
Refacotring the ansible-playbooks in order to use Python venv
Browse files Browse the repository at this point in the history
  • Loading branch information
ooemperor committed Apr 27, 2024
1 parent ca51569 commit dddc925
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
14 changes: 9 additions & 5 deletions deployment/ansible/playbooks/codeGrader_install_backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@
- libpq-dev
- pip
- git
- python3.11-venv
state: present
- name: Recursively remove directory for python venvs

- name: Recursively remove directory /opt/CodeGrader_venv
ansible.builtin.file:
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
path: /opt/CodeGrader_venv
state: absent
force: true

- name: Create python venv for CodeGrader
shell: python3 -m venv /opt/CodeGrader_venv

- name: Recursively remove directory /opt/CodeGrader
ansible.builtin.file:
Expand All @@ -57,13 +60,14 @@
- name: Install CodeGrader Backend requirements
ansible.builtin.pip:
requirements: /opt/CodeGrader/codeGrader/backend/requirements.txt
virtualenv: /opt/CodeGrader_venv/

- name: Rename the setup Script
shell: mv setup_backend.py setup.py
args:
chdir: /opt/CodeGrader

- name: Install the CodeGrader Application Backend
shell: pip install .
shell: /opt/CodeGrader_venv/bin/python3.11 -m pip install .
args:
chdir: /opt/CodeGrader
14 changes: 9 additions & 5 deletions deployment/ansible/playbooks/codeGrader_install_frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@
- libpq-dev
- pip
- git
- python3.11-venv
state: present
- name: Recursively remove directory for python venvs

- name: Recursively remove directory /opt/CodeGrader_venv
ansible.builtin.file:
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
path: /opt/CodeGrader_venv
state: absent
force: true

- name: Create python venv for CodeGrader
shell: python3 -m venv /opt/CodeGrader_venv

- name: Recursively remove directory /opt/CodeGrader
ansible.builtin.file:
Expand All @@ -62,13 +65,14 @@
- name: Install CodeGrader Frontend requirements
ansible.builtin.pip:
requirements: /opt/CodeGrader/codeGrader/frontend/requirements.txt
virtualenv: /opt/CodeGrader_venv/

- name: Rename the setup Script
shell: mv setup_frontend.py setup.py
args:
chdir: /opt/CodeGrader

- name: Install the CodeGrader Application Frontend
shell: pip install .
shell: /opt/CodeGrader_venv/bin/python3.11 -m pip install .
args:
chdir: /opt/CodeGrader
14 changes: 9 additions & 5 deletions deployment/ansible/playbooks/codeGrader_install_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@
- pip
- git
state: present
- name: Recursively remove directory for python venvs

- name: Recursively remove directory /opt/CodeGrader_venv
ansible.builtin.file:
path: /usr/lib/python3.11/EXTERNALLY-MANAGED
path: /opt/CodeGrader_venv
state: absent
force: true

- name: Create python venv for CodeGrader
shell: python3 -m venv /opt/CodeGrader_venv

- name: Recursively remove directory /opt/CodeGrader
ansible.builtin.file:
Expand All @@ -57,17 +59,19 @@
- name: Install CodeGrader Backend requirements
ansible.builtin.pip:
requirements: /opt/CodeGrader/codeGrader/backend/requirements.txt
virtualenv: /opt/CodeGrader_venv/

- name: Install CodeGrader Frontend requirements
ansible.builtin.pip:
requirements: /opt/CodeGrader/codeGrader/frontend/requirements.txt
virtualenv: /opt/CodeGrader_venv/

- name: Rename the setup Script
shell: mv setup_full.py setup.py
args:
chdir: /opt/CodeGrader

- name: Install the CodeGrader Application Frontend and Backend
shell: pip install .
shell: /opt/CodeGrader_venv/bin/python3.11 -m pip install .
args:
chdir: /opt/CodeGrader

0 comments on commit dddc925

Please sign in to comment.