This is a very normal Online Judge.
This is what I did on my machine. Adapt if necessary and use your wisdom. I'm using Arch Linux, with kernel linux-userns from AUR.
- Setup Database
- Install and setup PostgreSQL (postgresql)
- Create postgresql user toyojweb and toyojjudge
- Create database toyoj from toyoj.sql
- Allow user http to login as toyojweb
- If you prefer password, modify the dsn in step 2-6
- Allow user toyojjudge to login as toyojjudge
- If you prefer password, modify the dsn in step 3-8
- Setup Web Server
- Install Nginx (nginx-mainline) and php-fpm
- Install php-pgsql from official repository
- Enable pdo_pgsql.so in /etc/php/php.ini
- Run
composer install
in web/ - Run
./rsync-web.sh
as root, which will- Copy web/ to /srv/http/toyoj but web/config
- Copy toyoj.conf to /etc/nginx/toyoj.conf
- Create /srv/http/toyoj/config/config.php
- Include /etc/nginx/toyoj.conf in a server block of /etc/nginx/nginx.conf
- Setup Judge Backend
- Install GCC (gcc), Make (make), Python (python) and setuptools (python-setuptools)
- Run
make release
in sandbox/ - Copy sandbox/sandbox to /usr/bin/sandbox
- Run
python setup.py install
in judge/ - Install various compilers for language support
- Run
chmod 4755 /usr/bin/newuidmap /usr/bin/newgidmap
- Add system user toyojjudge and allocate at least 1 subuid and 1 subgid
- Run
toyojjudge
as user toyojjudge - Run
judge/grant-cgroups PID_OF_JUDGE
as root in one minute