Giter Club home page Giter Club logo

judgenode's Introduction

Judge Node

安裝

  1. 安裝 Nodejs & MySQL apt-get install nodejs mysql-server
  2. 下載這一份 repository git clone https://github.com/JudgeGirl/JudgeNode
  3. 複製設定檔案,並且產生 https 需要的相關文件
$ cp _DEFAULTconfig.yml _config.yml
$ openssl genrsa -out privatekey.pem 1024
$ openssl req -new -key privatekey.pem -out certrequest.csr
$ openssl x509 -req -in certrequest.csr -signkey privatekey.pem -out certificate.pem
  1. 確定 Judge 的目錄如下所示:
root@ubuntu:/home/judgesister# tree -L 1
.
├── JudgeNode (可以放置別處)
├── Judge-sender (一定要與 source, submission, testdata 位置相當)
├── Judge-template (提供範例,可不用下載)
├── source
├── submission
└── testdata
  1. 如果不手動建立,可以參考以下的做法建立
$ mkdir /home/judgesister/source
$ mkdir /home/judgesister/submission
$ mkdir /home/judgesister/testdata
$ cp -r /home/judgesister/Judge-template/default/source/* /home/judgesister/source/
  1. 安裝 JudgeNode 相關套件
$ cd JudgeNode
$ npm install
$ bower install
$ gulp build
  1. 測試用的啟動模式 npm start / 公開用的啟動模式 ./start

關於設定檔

_config.yml 中,預設檔案配置如下:

# order is important, don't change or alternate, otherwise please change all testdata/xxx/judge
# lang: ['*', 'C', 'C++', 'C# 3.0', 'Python 3', 'Scala 2']
# compiler: [, 'g++ -std=c++98 -O2', 'mcs -langversion:3', 'python3', 'scalac -optimise'],
# WT: 0, CE: 1, OLE: 2, MLE: 3, RE: 4, TLE: 5, WA: 6, AC: 7, SAVING: 8, PE: -1,
JUDGE:
    path: 'c:/Users/morris821028/Desktop/github/'
    lang: ['*', 'C']
    compiler_arg: ['none', 'gcc -std=c99 -O2']
    result_message: ['Waiting', 'Compilation Error', 'Output Limit Exceeded', 'Memory Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Wrong Answer', 'Accepted', 'Uploading...', 'Presentation Error']

# JUDGE_PATH/submission /testdata /source
# JUDGE_PATH: /home/c2014/judgesister/

# MODE: limits user open previous source code & submit problem which not in contest.
CONTEST:
    MODE: false
    SUBMIT_LIMIT: 15
    VALID_IP: ["::ffff:140.112.16.155", "::ffff:140.112.16.156", "::ffff:140.112.16.158", "::1", "::ffff:127.0.0.1"]

# DATABASE Setting, MySQL
DATABASE:
    host: '140.112.xxx.xxx'
    user: 'xxxxxxxxxxxxxxx'
    password: 'xxxxxxxxxxx'
    port: '3306'
    database: 'xxxxxxxxxxxxx'

# WEBSITE API HOST
HOST:
    TITLE: 'Judge Girl'
    IP: 'localhost'
    testdata: 'https://github.com/JudgeGirl/JG-testdata/blob/master/practice/'
    social:
        youtube: 'https://www.youtube.com/playlist?list=PLOvZ8aEg7xDkpKHk3hAwQxLAlpZ1Q3wKH'
        github: 'https://github.com/pangfengliu/programmingtasks/issues'
        facebook: 'https://www.facebook.com/%E6%89%B9%E6%94%B9%E5%A8%98%E7%B2%89%E7%B5%B2%E5%9C%98-257246016760/timeline/'
        googlesite: 'https://sites.google.com/site/ntucsiec2015/announcement'
    footer:
        text: 'TA 曹又霖、顏志軒、林蔚城、陳威甯'
        license: 'Instructor <a title="劉邦鋒" href="/">Pangfeng Liu</a>, Web designer <a title="許祐程" href="/">Akira</a>, <a title="王盛平" href="/">Peer4321</a>, <a title="曹又霖" href="https://github.com/sinmaplewing">Maplewing</a>, <a title="楊翔雲" href="https://github.com/morris821028">Morris</a>'
# Disqus
Disqus:
    shortname: 'ntucsiecprogramming'

公開用的啟動模式

網站可能會因為某些 Bug 而掛掉,若需要不斷地重新開啟,執行目錄下的 ./start 可以每隔 10 秒嘗試重新啟動,如果要強制關閉,請按 CTRL + C 終止網站啟動。在這種模式下,Debug 工作會變得非常困難。

$ ./start
  • 如果 CTRL + C 沒有反應,按照下面步驟。
$ root@ubuntu:/home/judgesister/JudgeNode# ps aux | grep start
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      5671  0.0  0.0   4448   780 pts/3    S+   Feb20   0:00 /bin/sh ./start <<<<Judge-sender
root     19296  0.0  0.0  27236  8028 pts/4    S+   12:04   0:00 python3 ./start <<<<JudgeNode
$ kill -9 <JudgeNode-PID>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.