基于 Laravel 的开源 Online Judge 项目——NOJ
NOJ
NOJ是一个由PHP+Laravel开发而成的开源在线测评系统,开源地址:GitHub Repo。
Installation
CentOS will be recommended for hosting NOJ, but all major operating systems are theoretically supported.
Till now, NOJ have been successfully deployed to the following systems:
- Ubuntu 16.04.3 LTS
- CentOS Linux release 7.6.1810 (Core)
- Windows 10 Professional 10.0.17134 Build 17134
Here is detailed step about deploying NOJ:
-
You need to have a server and installed the following:
-
Clone NOJ to your website folder;
cd /path-to-noj/
git clone https://github.com/ZsgsDesign/NOJ ./
-
Change your website root to
public
folder and then, if there is aopen_basedir
restriction, remove it; -
Now run the following commands at the root folder of NOJ;
composer install
Notice: you may find this step(or others) fails with message like "func() has been disabled for security reasons", it means you need to remove restrictions on those functions, basically Laravel and Composer require proc_open and proc_get_status to work properly.
- Almost done, you still got to modify a few folders and give them permission to write;
chmod -R 775 storage/
chmod -R 775 bootstrap/
chmod -R 775 app/Http/Controllers/VirtualCrawler/
chmod -R 775 app/Http/Controllers/VirtualJudge/
- OK, right now we still need to configure environment, a typical
.env
just like the.env.example
, you simply need to type the following codes;
cp .env.example .env
vim .env
- Now, we need to configure the database, thankfully Laravel have migration already;
php artisan migrate
- Lastly, we need to configure the virtual judger and online judger;
crontab -e
* * * * * php /path-to-noj/artisan schedule:run
php artisan queue:work --queue=noj,codeforces,contesthunter,poj,vijos,pta,uva,hdu,uvalive
- NOJ's up-and-running, enjoy!
Credit
See composer.json
or Dependency List for more info.