8000 GitHub - acm309/PutongOJ: Online Judge system designed for competitive programming and algorithmic problem-solving. · GitHub
[go: up one dir, main page]

Skip to content
acm309Public

About

Online Judge system designed for competitive programming and algorithmic problem-solving.

Topics

Resources

Stars

199 stars

Watchers

11 watching

Forks

Repository files navigation

Putong OJ

Node.JS Test Status Codecov GitHub License

Putong OJ is an online judge system designed for competitive programming and algorithmic problem-solving. A live instance is available at acm.cjlu.edu.cn.

Important

The development of Putong OJ is closely tailored to the practical needs of the ACM Lab at CJLU, incorporating numerous customized features.

If you wish to deploy your own instance, we recommend forking the repository and modifying the code according to your requirements. Currently, Putong OJ does not support configuration options for these customized features.

Caution

The current branch may contain untested changes after dependency upgrades and a project structure refactor. For production use, we strongly recommend using the last stable version: backend at commit 6c7b68c and frontend at commit ce13bf1.

Some features might be unstable until comprehensive testing is completed. Proceed with caution when deploying this version.

Features ✨

  • One-Click Deployment – Easily deploy with Docker.
  • Modern Web Interface – Built as a single-page application (SPA) using Vue.js.
  • Scalable Architecture – Backed by Koa.js, MongoDB, and Redis for optimal performance.
  • Multiple Testcases Support – Run and evaluate submissions with multiple testcases.
  • Flexible Judging System – Supports various programming languages.
  • Real-Time Status Updates – Monitor submissions and results dynamically.
  • Contest Mode – Conduct coding contests with live rankings and scoreboard.
  • Submission History – Track past submissions with insights.
  • Code Execution Sandbox – Secure environment to prevent malicious execution.
  • RESTful API Support – Extend functionality with API integrations.
  • And much more...

Getting Started 🚀

Prerequisites

Before proceeding, ensure that you have the following installed:

For local development, create the environment file at the repository root:

cp .env.example .env

Build and Run

Build Docker Image

Run the following command to build the Docker image:

docker build -t ptoj-app .

Run the Application

Replace <YOUR_MONGODB_URL> and <YOUR_REDIS_URL> with your actual database connection URLs:

docker run -d --name ptoj-app \
    -p 3000:3000 \
    -e NODE_ENV=production \
    -e PTOJ_MONGODB_URL=<YOUR_MONGODB_URL> \
    -e PTOJ_REDIS_URL=<YOUR_REDIS_URL> \
    ptoj-app

This will start the application on port 3000.

Full-stack Compose Example

The following Compose configuration can be used to run the application, MongoDB, Redis, and sandbox together:

# Putong OJ Docker Compose Configuration
# You should mount the data, logs and uploads directories to persist data.

services:
  putong-oj:
    build:
      context: .
    environment:
      - NODE_ENV=production
      - PTOJ_MONGODB_URL=mongodb://db:27017/oj
      - PTOJ_REDIS_URL=redis://redis:6379
      - PTOJ_SANDBOX_ENDPOINT=http://sandbox:5050
    ports:
      - 3000:3000
    volumes:
      - putong-oj-data:/app/apps/server/data
      - putong-oj-uploads:/app/apps/server/public/uploads
    depends_on:
      - redis
      - db
      - sandbox

  db:
    image: mongo:latest
    ports:
      - 27017:27017

  redis:
    image: redis:latest
    ports:
      - 6379:6379

  sandbox:
    build:
      context: .
      dockerfile: apps/judger/Dockerfile.sandbox
    privileged: true
    cgroup: host
    shm_size: 256m
    volumes:
      - putong-oj-data:/app/data:ro

volumes:
  putong-oj-data:
  putong-oj-uploads:

Persistent Data Storage

To retain data across container restarts, mount the following volumes:

/app/apps/server/data
/app/logs
/app/apps/server/public/uploads

Services

The backend is split into independently built applications:

  • apps/server provides the Koa HTTP API and the notification WebSocket stream.
  • apps/worker runs asynchronous maintenance jobs.
  • apps/judger judges submissions with the go-judge sandbox.

The root image launches all three processes with PM2. The root docker-compose.yml starts MongoDB, Redis, and sandbox for local development:

pnpm dev:db
pnpm dev:db:down

License 📜

This project is licensed under the MIT License. See the LICENSE file for more details.

About

Online Judge system designed for competitive programming and algorithmic problem-solving.

Topics

Resources

Stars

199 stars

Watchers

11 watching

Forks

Used by

Contributors

Languages

0