Skip to content

kevinxu001/GoOnlineJudge

 
 

Repository files navigation

#GoOnlineJudge

GoOnlineJudge is an ACM/ICPC online judge platform.

Demo

##Contents

##Installation ###Prerequisites Disclaimer: GoOnlineJudge works best on GNU/Linux and has been tested on Ubuntu 14.04. Windows and Mac OS X are not recommended because RunServer cannot be built on both of them.

If you are Windows or Mac OS X user, you can try out docker-oj, based on docker image and works out of the box.

Docker

Be careful! This section might be out-of-date. Always check the Manual Installation guide for your safety.

docker build -t oj .
docker run --link your_mongo:mongodb --name oj  -e DATA_PATH=your_data_path -e JUDGE_HOST=your_judge_host -v your_data_path:your_data_path -d -p 80:8080 oj

If you installed mongodb on your host os, use script like this:

cat > env_file <<EOF
MONGODB_USERNAME=test
MONGODB_PASSWORD=password
MONGODB_PORT_27017_TCP_ADDR=192.168.1.1
MONGODB_PORT_27017_TCP_PORT=27017
MONGODB_INSTANCE_NAME=test
DATA_PATH=your_data_path
JUDGE_HOST=your_judge_host
EOF

docker run --env-file env_file --name oj -v your_data_path:your_data_path -d -p 80:8080 oj

Quick Start

Be careful! This section might be out-of-date. Always check the Manual Installation guide for your safety.

GoOnlineJudge is installed by running the following commands in your terminal. You can install it via the command-line with 'wget`.

####via wget

wget https://raw.githubusercontent.com/ZJGSU-Open-Source/GoOnlineJudge/master/install.sh | sh

###Manual Installation ####Dependences

  • Go

    • GoOnlineJudge is mainly written in Go.
    • Get Go from golang.org
  • MongoDB

    • MongoDB is a cross-platform document-oriented databases.
    • Get MongoDB from MongoDB.org
  • mgo.v2

    • mgo.v2 offers a rich MongoDB driver for Go.
    • Get mgo.v2 via
    go get gopkg.in/mgo.v2
    
    • API documentation is available on godoc
  • flex

    • flex is the lexical analyzer used in RunServer.
    • Get flex using following command if you are running Ubuntu.
    sudo apt-get install flex
  • SIM

    • SIM is a software and text similarity tester. It's used in RunServer.
    • SIM is shipped along with RunServer.
  • GCC

    • The GNU compiler Collection.
    • Get GCC from GNU or using following command if you are running Ubuntu
    sudo apt-get install build-essential
  • OpenJDK

    • OpenJDK is Oracle's implementation of the next version of the Java SE platform.
    • OpenJDK is used to judge Java code.
    sudo apt-get install openjdk-7-jdk
  • iconv-go

    • iconv-go provides iconv support for Go.
    • Get iconv-go via
    go get github.com/djimenez/iconv-go
    

####Install

Obtain latest version via git, source codes will be in your $GOPATH/src.

git clone https://github.com/ZJGSU-Open-Source/GoOnlineJudge.git $GOPATH/src/GoOnlineJudge
git clone https://github.com/ZJGSU-Open-Source/RunServer.git $GOPATH/src/RunServer
git clone https://github.com/ZJGSU-Open-Source/vjudger.git $GOPATH/src/vjudger
git clone https://github.com/sakeven/restweb.git $GOPATH/src/restweb
# Set $OJ_HOME variable
export OJ_HOME="yourself oj home" #e.g. export OJ_HOME=/$GOPATH/src
export DATA_PATH=$OJ_HOME/Data
export LOG_PATH=$OJ_HOME/log
export RUN_PATH=$OJ_HOME/run
export JUDGE_HOST=your_judge_host #e.g. export JUDGE_HOST="http://127.0.0.1:8888"
export MONGODB_PORT_27017_TCP_ADDR=127.0.0.1
export PATH=$PATH:$GOPATH/bin

#directory for MongoDB Data
mkdir $OJ_HOME/Data

#directory for problem set
mkdir $OJ_HOME/ProblemData

#directory for running user's code
mkdir $OJ_HOME/run

#directory for log
mkdir $OJ_HOME/log

Make sure you have these directories in your $GOPATH/src:

github.com/  
GoOnlineJudge/  
RunServer/  
gopkg.in/  
restweb/  

And these directories in your $OJ_HOME:

ProblemData/  
run/  
log/  

Now, it's time for compilation.

cd $GOPATH/src/restweb
go install ./...
cd $GOPATH/src
restweb build GoOnlineJudge
cd $GOPATH/src/RunServer
./make.sh

Start OJ

RunServer&
cd $GOPATH/src
restweb run GoOnlineJudge &

Now,you can visit OJ on http://127.0.0.1:8080.

####Tips

  • You should always run MongoDB first then followed by OJ.

  • Running web server at 80 port requires administrator privileges. For security reasons, do not run our OJ at 80 port.

  • If you want to visit OJ at 80 port, nginx, the HTTP and reverse proxy server is recommended.

##Maintainers

  • memelee

  • sakeven

  • clarkzjw

  • rex-zed

##Roadmap

  • Binary packaging on mainstream distributions
  • Maybe a built-in simple blog
  • Rebase RESTful API
  • Modern design front-end

##Contributions

##License See LICENSE

Packages

No packages published

Languages

  • JavaScript 55.6%
  • CSS 23.3%
  • Go 11.0%
  • Smarty 9.3%
  • Other 0.8%