mirror of
https://github.com/QingdaoU/oj-docs.git
synced 2024-12-27 15:01:44 +00:00
feat: en docs
This commit is contained in:
parent
2a4f98cdd2
commit
d53df46251
13
_sidebar.md
13
_sidebar.md
@ -1,3 +1,16 @@
|
||||
- Guide
|
||||
- [Installation](en/guide/installation.md)
|
||||
- [Configuration](en/guide/configuration.md)
|
||||
- [Customize Judge Environment](en/guide/judge_language_customization.md)
|
||||
- Management
|
||||
- [Backup & Restore](en/management/backup_and_restore.md)
|
||||
- Development
|
||||
- [Architecture](en/development/architecture.md)
|
||||
- [Build](en/development/build.md)
|
||||
- [Contributor](en/development/contributor.md)
|
||||
|
||||
---
|
||||
|
||||
- 用户指南
|
||||
- [部署](onlinejudge/guide/deploy.md)
|
||||
- [测试用例格式](onlinejudge/guide/test_case.md)
|
||||
|
37
en/development/architecture.md
Normal file
37
en/development/architecture.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Architecture
|
||||
|
||||
```mermaid
|
||||
|
||||
flowchart LR
|
||||
api["API Server"]
|
||||
static["Web Frontend"]
|
||||
judge["Judge Server"]
|
||||
|
||||
Internet --> Proxy
|
||||
api --> judge
|
||||
api --> Cache
|
||||
api --> Database
|
||||
|
||||
subgraph Backend
|
||||
Proxy --> api
|
||||
Proxy --> static
|
||||
end
|
||||
```
|
||||
|
||||
## Tech Stack
|
||||
|
||||
### Proxy
|
||||
|
||||
Nginx
|
||||
|
||||
### Web Frontend
|
||||
|
||||
Vue + Element UI
|
||||
|
||||
### API Server
|
||||
|
||||
Django + Dramatiq
|
||||
|
||||
### Judge Server
|
||||
|
||||
Flask + seccomp
|
19
en/development/build.md
Normal file
19
en/development/build.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Build
|
||||
|
||||
## Container Image
|
||||
|
||||
### API
|
||||
|
||||
```bash
|
||||
git clone https://github.com/QingdaoU/OnlineJudge.git
|
||||
cd OnlineJudge
|
||||
docker buildx build . -t oj-image/backend:1.6.0 --load
|
||||
```
|
||||
|
||||
### Judge Server
|
||||
|
||||
```bash
|
||||
git clone https://github.com/QingdaoU/JudgeServer.git
|
||||
cd JudgeServer
|
||||
docker buildx build . -t oj-image/judge:1.6.0 --load
|
||||
```
|
45
en/development/contributor.md
Normal file
45
en/development/contributor.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Contributors
|
||||
|
||||
## v2.0
|
||||
|
||||
Main developers:
|
||||
|
||||
- [virusdefender](https://virusdefender.net)
|
||||
- [rawidn](https://rawidn.com)
|
||||
|
||||
Thanks:
|
||||
|
||||
- [heb1c](https://github.com/hebicheng)
|
||||
|
||||
## v1.0
|
||||
|
||||
Main developers:
|
||||
|
||||
- [virusdefender](https://virusdefender.net)
|
||||
- [sxwxs](https://github.com/sxwxs)
|
||||
- [hohoTT](https://github.com/hohoTT)
|
||||
- [spxcds](https://github.com/spxcds)
|
||||
- [ltwy](http://ltwy.me)
|
||||
|
||||
Thanks:
|
||||
|
||||
- [AIRobot](http://airobot.link)
|
||||
- [minyu](http://www.yuntoo.com)
|
||||
- [BIGBALLON](http://bigballon.github.io/)
|
||||
- [SCaffrey](http://www.scaffrey.com/)
|
||||
- [cjsoft](http://wallacenews.tk/)
|
||||
- [湘江一桥](http://yiq.wang)
|
||||
- [cnyali](http://blog.csdn.net/cnyali)
|
||||
- [kam](https://github.com/ganting)
|
||||
- [joe](https://github.com/xuse)
|
||||
- [ltwy](http://ltwy.me/)
|
||||
- [稗田千秋](https://wind.moe/)
|
||||
- [伯伦希尔码农](http://qm.qq.com/cgi-bin/qm/qr?k=MeVkuAC2PmW4cdobY0te9djBPI5aFdT4)
|
||||
- [joeyAC(acm新人)](https://github.com/joeyac)
|
||||
- [千千](https://www.dreamwings.cn)
|
||||
- [Cosima](http://blog.cosimahan.com)
|
||||
|
||||
## Predecessors
|
||||
|
||||
- 董延鑫 邢兆龙
|
||||
- 董延鑫 杨玉飞 徐可飞 王波 周鲁晓
|
22
en/guide/configuration.md
Normal file
22
en/guide/configuration.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Configuration
|
||||
|
||||
## Environment variables
|
||||
|
||||
### Web Backend
|
||||
|
||||
| Name | Default Value | Description |
|
||||
| ---- | ----- | ----------- |
|
||||
| POSTGRES_HOST | `postgres` | Postgres connection host |
|
||||
| POSTGRES_PORT | `5432` | Postgres connection port |
|
||||
| POSTGRES_DB | `onlinejudge` | Postgres database name |
|
||||
| POSTGRES_USER | `onlinejudge` | Postgres user name |
|
||||
| POSTGRES_PASSWORD | `onlinejudge` | Postgres user password |
|
||||
| REDIS_HOST | `redis` | Redis connection host |
|
||||
| REDIS_PORT | `6379` | Redis connection port |
|
||||
| JUDGE_SERVER_TOKEN | (empty) | password used in judge server authentication |
|
||||
|
||||
### Judge Server
|
||||
|
||||
| Name | Default Value | Description |
|
||||
| ---- | ----- | ----------- |
|
||||
| JUDGE_SERVER_TOKEN | (empty) | password used in judge server authentication |
|
30
en/guide/installation.md
Normal file
30
en/guide/installation.md
Normal file
@ -0,0 +1,30 @@
|
||||
# Installation
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker server
|
||||
- Docker Engine (Linux)
|
||||
- Docker Desktop (Windows, macOS and Linux)
|
||||
- Colima (macOS)
|
||||
- OrbStack (macOS)
|
||||
- (others)
|
||||
- Docker client
|
||||
- Docker compose plugin
|
||||
|
||||
## Steps
|
||||
|
||||
1. Get necessary files from [QingdaoU/OnlineJudgeDeploy](https://github.com/QingdaoU/OnlineJudgeDeploy) releases.
|
||||
|
||||
```bash
|
||||
git clone -b v1.6.0 https://github.com/QingdaoU/OnlineJudgeDeploy.git
|
||||
```
|
||||
|
||||
2. Pull and start containers.
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
3. Done!
|
||||
|
||||
!> Default account is `root` / `rootroot`, **please change the password as soon as possible**.
|
41
en/guide/judge_language_customization.md
Normal file
41
en/guide/judge_language_customization.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Judge Language Customization
|
||||
|
||||
1. Build custom judge server container image
|
||||
|
||||
If you don't need to modify judge environment, you can skip this step.
|
||||
|
||||
```bash
|
||||
git clone https://github.com/QingdaoU/JudgeServer.git
|
||||
cd JudgeServer
|
||||
# modify
|
||||
docker buildx build . -t oj-judge --load
|
||||
```
|
||||
|
||||
2. Download [languages.py](https://raw.githubusercontent.com/QingdaoU/OnlineJudge/master/judge/languages.py) to the deploy folder.
|
||||
|
||||
3. Edit and mount the languages.py
|
||||
|
||||
```yaml
|
||||
services:
|
||||
# ...
|
||||
oj-backend:
|
||||
# ...
|
||||
volumes:
|
||||
- ./data/backend:/data
|
||||
- ./languages.py:/app/judge/languages.py:ro
|
||||
```
|
||||
|
||||
4. Start containers
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
5. Overwrite judge language config in database from mounted languages.py
|
||||
|
||||
```bash
|
||||
docker compose exec oj-backend python manage.py shell <<EOF
|
||||
from options.options import SysOptions
|
||||
SysOptions.reset_languages()
|
||||
EOF
|
||||
```
|
41
en/management/backup_and_restore.md
Normal file
41
en/management/backup_and_restore.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Backup & Restore
|
||||
|
||||
## Database
|
||||
|
||||
- backup
|
||||
|
||||
```bash
|
||||
docker compose exec postgres pg_dumpall -c -U onlinejudge > "db-$(date -Iseconds).sql"
|
||||
|
||||
# zstd
|
||||
docker compose exec postgres pg_dumpall -c -U onlinejudge | zstd -o "db-$(date -Iseconds).sql.zst"
|
||||
```
|
||||
|
||||
- restore
|
||||
|
||||
```bash
|
||||
docker compose exec postgres psql < "<backup file>"
|
||||
|
||||
# zstd
|
||||
zstd -d "<backup file>" | docker compose exec postgres psql
|
||||
```
|
||||
|
||||
## Test case
|
||||
|
||||
- backup
|
||||
|
||||
```bash
|
||||
tar -cf "testcase-$(date -Iseconds).tar" data/backend/test_case
|
||||
|
||||
# zstd
|
||||
tar --zstd -cf "testcase-$(date -Iseconds).tar.zst" data/backend/test_case
|
||||
```
|
||||
|
||||
- restore
|
||||
|
||||
```bash
|
||||
tar -xf "<backup file>"
|
||||
|
||||
# zstd
|
||||
tar --zstd -xf "<backup file>"
|
||||
```
|
25
index.html
25
index.html
@ -15,7 +15,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="//cdn.jsdelivr.net/npm/mermaid@9.4.3/dist/mermaid.min.js"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/mermaid@10.9.0/dist/mermaid.min.js"></script>
|
||||
<script>
|
||||
let num = 0;
|
||||
mermaid.initialize({ startOnLoad: false });
|
||||
@ -29,15 +29,26 @@
|
||||
},
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: function(code, lang) {
|
||||
code(code, lang) {
|
||||
// thanks https://github.com/HugoDF/docsify-mermaid-10
|
||||
if (lang === "mermaid") {
|
||||
return (
|
||||
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
|
||||
);
|
||||
const svgName = `mermaid-svg-${num++}`;
|
||||
const MERMAID_CONTAINER_ID = `${svgName}-container`;
|
||||
mermaid.render(svgName, code).then(({ svg }) => {
|
||||
const containerElement = document.querySelector(
|
||||
`#${MERMAID_CONTAINER_ID}`
|
||||
);
|
||||
if (containerElement) {
|
||||
containerElement.innerHTML = svg;
|
||||
} else {
|
||||
console.error(`Error: #${MERMAID_CONTAINER_ID} not found`);
|
||||
}
|
||||
});
|
||||
return `<div class="mermaid" id="${MERMAID_CONTAINER_ID}"></div>`;
|
||||
}
|
||||
return this.origin.code.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user