From 65fe5dbda71ff5f4c241393ee9779c2f3efdbd4b Mon Sep 17 00:00:00 2001 From: virusdefender Date: Sun, 11 Jun 2017 16:12:35 +0800 Subject: [PATCH] update --- README.md | 11 +++++++++++ custom_settings.py | 21 +++++++++++++++++++++ docker-compose.yml | 16 +++++++++++----- 3 files changed, 43 insertions(+), 5 deletions(-) create mode 100644 README.md create mode 100644 custom_settings.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..3d10e62 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +这是一个新的部署脚本,应该会非常方便了。之前的部署很多不科学的地方,大家可以测试下。 + +安装完 docker 和 docker-compose 之后,修改 docker-compose.yml 第28行为自定义的密码,比如`rpc_token=123456`。 + +然后 `docker-compose up -d` ,不需要其他的步骤,大约一分钟之后 web 界面就可以访问了,默认开放80和443端口。其中443端口是自签名证书。 + +超级管理员用户名是root,默认密码是`password@root`,请及时修改。 + +登录`/admin`,添加一个判题服务器,地址为judger,端口为8080,密码是上面自定义的`rpc_token`。 + +修改`custom_settings.py`可以自定义站点信息。 diff --git a/custom_settings.py b/custom_settings.py new file mode 100644 index 0000000..394113b --- /dev/null +++ b/custom_settings.py @@ -0,0 +1,21 @@ +# coding=utf-8 +import os + + +WEBSITE_INFO = {"website_name": u"example1大学 OnlineJudge", + "website_name_shortcut": u"example oj", + "website_footer": u"example大学foobar学院 京ICP备233333号-1", + # 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 diff --git a/docker-compose.yml b/docker-compose.yml index b87dd5b..d1cf54b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,20 +2,23 @@ version: "2" 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={YOUR_PASSWORD} + - MYSQL_ROOT_PASSWORD=MYSQL_PASSWORD_AAA judger: image: registry.cn-hangzhou.aliyuncs.com/qduoj/judger + container_name: judger restart: always volumes: - $PWD/data/test_case:/var/judger/test_case @@ -23,10 +26,10 @@ services: environment: - TZ=Asia/Shanghai - rpc_token={YOUR_PASSWORD} - ports: - - "9000:8080" + oj_web_server: image: registry.cn-hangzhou.aliyuncs.com/qduoj/oj_web_server + container_name: oj_web_server restart: always links: - oj_mysql @@ -36,10 +39,13 @@ services: - $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={YOUR_PASSWORD} + - MYSQL_ENV_MYSQL_ROOT_PASSWORD=MYSQL_PASSWORD_AAA ports: - - "0.0.0.0:80:8001" + - "0.0.0.0:80:80" + - "0.0.0.0:443:443"