PutongOJ Save

Putong Online Judge -- An online judge with nothing special

Project README

Putong Online Judge v2

(初代版本 here)

(English here)

Build Status Codecov Node JavaScript Style Guide License

预览

Demo (测试账号: 123456 / 123456)

文档

Currently Not available 如果问题,请直接在发起一个 issue。

Features

  • Docker 构建,一件部署
  • 单页应用
  • 多组测试样例
  • Powered by Vue.js, Koa.js, MongoDB, Redis

部署

注意,此 OJ 处于 beta 状态。

Docker

  1. 复制此仓库
git clone https://github.com/acm309/PutongOJ.git PutongOJ
  1. compose up
docker-compose up

or

daemon mode

docker-compose up -d

会在 80 端口启动。可以直接访问。默认管理员账户 admin, 密码 kplkplkpl

Enjoy it!

手动安装

推荐安装在 Ubuntu 上。可以尝试其他版本,但不保证稳定。

  1. 安装 Node.js mongodb && redis

  2. 安装其它依赖 (for ubuntu)

apt-get install libcairo2-dev libpango1.0-dev build-essential
  1. 复制此仓库
git clone https://github.com/acm309/PutongOJ.git
  1. 安装项目依赖
npm i -g pnpm
pnpm i
  1. 尝试连接数据库

设置环境变量

export redisURL='your redis url'
export dbURL='your mongodb url'

更新 config/index.js

const prod = {
  port: 3000 // the port the application will listen on
}
  1. 下载静态文件和启动判题端
node manager.js

pm2.config.json 会自动生成.

  1. 启动

安装 pm2

npm i -g pm2

用 pm2 启动

pm2 start pm2.config.json

迁移

找到并记住 mongodb 容器的 Container Id

docker ps

导出

<Container id> 替换为上一步中 mongodb 实际运行的 id

docker exec -it <Container id> mongodump --out /data/backup --db oj

数据会在 migrations/backup/

恢复

docker exec -it <Container Id> mongorestore --db oj --drop /data/backup/oj

静态文件

将文件复制到 public

<Container id> 替换为 oj 系统在运行的容器 id

docker cp <SRC_PATH> <Container Id>:/app/public

Browser Support

  • IE: NOT recommended
  • Chrome: 50 or above is recommended
  • Firefox: 50 or above is recommended
  • Edge: recommended

LICENSE

MIT

Open Source Agenda is not affiliated with "PutongOJ" Project. README Source: acm309/PutongOJ
Stars
180
Open Issues
15
Last Commit
2 months ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating