基于 Laravel 的开源 Online Judge 项目——NOJ
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
publicfolder and then, if there is a
open_basedirrestriction, remove it;
Now run the following commands at the root folder of NOJ;
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
.envjust 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!
composer.json or Dependency List for more info.