Skip to content
/ grader Public
forked from ton212/grader

Multilanguage online judge with Silex & AngularJS

Notifications You must be signed in to change notification settings

mimiiiz/grader

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grader (a.k.a. Online Judge)

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.

Installation

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.

  1. Setup nginx repository: http://wiki.nginx.org/Install
  2. Install dependencies:
sudo apt-get install php5-cli php5-mysqlnd php5-fpm nginx beanstalkd supervisor
  1. Install composer:
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
  1. Install MariaDB: https://downloads.mariadb.org/mariadb/repositories/
  2. Install Docker: http://docs.docker.io/en/latest/installation/ubuntulinux/#ubuntu-raring
  3. 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 ..
  1. (optionally) Cleanup:
sudo docker rm `sudo docker ps -aq`
  1. Setup nginx:
sudo cp vagrant/nginx.conf /etc/nginx/sites-available/default
sudo service nginx restart
  1. Config grader by editing following files
  1. Config grader client by editing following files
  • Copy /var/grader/config.default.php to /var/grader/config.php and set the setKey argument to the same as key in opauth.php, set setGuzzle argument to URL of grader web (try curl-ing the URL first)
  1. Setup beanstalkd by editing /etc/default/beanstalkd. Enable service starting, optionally add persistent and run sudo service beanstalkd start to apply.
  2. (optionally) Enable supervisord web interface: http://supervisord.org/configuration.html#inet-http-server-section-settings
  3. Config supervisord:
sudo cp vagrant/supervisord.conf /etc/supervisor/conf.d/grader.conf
sudo service supervisor restart
  1. Create database
cd /var/www/server/
php schema.php
  1. Grader is now installed

ACL

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: put tests here.
  • object_id: 0 for every object, or test id.
  • acl: One of view (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: view
  • user_id = your user id: create add edit (view is inherited from user_id 0)

License

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.

About

Multilanguage online judge with Silex & AngularJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 51.0%
  • JavaScript 25.8%
  • CSS 17.0%
  • Puppet 4.1%
  • Java 1.1%
  • Ruby 0.6%
  • Other 0.4%