Coder Social home page Coder Social logo

robert1003 / dsajudge Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qazwsxedcrfvtg14/dsajudge

1.0 0.0 3.0 3.38 MB

An online judge for DSA & ADA class.

Home Page: https://dsa.csie.org

JavaScript 41.20% Shell 3.34% Python 5.20% Makefile 0.44% C 12.28% CSS 2.52% C++ 23.99% Pug 11.03%

dsajudge's Introduction

Original Project

https://github.com/bobogei81123/adajudge
https://github.com/tzupengwang/adajudge

Installation

# install nvm
# https://github.com/creationix/nvm

# install node
nvm install v10.10.0

# install mongodb
sudo apt update
sudo apt install mongodb

# install gulp and forever
# npm update; npm audit fix;
npm install -g gulp forever

# Install package. It would take a while. Use default configuration is fine when being prompted.
npm install

# Install needed packages
sudo apt install libseccomp-dev libseccomp2 seccomp libcap-dev asciidoc gcc g++ make python numactl
# Install python2 setuptools for git upload hook (git submission only)

# Init
gulp init
# Semantic auto install is bugged
# So choose extend my settings > automatic manually when prompted

# Build semantic again...
(cd semantic; gulp build)
# Copy (or symbolic link) ./semantic to dist/static/semantic
# cp -r semantic dist/static/
# use RELATIVE PATH instead of realpath:
ln -s ../../semantic/dist dist/static/semantic

# IMPORTANT! MUST DO:
# Create src/server/config.js
# example: config.example.js
# SHOULD check the number of numa pool and edit the config
# maximum number of numaPool: view by `numactl --hardware` command (type: Array<{cpu:${id},mem:${id}}>. The array length MUST NOT greater than the number of numa nodes, the ids of the nodes can also be found from the command output.)
# maxWorkers: the maximum number of total workers
# maxNodeWorkers: unknown

# Build
# be sure that the default checker `src/server/cfiles/default_checker.cpp` can be compiled successfully 
gulp build
cp src/server/scripts/*.sh dist/scripts/; cp src/server/scripts/*.py dist/scripts/;

# Build and copy isolate (and make sure `dist/judger/isolate` exists and has setuid and execute permission (rwsr-sr-x))
gulp isolate # and enter sudo password, sometimes it fails to prompt for password, you may need to run the below commands manually (or perhaps run 'sudo echo hi' beforehand)
# sudo rm -f isolate/isolate; sudo rm -f dist/judger/isolate;
# (cd isolate; make isolate)
# cp ./isolate/isolate dist/judger/
# sudo chown root:root dist/judger/isolate
# sudo chmod +s dist/judger/isolate
# sudo chmod a+x dist/judger/isolate

# Unzip fonts.tar.gz in dist/static
tar xvf fonts.tar.gz -C dist/static/

# Link MathJax
ln -s ../../node_modules/mathjax/ dist/static/MathJax

# Edit isolate config
sudo mkdir /usr/local/etc
sudo cp isolate.conf /usr/local/etc/isolate
# Modify isolate sandbox permission if they exist
sudo chown -R root:root /dev/shm/isolate
sudo chmod 755 /dev/shm/isolate
sudo chmod 755 /dev/shm/isolate/META

# Build gitosis from https://github.com/res0nat0r/gitosis (git submission only)
sudo adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git
# create ssh key: ssh-keygen
# Initialize gitosis
sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
git clone git@localhost:gitosis-admin.git

# Set git config (git submission only)
# git config --global user.email "[email protected]"
# git config --global user.name "Your Name"
# Copy /bin/cp to /home/git/cp with owner 'git' and set its set-user-id bit
sudo cp /bin/cp /home/git/; sudo chown git:git /home/git/cp; sudo chmod +s /home/git/cp;

# Initialize init git repository (git submission only)
sudo cp -r git/init.git /home/git/repositories/
sudo chown -R git:git /home/git/repositories/init.git
sudo chmod 755 /home/git/repositories/init.git/hooks/*
sudo cp git/serve.py /usr/local/lib/python2.7/dist-packages/gitosis-0.2-py2.7.egg/gitosis/
# Install python(2) package 'requests' for all user (git)

# Run server on port 3333
./start.sh

# `forever list` to view process status
# `node dist/scripts/add_admin.js` to add an admin account
# source codes change: `gulp build; forever restartall;`
# semantic change: `(cd semantic; gulp build); forever restartall;`

# install apache2 server or nginx server and redirect connection to port 80 to http://localhost:3333/ and start the server
# install pymongo from pip3
# many judge_name, domain_name, email_address, ... need to be changed

Misc

override semantic css

file semantic/src/site/collections/table.overrides

/*******************************
         Site Overrides
*******************************/

.ui.definition.table tr td.definition, .ui.definition.table > tbody > tr > td:first-child:not(.ignored), .ui.definition.table > tfoot > tr > td:first-child:not(.ignored), .ui.definition.table > tr > td:first-child:not(.ignored) {
    background: rgba(0, 0, 0, .03);
    font-weight: 700;
    color: rgba(255, 255, 255, 1);
    text-transform: '';
    -webkit-box-shadow: '';
    box-shadow: '';
    text-align: '';
    font-size: 1em;
    padding-left: '';
    padding-right: ''
}

Title color

DSA: teal ADA: olive

In file src/client/js/components/root/menu.pug, the menu-font color: DSA: #6dffff ADA: #b5cc18

If the website did not change after rebuild, delete the node_modules directory and reinstall and rebuild everything again.
Also, check if website caches are cleared.

Issue

Kindly submit any issue you found on github.
TODO: fix addUsersByHand.js or use add_user.js

dsajudge's People

Contributors

bobogei81123 avatar giver139 avatar ototot avatar qazwsxedcrfvtg14 avatar robert1003 avatar taweitu avatar tzupengwang avatar

Stargazers

 avatar

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.