Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Note that you will need to set up the appropriate proxying *outside* the Web Lab

### Using Vagrant

Version 2.2 of Vagrant is required for this. We recommend using the VirtualBox provider with it.
Version 2.4 of Vagrant is required for this. We recommend using the VirtualBox provider with it.

You may need to edit some options in the `Vagrantfile` depending on how you have configured your local variables.
For instance, remove the `raw_arguments` if you're not encrypting any secrets.
Expand Down
18 changes: 10 additions & 8 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,28 @@ Vagrant.configure("2") do |config|
# Needs plugin vagrant-disksize: `vagrant plugin install vagrant-disksize`
config.disksize.size = '40GB'

config.vm.network :forwarded_port, guest: 80, host: 8088 # Django front-end
config.vm.network :forwarded_port, guest: 8080, host: 8089 # Expt runner
# NOTE: This will enable public access to the opened ports.
config.vm.network "forwarded_port", guest: 80, host: 8088 # Django front-end
config.vm.network "forwarded_port", guest: 8080, host: 8089 # Experiment runner

# NOTE: This restricts access to the opened ports via 127.0.0.1 only.
# config.vm.network "forwarded_port", guest: 80, host: 8088, host_ip: "127.0.0.1"
# config.vm.network "forwarded_port", guest: 8080, host: 8089, host_ip: "127.0.0.1"

# This needs to look real enough for git to set a default identity
config.vm.hostname = "weblab.local"

# Provider-specific configuration for VirtualBox
config.vm.provider "virtualbox" do |vb|
vb.name = "WebLab18"
vb.memory = "4096"
vb.cpus = "4"
end

# Install the Web Lab using Ansible
config.vm.provision "ansible_local" do |ansible|
# Install a specific Ansible version with pip
ansible.compatibility_mode = "2.0"
ansible.install = true
ansible.install_mode = "pip"
ansible.pip_install_cmd = "sudo apt-get install -y python-pip"
# The line above is because otherwise Vagrant tries to use pip3 and breaks because OS is Python 2
ansible.version = "2.8.0"

ansible.playbook = "site.yml"
ansible.inventory_path = "inventories/dev"
Expand All @@ -43,4 +46,3 @@ Vagrant.configure("2") do |config|
ansible.verbose = true
end
end

3 changes: 3 additions & 0 deletions patches/fc/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "numpy>=1,<2", "cython>=0,<3"]
build-backend = "setuptools.build_meta"
4 changes: 2 additions & 2 deletions roles/add_user/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Create a new user account, and record meta information

- name: Create user's group
become: yes
become: true
group:
name: '{{ user_group }}'
state: present

- name: Create user
become: yes
become: true
user:
name: '{{ user_name }}'
group: '{{ user_group }}'
Expand Down
2 changes: 1 addition & 1 deletion roles/celery/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- role: prep_venv
user: '{{ celery_user }}'
virtualenv: '{{ celery_virtualenv }}'
virtualenv_python: python3.7
virtualenv_python: python3.6
# Then we need the FC backend available for the celery user,
# since our tasks import modules from it
- role: fc-backend
Expand Down
20 changes: 10 additions & 10 deletions roles/celery/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
- '{{ celery_dir }}'
- '{{ celery_state_dir }}'
- '{{ celery_log_dir }}'
become: yes
become: true

- name: Celery | List celery state
become: yes
become: true
find:
paths: '{{ celery_state_dir }}'
patterns: '*'
register: celery_state_files

- name: Celery | Checkout repository
become: yes
become: true
become_user: '{{ celery_user }}'
git:
clone: yes
clone: true
dest: '{{ celery_checkout }}'
repo: '{{ celery_git_repo }}'
version: '{{ celery_git_branch }}'
update: yes
force: yes
update: true
force: true
notify:
- clean celery state
- restart experiment runner

- name: Celery | Install python packages
become: yes
become: true
become_user: '{{ celery_user }}'
pip:
requirements: '{{ celery_checkout }}/requirements/base.txt'
Expand All @@ -46,7 +46,7 @@
- restart experiment runner

- name: Celery | FCWS configuration
become: yes # Because the celery_user may not be in the nginx_group
become: true # Because the celery_user may not be in the nginx_group
template:
src: '{{ item }}.j2'
dest: '{{ celery_checkout }}/fcws/{{ item }}'
Expand All @@ -59,7 +59,7 @@
- restart experiment runner

- name: Install Celery service
become: yes
become: true
block:
- name: Celery | Systemd service definition
template:
Expand All @@ -83,5 +83,5 @@
# TODO: Make this an always-run notify of 'start celery' handler?
service:
name: '{{ celery_service_name }}'
enabled: yes
enabled: true
state: started
8 changes: 7 additions & 1 deletion roles/core/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Setup common to all hosts

