Skip to content

Latest commit

 

History

History
78 lines (52 loc) · 1.99 KB

README.md

File metadata and controls

78 lines (52 loc) · 1.99 KB

Next Online Judge

English / 简体中文

Issues / Telegram

Install

Dependencies

Install nsjail for the sandbox environment.

  1. Install the necessary dependencies
    sudo apt-get update
    sudo apt-get install -y autoconf bison flex gcc g++ git libprotobuf-dev libnl-route-3-dev libtool make pkg-config protobuf-compiler
  2. Clone and build
    git clone https://github.com/google/nsjail.git \
    && cd nsjail \
    && make \
    && mv ./nsjail /bin \
    && cd .. && rm -rf ./nsjail

Set up the database with other environments variables

Tips for install environment

Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Important

Environment need: Rust >= 1.7.0, Node.js >= 18, Postgres >= 15

  1. Set environment variables into .env under the root directory

    KEY VALUE
    DATABASE_URL The database connection string
    REDIS_URL The redis connection string
    SECRET_TOKEN The key for session management

    You can use openssl rand -hex 32 to generate a random string for SECRET_TOKEN. Then run cp .env packages/backend/.env to copy the .env file to the backend directory.

  2. Init the database schema

    git clone https://github.com/AprilNEA/next-online-judge.git
    & cd next-online-judge
    & npm install -g prisma # pnpm or yarn, -g(--global) is optional
    & prisma db push
  3. Run the backend server

    cd packages/backend
    & cargo build --release
    & cargo run --release

Run

Contribute

If you want to run the project locally, you can follow the steps above too.