mirror of
https://github.com/QingdaoU/OnlineJudgeDeploy.git
synced 2024-12-28 23:41:51 +00:00
2.0版部署文档
This commit is contained in:
parent
86b23625a0
commit
579ba4e072
27
README.md
27
README.md
@ -4,7 +4,7 @@
|
||||
|
||||
- 必要的工具 `apt-get update && apt-get install -y vim python-pip curl git`
|
||||
- 安装 docker `curl -sSL https://get.daocloud.io/docker | sh`
|
||||
- 安装 docker-compose `LC_CTYPE= pip install docker-compose`
|
||||
- 安装 docker-compose `pip install docker-compose`
|
||||
|
||||
## Windows 系统安装基础环境
|
||||
|
||||
@ -23,20 +23,27 @@ Windows 下面安装会有很多坑,经过测试时,Win10 x64下的 `PowerSh
|
||||
|
||||
请选择磁盘空间富余的位置,运行下面的命令
|
||||
|
||||
`git clone https://github.com/QingdaoU/OnlineJudgeDeploy.git && cd OnlineJudgeDeploy`
|
||||
```sh
|
||||
git clone https://github.com/QingdaoU/OnlineJudgeFE.git
|
||||
git clone -b 2.0 https://github.com/QingdaoU/OnlineJudge.git
|
||||
git clone -b 2.0 https://github.com/QingdaoU/OnlineJudgeDeploy.git
|
||||
cd OnlineJudgeDeploy
|
||||
```
|
||||
|
||||
然后编辑 `docker-compose.yml` 第28行为自定义的密码,比如`rpc_token=123456`
|
||||
然后编辑 `docker-compose.yml` 将41行的`JUDGE_SERVER_TOKEN`和第68行的`TOKEN`修改为自定义的值, 两处值必须相同且`=`前后不能有空格
|
||||
|
||||
## 启动服务
|
||||
|
||||
运行 `docker-compose up -d` ,不需要其他的步骤,大约一分钟之后 web 界面就可以访问了,默认开放80和443端口。其中443端口是自签名证书。
|
||||
运行 `docker-compose up -d` 根据网速情况,大约5到30分钟就可以自动搭建完成,全程无需人工干预。
|
||||
若想获悉安装进度,运行`docker-compose logs`查看安装日志,当显示结果中出现以下文字时
|
||||
```
|
||||
Congratulations, All have done without error.
|
||||
```
|
||||
表示安装已成功结束
|
||||
|
||||
注意,对于非root用户,请用 `sudo -E docker-compose up -d`,否则不会传递当前的 `$PWD` 环境变量。
|
||||
|
||||
## 这就结束了
|
||||
## 尽情享用吧
|
||||
|
||||
超级管理员用户名是root,默认密码是`password@root`,请及时修改。
|
||||
|
||||
登录`/admin`,添加一个判题服务器,地址为`judger`,端口为`8080`,密码是上面自定义的`rpc_token`。
|
||||
|
||||
修改`custom_settings.py`可以自定义站点信息。
|
||||
通过浏览器访问服务器的80端口,就可以开始使用了
|
||||
后台管理默认路径为`/admin`, 安装过程中自动添加的超级管理员用户名为`root`,密码为`rootroot`, 请务必及时修改。
|
||||
|
@ -1,22 +0,0 @@
|
||||
# coding=utf-8
|
||||
import os
|
||||
|
||||
# Run `docker-compose restart` after changing this file
|
||||
|
||||
WEBSITE_INFO = {"website_name": u"example1大学 OnlineJudge",
|
||||
"website_name_shortcut": u"example oj",
|
||||
"website_footer": u"example大学foobar学院 <a href=\"http://www.miibeian.gov.cn/\">京ICP备233333号-1</a>",
|
||||
# url结尾没有/
|
||||
"url": u"http://your-domain-or-ip.com"}
|
||||
|
||||
|
||||
# https://github.com/QingdaoU/OnlineJudge/wiki/SMTP
|
||||
SMTP_CONFIG = {"smtp_server": "smtp.domain.com",
|
||||
"email": "noreply@domain.com",
|
||||
"password": "your_password",
|
||||
"port": 25,
|
||||
"tls": True}
|
||||
|
||||
|
||||
# 是否显示所有人的提交, False就只显示自己的
|
||||
SHOW_ALL_SUBMISSIONS_LIST = False
|
@ -1,51 +1,80 @@
|
||||
version: "2"
|
||||
version: "3"
|
||||
services:
|
||||
oj_redis:
|
||||
image: redis:3.0-alpine
|
||||
container_name: oj_redis
|
||||
restart: always
|
||||
volumes:
|
||||
- $PWD/data/redis:/data
|
||||
|
||||
oj_mysql:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/qduoj/mysql
|
||||
container_name: oj_mysql
|
||||
restart: always
|
||||
volumes:
|
||||
- $PWD/data/mysql:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=MYSQL_PASSWORD_AAA
|
||||
redis:
|
||||
image: redis:4.0-alpine
|
||||
container_name: oj_redis
|
||||
restart: always
|
||||
volumes:
|
||||
- $PWD/data/redis:/data
|
||||
|
||||
postgres:
|
||||
image: postgres:10-alpine
|
||||
container_name: oj_postgres
|
||||
restart: always
|
||||
volumes:
|
||||
- $PWD/data/postgres:/var/lib/postgresql/data
|
||||
environment:
|
||||
- POSTGRES_DB=onlinejudge
|
||||
- POSTGRES_USER=onlinejudge
|
||||
- POSTGRES_PASSWORD=onlinejudge
|
||||
|
||||
oj-backend:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/onlinejudge/oj_backend
|
||||
container_name: oj_backend
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
volumes:
|
||||
- $PWD/OnlineJudge:/app
|
||||
- $PWD/log:/data/log
|
||||
- $PWD/data/test_case:/data/test_case
|
||||
- $PWD/data/avatar:/data/avatar
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- REDIS_PORT=6379
|
||||
- POSTGRES_HOST=postgres
|
||||
- POSTGRES_PORT=5432
|
||||
- POSTGRES_DB=onlinejudge
|
||||
- POSTGRES_USER=onlinejudge
|
||||
- POSTGRES_PASSWORD=onlinejudge
|
||||
- JUDGE_SERVER_TOKEN=CHANGE_THIS
|
||||
|
||||
judger:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/qduoj/judger
|
||||
container_name: judger
|
||||
restart: always
|
||||
volumes:
|
||||
- $PWD/data/test_case:/var/judger/test_case
|
||||
- $PWD/data/log:/var/judger/code/judge/log
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- rpc_token={YOUR_PASSWORD}
|
||||
|
||||
oj_web_server:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/qduoj/oj_web_server
|
||||
container_name: oj_web_server
|
||||
restart: always
|
||||
links:
|
||||
- oj_mysql
|
||||
- oj_redis
|
||||
- judger
|
||||
volumes:
|
||||
- $PWD/data/test_case:/code/test_case
|
||||
- $PWD/data/upload:/code/upload
|
||||
- $PWD/data/log:/code/log
|
||||
- $PWD/data/ssl:/code/ssl
|
||||
- $PWD/custom_settings.py:/code/oj/custom_settings.py
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- oj_env=server
|
||||
- MYSQL_ENV_MYSQL_USER=root
|
||||
- MYSQL_ENV_MYSQL_ROOT_PASSWORD=MYSQL_PASSWORD_AAA
|
||||
ports:
|
||||
- "0.0.0.0:80:80"
|
||||
- "0.0.0.0:443:443"
|
||||
judge-server:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/onlinejudge/judge_server
|
||||
container_name: judge_server
|
||||
read_only: true
|
||||
depends_on:
|
||||
- oj-backend
|
||||
cap_drop:
|
||||
- SETPCAP
|
||||
- MKNOD
|
||||
- NET_BIND_SERVICE
|
||||
- SYS_CHROOT
|
||||
- SETFCAP
|
||||
- FSETID
|
||||
tmpfs:
|
||||
- /tmp
|
||||
- /judger_run:exec,mode=777
|
||||
- /spj:exec,mode=777
|
||||
volumes:
|
||||
- $PWD/data/test_case:/test_case:ro
|
||||
- $PWD/log:/log
|
||||
- $PWD/JudgeServer/server:/code:ro
|
||||
environment:
|
||||
- service_url=http://judge-server:8080
|
||||
- OJ_WEB_SERVER_PORT_8080_TCP_ADDR=oj-backend
|
||||
- OJ_WEB_SERVER_PORT_8080_TCP_PORT=8080
|
||||
- TOKEN=CHANGE_THIS
|
||||
|
||||
oj-frontend:
|
||||
image: registry.cn-hangzhou.aliyuncs.com/onlinejudge/oj_frontend
|
||||
container_name: oj_frontend
|
||||
depends_on:
|
||||
- oj-backend
|
||||
volumes:
|
||||
- $PWD/OnlineJudgeFE:/OJ_FE
|
||||
- $PWD/data/avatar:/data/avatar
|
||||
- $PWD/log:/var/log/nginx
|
||||
ports:
|
||||
- "0.0.0.0:80:80"
|
||||
|
Loading…
Reference in New Issue
Block a user