Putong Online Judge -- An online judge with nothing special
Switch branches/tags
Nothing to show
Clone or download

README.md

Putong Online Judge v2

(For version 1, please visit here)

Build Status Codecov David Node JavaScript Style Guide License

Preview

Demo (Test Account: 123456 / 123456)

Documentation

Currently Not available

Features

  • Built on Docker -- One click Deployment
  • Single Page Application -- Better User Experience
  • Support multiple cases of test data
  • Powered by Vue.js, Koa.js, MongoDB, Redis

Delpoyment

Note: This project is still during BETA stage

Docker

  1. clone this project
git clone https://github.com/acm309/PutongOJ.git PutongOJ
  1. compose up
docker-compose up

or

daemon mode

docker-compose up -d

It will listen on 80 ports after it is successfully deployed. Then you can directly visit this platform.

Enjoy it!

Manual Installation

Ubuntu is recommended. You can deploy this platform on other linux, but I can't ensure it must work.

  1. install Node.js mongodb && redis

  2. install some system dependencies (for ubuntu)

apt-get install libcairo2-dev libpango1.0-dev build-essential
  1. clone this repo
git clone https://github.com/acm309/PutongOJ.git
  1. install project dependencies
npm i -g yarn
yarn
  1. setup database connections

export variables

export redisURL='your redis url'
export dbURL='your mongodb url'

update config/index.js

const prod = {
  port: 3000 // the port the application will listen on
}
  1. setup static files and judger
node manager.js

pm2.config.json would be generated.

  1. start

install pm2 first

npm i -g pm2

then start with pm2

pm2 start pm2.config.json

Migration

Know the Container Id of the mongodb container by running:

docker ps

dump

Replace <Container id> with the real id of your running mongodb container

docker exec -it <Container id> mongodump --out /data/backup --db oj

The output data will be stored at migrations/backup/

restore

docker exec -it <Container Id> mongorestore --db oj --drop /data/backup/oj

static files

copy files to public folder

Replace <Container id> with the real id of your running oj container

docker cp <SRC_PATH> <Container Id>:/app/public

Browser Support

  • IE: NOT recommended
  • Chrome: 50 or above is recommended
  • Firefox: 50 or above is recommended
  • Edge: recommended

LICENSE

MIT