Skip to content

Latest commit

 

History

History
179 lines (136 loc) · 4.98 KB

Readme.md

File metadata and controls

179 lines (136 loc) · 4.98 KB

V2 vmchecker

Rewrite of the original vmchecker. This repo is for the student portal. It runs at https://v2.vmchecker.grid.pub.ro/.

CI Lint codecov

Development

Try the Vagrant method first. It requires VirtualBox and Vagrant to be installed.

Vagrant

If anything goes wrong, check out bugs labelled "build", and please report any bugs you encounter, that are not already documented.

Clone the repo and create an .env file inside:

MINIO_ADDRESS=10.66.60.1:9000
MINIO_ACCESS_KEY=1234
MINIO_SECRET_KEY=123456789
VMCK_API_URL=http://10.66.60.1:10000/v0/
DEBUG=True
PROFILE=True
HOSTNAME=*
ACS_INTERFACE_ADDRESS=http://10.66.60.1:8000/
MANAGER_TAG=0.4.1
POSTGRES_USER=user
POSTGRES_PASSWORD=1234
POSTGRES_DB=interface
POSTGRES_ADDRESS=127.0.0.1
POSTGRES_PORT=5432

Now run:

vagrant up

If all goes well, it should print ✔ acs-interface installed successfully. Next, log you into the Vagrant virtual machine, and start Django:

vagrant ssh
cd /vagrant
pipenv run runserver

Django's port is forwarded to http://localhost:8000. A default admin user is created with password admin, along with some sample content.

Some more forwarded ports:

Install locally

Install dependencies:

sudo apt-get update
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev docker
sudo pip3 install pipenv
pipenv install

You need a running vmck instance. Also a Nomad-Consul-Vault cluster is required - [liquid/cluster][] - to run vmck.

Run:

pipenv run ./examples/minio.sh
pipenv run ./examples/postgres.sh
pipenv run ./manage.py migrate
pipenv run ./manage.py loaddata ci/fixtures.json
pipenv run ./manage.py runserver

Now the vmck/acs-interface is available at http://localhost:8000 and the minio blob storage server at http://localhost:9000. You can log in with the user admin, password admin. There is a test course and assignment created from fixtures.

To stop, hit CTRL-C in the terminal where you started runserver, and docker stop storage to stop the minio server.

Deploy on cluster

The deployment is orchestrated at https://github.com/vmck/acs-deploy - it's the living documentation and single instance of how to run this thing in production.

Add new homework

  1. Set up the assignment files in a GitHub repository. You can share a repository for a whole course and have each assignment in a subfolder.

    The specified repository should contain the tests and the checker script in a subfolder for the assignment.

    It should also contain a checker.sh file (it does some unzip work) and a config.ini file (has specified the virtual machine where the homework would be run).

    See pc-00 for an example.

  2. You need to have access to the admin page for V2 vmchecker.

  3. Click on adding a new Assignment

  • Select the course (mandatory field);
  • Add a code for the homework. It should respect a pattern, like course_initials-homework_number; example pc-01;
  • Give a name to the homework;
  • Set a maximum score (the minimum score is 0, if the total score is negative it will be clipped);
  • Add the soft and hard deadlines (mandatory fields);
  • Add a repo URL - when evaluating a homework the repo URL and the below specified branch will be used for testing;
  • Set repo_branch, or leave blank to use master
  • Set repo_path to a folder of the repository that contains the assignment files

Running tests

Unit + Integration tests

For running the tests you need to:

  1. Have the vagrant machine up
  2. Access vagrant using:
vagrant ssh
  1. Go to /vagrant
  2. Run:
pipenv run pytest --liveserver 10.66.60.1:8000 testsuite

Stress Tests

We are using locust.io for running the stress tests. You need to install it:

pip install locust

For running the tests you need to do the following:

If you want to test locally:

  1. Have the vagrant machine up
  2. Access vagrant using:
vagrant ssh
  1. Start the server using:
pipenv run ./manage.py runserver 10.66.60.1:8000
  1. Run (not in the vagrant ssh session):
locust -f testsuite/stress/locust.py
  1. Open http://localhost:8089/ and specify the wanted parameters and run it!