Install nsjail for the sandbox environment.
- 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
- Clone and build
git clone https://github.com/google/nsjail.git \ && cd nsjail \ && make \ && mv ./nsjail /bin \ && cd .. && rm -rf ./nsjail
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
-
Set environment variables into
.env
under the root directoryKEY 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 forSECRET_TOKEN
. Then runcp .env packages/backend/.env
to copy the.env
file to the backend directory. -
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
-
Run the backend server
cd packages/backend & cargo build --release & cargo run --release
If you want to run the project locally, you can follow the steps above too.