Skip to content

msqtt/sb-judger

Repository files navigation


SB-JUDGER 🤪

◦ ► 使用 Go 语言开发的轻量 OnlineJudge Server.

GitHub license git-last-commit GitHub commit activity GitHub top language

🖼️ 截图

image

📝 简介

sandbox-judger 使用 LXC 技术,为用户提交每一个的代码进程创建一个沙箱,并在指定的系统资源下运行程序,达到安全判题的效果。

它使用 namespace、cgroup 来隔离资源,使用 overlayfs 作为 Unionfs。

目前 sb-judger 还不支持 cgroupv1,在使用前请确保运行环境使用的是 cgroupv2。

🚀 开始

🔧 安装

  1. 克隆仓库:
git clone https://github.com/msqtt/sb-judger
  1. 切换目录:
cd sb-judger
  1. 制作 rootfs:
make rootfs

如果你有自己的 rootfs 请忽略这步 mkdir rootfs 后,直接把根目录解压到 rootfs 即可。

  1. 开始构建:
make build

🤖 启动

./sb-judger

打开运行代码测试页面 :

open http://localhost:8080

🐬 Docker

使用我的

docker pull msqt/sb-judger:latest
docker run --privileged -d -p8080:8080 -p9090:9090 msqt/sb-judger

自己构建

APP_IMAGE_NAME=xxx APP_IMAGE_TAG=0.1.0 make docker

🌐 API

sb-judger 使用 grpchttp 作为通讯协议,且使用 grpc-http-gateway 提供 http 服务。

⚙️ 配置

  • 语言配置
  • 软件配置
    • 可以直接通过环境变量传入,比如: HTTP_ADDR=0.0.0.0:8080 ./sb-judger,docker 也是同理。

🛣 路线

  • ℹ️ Support cgroupv2
  • ℹ️ Test
  • ℹ️ Metric API
  • ℹ️ ...

🧮 支持语言

  • ℹ️ c/cpp
  • ℹ️ golang
  • ℹ️ python
  • ℹ️ java
  • ℹ️ rust
  • ℹ️ ...

🤝 Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines

Click to expand
  1. Fork the Repository: Start by forking the project repository to your GitHub account.
  2. Clone Locally: Clone the forked repository to your local machine using a Git client.
    git clone <your-forked-repo-url>
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear and concise message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to GitHub: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.

Once your PR is reviewed and approved, it will be merged into the main branch.


📄 License

This project is protected under the MPL2 License. For more details, refer to the LICENSE file.