- name: Install ufw
apt:
name: ["ufw"]
state: present
become: true

- name: Open SSH port in firewall
become: yes
become: true
ufw:
name: OpenSSH
rule: allow
Expand Down
6 changes: 3 additions & 3 deletions roles/django/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ dependencies:
- role: add_user
user_name: "{{ django_user }}"
user_comment: Web Lab Django user account
- { role: geerlingguy.postgresql, become: yes }
- { role: geerlingguy.postgresql, become: true }

# And we need a virtualenv
- role: prep_venv
user: '{{ django_user }}'
virtualenv: '{{ django_virtualenv }}'
virtualenv_command: pyvenv
virtualenv_python: python3.6

# Ensure node is new enough (and installed)
- { role: geerlingguy.nodejs, become: yes }
- { role: geerlingguy.nodejs, become: true }
37 changes: 21 additions & 16 deletions roles/django/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- name: Install postfix for Django email sending if needed
import_role:
name: postfix
become: yes
become: true
when: email_smtp_host == 'localhost'

- name: Ensure the Django dirs exist with correct permissions
Expand All @@ -17,10 +17,10 @@
- '{{ django_data_path }}'
- '{{ django_experiments_path }}'
- '{{ django_datasets_path }}'
become: yes
become: true

- name: Raise limit on max open files for Django
become: yes
become: true
template:
src: ulimit.j2
dest: /etc/security/limits.d/weblab.conf
Expand All @@ -29,27 +29,32 @@
# Install Django & dependencies

- name: Install Django
become: yes
become: true
become_user: "{{ django_user }}"
become_method: sudo
block:
- name: Django | Checkout repository
git:
clone: yes
clone: true
dest: "{{ django_checkout }}"
repo: "{{ django_git_repo }}"
version: "{{ django_git_branch }}"
update: yes
force: yes
update: true
force: true
notify:
- restart uwsgi

- name: Django | Build psycopg2 from source
- name: Django | fix git-python dependency
lineinfile:
path: '{{ django_checkout }}/requirements/base.txt'
regexp: '^gitpython=='
line: gitpython==3.1.18

- name: Django | Install psycopg2
pip:
name: psycopg2
version: 2.7.7
version: 2.8.6
state: present
extra_args: '--no-binary psycopg2'
virtualenv: '{{ django_virtualenv }}'
virtualenv_command: pyvenv
become_flags: "-H"
Expand Down Expand Up @@ -122,29 +127,29 @@
command: npm install
args:
chdir: "{{ django_static_path }}"
become: yes
become: true
become_user: "{{ django_user }}"

- block:
- name: gulp | Build static assets
command: ./node_modules/gulp/bin/gulp.js
args:
chdir: "{{ django_static_path }}"
become: yes
become: true
become_user: "{{ django_user }}"
rescue:
# Errors are often due to a node upgrade
- name: gulp | Rebuild on npm/node version change
command: npm rebuild
args:
chdir: "{{ django_static_path }}"
become: yes
become: true
become_user: "{{ django_user }}"
- name: gulp | Rebuild static assets
command: ./node_modules/gulp/bin/gulp.js
args:
chdir: "{{ django_static_path }}"
become: yes
become: true
become_user: "{{ django_user }}"

- name: Django | Collect static files
Expand All @@ -153,7 +158,7 @@
app_path: "{{ django_app_path }}"
settings: config.settings.deployed
virtualenv: '{{ django_virtualenv }}'
become: yes
become: true
become_user: "{{ django_user }}"

- name: Django | Copy ontology definition
Expand All @@ -174,4 +179,4 @@
weekday: "*"
job: systemctl restart uwsgi
state: present
become: yes
become: true
2 changes: 1 addition & 1 deletion roles/fc-backend/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ fc_user: celery
legacy_fc_virtualenv: "{{ user_meta[fc_user].home }}/python2_venv"

# Chaste backend configuration
chaste_repo: https://chaste.cs.ox.ac.uk/git/chaste.git
chaste_repo: https://github.com/Chaste/Chaste.git
fc_repo: https://chaste.cs.ox.ac.uk/svn/chaste/projects/FunctionalCuration
chaste_root: "{{ user_meta[fc_user].home }}/eclipse/workspace/Chaste"
fc_project_name: FunctionalCuration
Expand Down
6 changes: 3 additions & 3 deletions roles/fc-backend/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ dependencies:
user: '{{ fc_user }}'
virtualenv: '{{ legacy_fc_virtualenv }}'
virtualenv_python: python2
virtualenv_site_packages: yes
virtualenv_site_packages: true
- role: prep_venv
user: '{{ fc_user }}'
virtualenv: '{{ weblab_fc_virtualenv }}'
virtualenv_python: python3.7
virtualenv_site_packages: no
virtualenv_python: python3.6
virtualenv_site_packages: false
Loading