Usually I would name my project something with name from anime character, but I feel I want to keep the name I chosen for future project, so it is just "grader" for the time.
My grader currently supports PHP, Python 2/3 (both!), Ruby, C, C++, C# and Java. Problem input generator can be written in Python 2, PHP and Java.
The grading backend use a seperate PHP process and use Docker to isolate unsafe code.
I tried vagrant and puppet which lives in vagrant directory. It doesn't install MySQL properly and I stopped working on it and you if you fix it, please make it install supervisord and configuration.
Only tested (and should only work on) Ubuntu 13.04. (12.04 may work, I think)
Manual installation: (the only way for now) Note that this should be run only on empty machine.
- Setup nginx repository: http://wiki.nginx.org/Install
- Install dependencies:
sudo apt-get install php5-cli php5-mysqlnd php5-fpm nginx beanstalkd supervisor- Install composer:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer- Install MariaDB: https://downloads.mariadb.org/mariadb/repositories/
- Install Docker: http://docs.docker.io/en/latest/installation/ubuntulinux/#ubuntu-raring
- Move files into target:
sudo mkdir /var/www/ /var/grader/
sudo chown www-data:www-data /var/www
sudo cp -r assets server templates index.html /var/www/
sudo cp -r vm/graderclient/ /var/grader/(From this point it is assumed that you run all commands in the project's root directory) 7. Build Docker images:
cd vm
sudo ./build-raring.sh
sudo rm -r raring
sudo docker build -t=grader -rm=true .
cd ..- (optionally) Cleanup:
sudo docker rm `sudo docker ps -aq`- Setup nginx:
sudo cp vagrant/nginx.conf /etc/nginx/sites-available/default
sudo service nginx restart- Config grader by editing following files
server/database.php- Copy
server/opauth.sample.phptoserver/opauth.phpand editsecurity_saltandkeyto two random strings, fill keys for social networks. (Register new app on Facebook, Register new app for Google+, Register new app on Twitter)
- Config grader client by editing following files
- Copy
/var/grader/config.default.phpto/var/grader/config.phpand set thesetKeyargument to the same askeyinopauth.php, setsetGuzzleargument to URL of grader web (trycurl-ing the URL first)
- Setup beanstalkd by editing
/etc/default/beanstalkd. Enable service starting, optionally add persistent and runsudo service beanstalkd startto apply. - (optionally) Enable supervisord web interface: http://supervisord.org/configuration.html#inet-http-server-section-settings
- Config supervisord:
sudo cp vagrant/supervisord.conf /etc/supervisor/conf.d/grader.conf
sudo service supervisor restart- Create database
cd /var/www/server/
php schema.php- Grader is now installed
Grader use a whitelist-based ACL. The default is to deny all access so you probably need to open it up first. To do this, insert row into the acls database:
user_id: NULL for everyone (including guests)object: puttestshere.object_id: 0 for every object, or test id.acl: One ofview(see and submit to test),create(create new tests),add(create new problems),edit(view submissions code made by other users, view levenshtein distance between submissions, submit even the test is readonly),delete(doesn't do anything yet)
Note that if even if you allow guests to view tests, they still can't submit.
When you create a test, an ACL to view,edit,delete is created for the creator.
Usually when setting up grader, you should add the following ACL:
user_id= 0:viewuser_id= your user id:createaddedit(viewis inherited fromuser_id0)
I apologies for proper licensing in every files. Anyway, you can use this under AGPLv3 or later version.
Of course, your problem statements and input/output code does not need to follow the license's requirement.