File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## 首要条件
22
3- ## docker 安装方式仅适用于可熟练使用 docker-compose 维护容器的用户,并要求您有基础的错误排查能力
4- ## 该安装模块非官方维护,即不会提供任何技术支持
5- ## 普通用户请务必使用自动脚本安装,这可大大提高您一次成功的可能性
3+ > [ !WARNING]
4+ > docker 安装方式仅适用于可熟练使用 docker-compose 维护容器的用户,并要求您有基础的错误排查能力
5+ > 该安装模块非官方维护,即不会提供任何技术支持
6+ > 普通用户请务必使用自动脚本安装,这可大大提高您一次成功的可能性
67
7- 本文假设您已经安装了` Docker ` 、` docker-compose ` 、` git ` 。
8+ 本文假设您已经安装了 ` docker ` 、` docker-compose ` 、` git ` , ** 未安装请先安装 ** 。
89
9- ** 未安装请先安装** 。
10-
11- ## 开始安装(不建议使用Windows)
10+ ## 开始安装(请使用 Linux)
1211
13121 . 请选择磁盘空间富裕的位置,运行下面的命令。
1413
1817
1918 ` docker-compose up -d `
2019
21- 因为是在本机制作docker镜像,所以耗时可能会比较久。根据网速情况,大约5到30分钟就可以自动搭建完成 ,全程无需人工干预。
20+ 在本机制作 docker 镜像耗时可能会比较长。根据网络情况,大约 5 到 30 分钟就可以自动搭建完成 ,全程无需人工干预。
2221
23- 等命令执行完成,然后运行 ` docker ps -a ` ,当看到所有的容器的状态没有` Exited (x) xxx ` 就代表 OJ 已经启动成功。
22+ 命令执行完成后运行 ` docker ps -a ` ,当看到所有的容器的状态没有 ` Exited (x) xxx ` 就代表 OJ 已经启动成功。
2423
2524## 注意
2625
27- 安装过程中,会默认注册一个超级管理员账号,用来做测评账号 。用户名:` root ` ,密码:` rootroot ` 。** 请务必及时修改密码** 。修改该账号密码后,请修改` data/ judge/config/ judge.yaml` 中的 ` password ` 。否则可能会无法测评。
26+ 安装过程中,会默认注册一个 uid 为 2 的测评账号 。用户名:` judge ` ,密码:` examplepassword ` 。** 请务必及时修改密码** 。修改该账号密码后,请修改 ` judge/judge.yaml ` 中的 ` password ` 。否则可能会无法测评。
2827
2928## 测评机默认编译器
3029
31- 测评机默认安装了以下几个编译器,如有需要,请自行安装。
32-
33- 编译器列表:
30+ 测评机默认安装了以下编译器,如有需要,请自行安装:
3431
35321 . gcc
36332 . python3
37343 . g++
38354 . fp-compiler
39- 5 . openjdk-8-jdk-headless
40- 6 . python
41- 7 . php7.0-cli
42- 8 . rustc
43- 9 . haskell-platform
44- 10 . libjavascriptcoregtk-4.0-bin
45- 11 . golang
46- 12 . ruby
47- 13 . mono-runtime
48- 14 . mono-mcs
49-
36+ 5 . openjdk-17-jdk-headless
37+ 6 . php-cli
38+ 7 . rustc
39+ 8 . ghc
40+ 9 . libjavascriptcoregtk-4.0-bin
41+ 10 . golang
42+ 11 . ruby
43+ 12 . mono-runtime
44+ 13 . mono-mcs
Original file line number Diff line number Diff line change 11FROM node:20
2- ADD ./entrypoint.sh /root/entrypoint.sh
3- RUN yarn global add pm2 hydrooj @hydrooj/ui-default
4- RUN chmod +x /root/entrypoint.sh && \
5- mkdir -p /root/.hydro
6- ENTRYPOINT /root/entrypoint.sh
2+
3+ COPY ./entrypoint.sh /root/entrypoint.sh
4+
5+ RUN yarn global add pm2 hydrooj @hydrooj/ui-default && \
6+ chmod +x /root/entrypoint.sh
7+
8+ ENTRYPOINT ["/root/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1313if [ ! -f " $ROOT /first" ]; then
1414 echo " for marking use only!" > " $ROOT /first"
1515
16- hydrooj cli user create systemjudge@systemjudge.local root rootroot
17- hydrooj cli user setSuperAdmin 2
16+ hydrooj cli user create systemjudge@systemjudge.local judge examplepassword 2
17+ hydrooj cli user setJudge 2
18+ hydrooj cli system set server.host 0.0.0.0
1819fi
1920
2021pm2-runtime start hydrooj
Original file line number Diff line number Diff line change 1- version : ' 3.7'
2-
31services :
4-
52 # Warning: mongodb here is not password-protected.
63 # DO NOT EXPOSE THIS SERVICE TO THE PUBLIC.
74 oj-mongo :
@@ -21,14 +18,24 @@ services:
2118 - ./data/file:/data/file
2219 - ./data/backend:/root/.hydro
2320 ports :
24- - " 0.0.0.0:80:8888" # In docker mode, change THIS port instead of port in system settings!
21+ - " 80:8888" # In docker mode, change THIS port instead of port in system settings!
22+ healthcheck :
23+ test : curl --silent --fail http://localhost:8888/status >/dev/null || exit 1
24+ interval : 1m30s
25+ timeout : 10s
26+ retries : 3
27+ start_period : 30s
28+ start_interval : 5s
2529
2630 oj-judge :
2731 build : ./judge
2832 container_name : oj-judge
2933 restart : always
3034 privileged : true
3135 depends_on :
32- - oj-backend
36+ oj-backend :
37+ condition : service_healthy
38+ restart : true
3339 volumes :
34- - ./data/judge:/root/.config/hydro
40+ - ./judge/judge.yaml:/root/.hydro/judge.yaml
41+ - ./judge/mount.yaml:/root/.hydro/mount.yaml
Original file line number Diff line number Diff line change 11FROM node:20
22
3+ COPY ./entrypoint.sh /root/entrypoint.sh
4+
35RUN apt-get -qq update && \
46 apt-get install -y \
57 gcc \
68 python3 \
79 g++ \
810 fp-compiler \
9- openjdk-8-jdk-headless \
10- python \
11- php7.0-cli \
11+ openjdk-17-jdk-headless \
12+ php-cli \
1213 rustc \
13- haskell-platform \
14+ ghc \
1415 libjavascriptcoregtk-4.0-bin \
1516 golang \
1617 ruby \
1718 mono-runtime \
18- mono-mcs
19-
20- ADD ./entrypoint.sh /root/entrypoint.sh
21- ADD ./judge.yaml /root/judge.yaml
22- RUN chmod +x /root/entrypoint.sh
19+ mono-mcs && \
20+ chmod +x /root/entrypoint.sh && \
21+ # node is at /usr/local/bin but hydrojudge will find it at /usr/bin
22+ # so make a symlink to it
23+ ln -s /usr/local/bin/node /usr/bin/node
2324
2425RUN yarn global add pm2 @hydrooj/hydrojudge && \
25- wget https://github.com/criyle/go-judge/releases/download/v1.8.0 /go-judge_1.8.0_linux_amd64 -O /usr/bin/sandbox && \
26+ wget https://github.com/criyle/go-judge/releases/download/v1.9.4 /go-judge_1.9.4_linux_amd64v3 -O /usr/bin/sandbox && \
2627 chmod +x /usr/bin/sandbox
2728
28- ENTRYPOINT /root/entrypoint.sh
29+ ENTRYPOINT [ " /root/entrypoint.sh" ]
Original file line number Diff line number Diff line change 11#! /bin/sh
22
3- pm2 start sandbox
3+ pm2 start sandbox -- -mount-conf /root/.hydro/mount.yaml
44pm2-runtime start hydrojudge
Original file line number Diff line number Diff line change 22 localhost :
33 type : hydro
44 server_url : http://oj-backend:8888/
5- uname : root
6- password : rootroot
7- detail : true
5+ uname : judge
6+ password : examplepassword
7+ detail : full
Original file line number Diff line number Diff line change 1+ mount :
2+ - type : bind
3+ source : /bin
4+ target : /bin
5+ readonly : true
6+ - type : bind
7+ source : /lib
8+ target : /lib
9+ readonly : true
10+ - type : bind
11+ source : /lib64
12+ target : /lib64
13+ readonly : true
14+ - type : bind
15+ source : /usr
16+ target : /usr
17+ readonly : true
18+ - type : bind
19+ source : /etc
20+ target : /etc
21+ readonly : true
22+ - type : bind
23+ source : /var
24+ target : /var
25+ readonly : true
26+ - type : bind
27+ source : /dev/null
28+ target : /dev/null
29+ - type : bind
30+ source : /dev/urandom
31+ target : /dev/urandom
32+ - type : bind
33+ source : /dev/zero
34+ target : /dev/zero
35+ - type : tmpfs
36+ target : /w
37+ data : size=512m,nr_inodes=8k
38+ - type : tmpfs
39+ target : /tmp
40+ data : size=512m,nr_inodes=8k
41+ proc : true
42+ workDir : /w
43+ hostName : executor_server
44+ domainName : executor_server
45+ uid : 1536
46+ gid : 1536
You can’t perform that action at this time.
0 commit comments