Code Monkey home page Code Monkey logo

oioioi's Introduction

OIOIOI

https://hudson.sio2project.mimuw.edu.pl/job/oioioi-github-unittests/badge/icon

SIO2 is a free platform for carrying out algorithmic contests and OIOIOI is its main component --- the web interface.

Installation

It should be easier to begin with a separate folder at first:

mkdir sio2
cd sio2

and to install OIOIOI inside a virtualenv:

virtualenv venv
. venv/bin/activate

Then OIOIOI and its dependencies can be installed by simply running:

pip install -e git://github.com/sio2project/oioioi.git#egg=oioioi

This will also store the source code in venv/src. There is no official release yet, so a simple pip install oioioi wouldn't work.

OIOIOI is a set of Django Applications, so you need to create a folder with Django settings and other deployment configuration:

oioioi-create-config deployment
cd deployment

The created deployment directory looks like a new Django project, but already configured to serve the OIOIOI portal. You need to at least set the database configuration in settings.py and initialize it:

./manage.py syncdb
./manage.py migrate

Simple configuration

In the simple configuration, OIOIOI will use the system-installed compilers, and will not use the safe execution environment. User's programs will be run with the normal user privileges. This is not a safe configuration and the judging will run quite slowly. It is to easily make OIOIOI up and running for testing purposes.

Ensure that required dependencies are installed:

  • gcc/g++ (Ubuntu package: build-essential)
  • fpc (Ubuntu package: fp-compiler)
  • latex with support for Polish (Ubuntu packages: texlive-latex, texlive-lang-polish)
  • lessc (LESS compiler, minimum version 1.3.0; on Ubuntu install npm and then run sudo npm install --global less)

and in one terminal run the Django web server:

./manage.py runserver 0.0.0.0:8000

and in the other the evaluation daemons:

./manage.py supervisor

The supervisor process monitors all processes needed by OIOIOI, except the web server. It has many nice features.

Finally, if you didn't create an administrator account when running syncdb, you can do it now:

./manage.py createsuperuser

Now you're ready to access the site at http://localhost:8000.

Production configuration

  1. Begin with the simple configuration described above.

  2. Make sure you are in the deployment folder and the virtualenv is activated.

  3. Install RabbitMQ. We tested version 2.8.6 from RabbitMQ Debian/Ubuntu Repos. Anything newer should work as well.

  4. Uncomment and set BROKER_URL in settings.py to point to the configured RabbitMQ vhost. The default setting corresponds to the default RabbitMQ installation.

  5. Download sandboxes:

    ./manage.py download_sandboxes
    
  6. Disable system compilers and unsafe code execution by commenting out USE_UNSAFE_EXEC = True and USE_LOCAL_COMPILERS = True in settings.py.

  7. (optionally) Disable starting the judging process on the server, especially if you want to configure judging machines (see below) for judging, what is strongly recommended. Comment out the RUN_LOCAL_WORKERS = True setting.

  8. (optionally) Enable Filetracker server by uncommenting corresponding lines in settings.py and restart the daemons.

  9. Configure Apache with mod_wsgi. An example configuration is automatically created as apache-site.conf. Have a look there. Once this is done, you do not need to run manage.py runserver.

  10. Comment out DEBUG = True in settings.py. This is crucial for security and efficiency.

  11. Set admin email in settings. Error reports and teacher account requests will be sent there.

  12. You probably want to run manage.py supervisor automatically when the system starts. We do not have a ready-made solution for this yet. Sorry!

Setting up judging machines

  1. Create a new user account for the judging processes and switch to it.

  2. Set up virtualenv:

    virtualenv venv
    . venv/bin/activate
    
  3. Install the sioworkers package:

    pip install sioworkers
    
  4. Start the worker process:

    sio-celery-worker BROKER_URL
    

    The passed argument must point to the RabbitMQ server configured on the server machine.

  5. That's all. You probably want to have the worker started automatically when system starts. We do not have a ready-made solution for this yet. Sorry!

The worker assumes that the Filetracker server is running on the same server as RabbitMQ, on the default port 9999. If this is not the case, you should pass the Filetracker server URL in the FILETRACKER_URL environment variable.

Final notes

It is strongly recommended to install the librabbitmq Python module (on the server and the worker machines). We observed some not dispatched evaluation requests when running celery with its default AMQP binding library:

pip install librabbitmq

Celery will pick up the new library automatically, once you restart the daemons.

Installing on 64-bit machines

The sandboxes provided by the SIO2 Project contain 32-bit binaries. Therefore it is recommended that OIOIOI is installed on a 32-bit Linux system. Otherwise, required libraries may be missing. Here we list some of them, which we found needed when installing OIOIOI in a pristine Ubuntu Server 12.04 LTS (Precise Pangolin):

  • libz (Ubuntu package: zlib1g:i386)

Installing on Ubuntu

Ubuntu has one additional security feature which interferes with the instruction counting sandbox used by default by OIOIOI. It must be disabled by adding the following line to /etc/sysctl.conf:

kernel.yama.ptrace_scope = 0

and rebooting the machine or reloading this file with sudo sysctl -p.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.