minhducsun2002 / kjudge

A simple system for hosting competitive programming contests.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kjudge

Build and Test Docker Image Version (latest semver) GitHub release (latest SemVer) godoc License is AGPLv3

Project Goals

  • As lightweightedly deployable as possible (single binary, minimal dependencies, Docker-compatible)
  • User friendly
  • Doesn't get in the way (take minimal resources)

Quick start

The fastest way to get kjudge up and runnning is through the official Docker image.

It contains:

  • kjudge itself
  • Compilers for C++, Pascal, Java, Go, Rust, Python 2 and 3
  • The isolate sandbox

Please checkout the wiki for more information on how to get it up and running.

Need more details?

Check out the wiki!

Runtime dependencies

It should run on all platforms Go compiles to.

Required binaries:

  • isolate: The recommended sandbox. This is actually optional, however the only alternate sandbox implementation available (as of now) is the raw sandbox, which DOES NOT PROVIDE ANY GUARDS AGAINST FOREIGN CODE (which makes it okay to run when you are the only user). isolate is available on Linux systems only.

Command line switches

> ./kjudge -h
Usage of ./kjudge:
  -file string
    	Path to the database file (default "kjudge.db")
  -port int
    	The port for the server to listen on (default 8088)
  -sandbox string
    	The sandbox implementation to be used (isolate, raw). If anything other than 'raw' is given, isolate is used. (default "isolate")

Build Instructions

External Dependencies:

cc:      anything that compiles SQLite 3
go:      >= 1.13
node.js: >= 12
yarn:    >= 1

Go dependencies: See tools.go. All Go dependencies can be installed with

scripts/install_tools.sh

Production build

Build steps:

scripts/production_build.sh

Development build

First time contributors: Please check out the Code of Conduct and Contributor Guidelines!

First, start the template generator and updater with

cd frontend
yarn && yarn dev

Note that it would block and watch for any updates on the front-end templates.

Now open a new terminal, run

go generate

to generate the models and load a development (live-reloading) version of the template packager.

Finally, run

go run cmd/kjudge/main.go

to run kjudge.

Directory Structure

assets:   # Static assets that gets compiled into the binary
    - sql # SQL migration schemas
cmd:          # Main commands
    - kjudge  # Main compile target
    - migrate # Database migration tool, useful for development
db # Database interaction library
docker    # Dockerfile and other docker-related packaging handlers
scripts   # Scripts that helps automating builds
models:          # Database entities
    - generate   # Generator for models
    - verify     # Model verification helpers
static # [GENERATED BY FILEB0X]
templates   # Generated templates from frontend
frontend:   # Template files and front-end related source codes
    - html  # HTML [template] files
    - css   # CSS files
    - ts    # TypeScript files
worker:        # Automatic judging logic
    - raw      # Raw and isolate are 2 sandbox implementations
    - isolate
server:        # Root of server logic
    - auth     # Authentication logic and session handlers
    - template # Template resolver and renderer implementation
    - user     # /user page handling and contexts
    - admin    # /admin (Admin Panel) page handling and contexts
    - contests # /contests (main contest UI) page handling and contexts
test  # Sample data for testing purposes
tests # Test-handling logic

License

GNU Affero General Public License v3.0, which disallows distributing closed-source versions, so don't do it.

About

A simple system for hosting competitive programming contests.

License:GNU Affero General Public License v3.0


Languages

Language:Go 58.9%Language:HTML 29.6%Language:TypeScript 8.7%Language:Shell 1.5%Language:Dockerfile 0.7%Language:JavaScript 0.3%Language:CSS 0.2%Language:Python 0.2%