Skip to content

An online judge sandbox server in Rust, inspired by go-judge, for SASTOJ.

License

Notifications You must be signed in to change notification settings

NJUPT-SAST/rsjudge

Repository files navigation

rsjudge

rsjudge logo

An online judge sandbox server in Rust, inspired by go-judge, for SASTOJ.

Features

  • Supports multiple programming languages, with easy way to add new ones in config file.

  • Support for multiple compiler versions — just use your favorite toolchain manager and set the path in config file.

  • Supporting both self-testing and final submission.

  • Customizable compilation and execution process with TOML config file.

  • Monitoring and limiting resource usage.

  • Works well with SASTOJ.

  • RESTful API, gRPC and RabbitMQ support, enable or disable them with feature flags or config file.

  • Streaming test results in real-time with server-sent events(SSE) or gRPC stream.

  • Highly extensible with plugins.

  • Blazingly fast and secured with Rust🦀.

Pronunciation and spelling

The name "rsjudge" is a combination of "Rust" and "judge". It is pronounced as "R-S-judge". The word should be written in lowercase, with no space in between, even in the title or at the beginning of a sentence.

Repository structure

src/

Source of entry point, including CLI and configuration parsing.

xtask/

Extra tasks for building and packaging, invoked with cargo xtask <TASK>.

crates/

Sub-crates of the project.

crates/rsjudge-grpc/

Crate for gRPC server and client.

crates/rsjudge-judger/

Crate for answer comparing and judging.

crates/rsjudge-rest/

Crate for RESTful API server.

crates/rsjudge-runner/

Crate for sandbox logic.

packaging/

Files for generating .deb and .rpm package.

Repository structure visualized

Build from source

Prerequisites

  • Rust toolchain according to MSRV.

  • Linux kernel >= 4.5,

    • Required for Seccomp BPF support.

  • For gRPC support (under grpc feature):

    • protoc >= 3.15,

    • buf for gRPC dependencies management.

  • For .deb package generation, a Debian/Ubuntu system with dpkg-dev and liblzma-dev installed.

MSRV (Minimum Supported Rust Version)

rsjudge uses the MSRV policy of N - 2, where N is the current stable version of Rust. For example, if the current stable version is 1.79, then the MSRV will be set to 1.77.

The current MSRV can be found in the rust-version field in Cargo.toml. We will not support any Rust version older than the MSRV after we update it. They may still work, or fail to compile or execute rsjudge correctly.

Note
To maintainers:

When MSRV is updated, be sure to update the building workflow at the same time.

Install dependencies

You can install Rust toolchain with rustup:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env

Debian/Ubuntu

  1. Install buf manually, if they are not available in the package manager.

  2. Ensure a protoc binary with version >= 3.15 is available in your PATH, or install it manually by downloading from the release page.

    • On Debian 12, Ubuntu 23.04 or later versions, you can install a compatible protoc with apt:

      sudo apt install -y protobuf-compiler libprotobuf-dev
  3. Install packaging related packages with apt:

    sudo apt install dpkg-dev liblzma-dev

Alpine

sudo apk add protoc protobuf-dev

# Installing buf
curl -sSL -o buf \
  "https://github.com/bufbuild/buf/releases/download/latest/buf-Linux-$(uname -m)"
# You can replace `/usr/local/bin` with your preferred directory,
# but remember to add it to `PATH`
sudo install -Dm755 buf /usr/local/bin/buf

Arch Linux

sudo pacman -S --needed protobuf buf

Build

Clone the repository:

git clone https://github.com/NJUPT-SAST/rsjudge.git
cd rsjudge

Build the project with Cargo:

cargo build --release

Generate .deb package:

cargo xtask dist deb

The .deb package will be generated in target/debian.

About

An online judge sandbox server in Rust, inspired by go-judge, for SASTOJ.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published