├── etc ├── mysql │ ├── my.cnf.d │ │ └── .gitkeep │ └── my.cnf ├── nginx │ ├── nginx.conf │ ├── ssl │ │ ├── localhost.crt │ │ └── localhost.key │ └── conf.d │ │ └── default.conf └── backend │ └── config.sample.json ├── docker ├── judger │ ├── VERSION │ ├── base │ │ └── Dockerfile │ └── full │ │ └── Dockerfile └── judger-env │ ├── VERSION │ ├── full │ └── Dockerfile │ └── base │ └── Dockerfile ├── data ├── mysql │ └── .gitignore ├── redis │ └── .gitignore └── backend │ └── .gitignore ├── shell ├── base-env.sh ├── full-env.sh ├── recreate-container.sh ├── download-latest-frontend.sh ├── download-latest-frontend.local.sh ├── download-latest-frontend.zh.sh ├── download-latest-frontend.zh.local.sh └── color-shell.sh ├── .gitmodules ├── judge └── etc │ ├── java0.policy │ ├── config.sample.json │ ├── judge.conf │ ├── language.json │ └── compile.json ├── .gitignore ├── restart.sh ├── .env.example ├── .env.example.full ├── update-web.sh ├── stop.sh ├── update-backend.sh ├── start.sh ├── docs ├── INSTALL_DOCKER.zh-cn.md └── INSTALL_DOCKER.md ├── update-local.sh ├── update.sh ├── update-full.sh ├── init-env.sh ├── init-env-full.sh ├── .github └── workflows │ ├── build_judger.yml │ └── build_judge_env.yml ├── docker-compose.example.yml ├── README.zh-cn.md ├── README.md ├── LICENSE └── sql └── structure.sql /etc/mysql/my.cnf.d/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docker/judger/VERSION: -------------------------------------------------------------------------------- 1 | 1.7.13 2 | -------------------------------------------------------------------------------- /docker/judger-env/VERSION: -------------------------------------------------------------------------------- 1 | 1.2.3 2 | -------------------------------------------------------------------------------- /data/mysql/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /data/redis/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /data/backend/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /shell/base-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cp .env.example .env && \ 3 | cp docker-compose.example.yml docker-compose.yml -------------------------------------------------------------------------------- /shell/full-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cp .env.example.full .env && \ 3 | cp docker-compose.example.yml docker-compose.yml -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "wwwroot/html"] 2 | path = wwwroot/html 3 | url = https://github.com/ryanlee2014/CUP-Online-Judge-CDN.git 4 | -------------------------------------------------------------------------------- /judge/etc/java0.policy: -------------------------------------------------------------------------------- 1 | grant { 2 | permission java.io.FilePermission "./-", "read,write"; 3 | permission java.io.FilePermission "/usr/lib/jvm", "read"; 4 | }; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | *.log 3 | judge/*.csv 4 | judge/*.py 5 | docker-compose.yml 6 | log/nginx/* 7 | judge/data/* 8 | log/**/*.log 9 | judge/etc/config.json 10 | etc/backend/config.json 11 | data/submission 12 | -------------------------------------------------------------------------------- /shell/recreate-container.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/color-shell.sh 4 | echo -e "${BGreen}Recreate docker container${Color_Off}" && \ 5 | docker-compose up -d --no-deps --build --force-recreate --remove-orphans -------------------------------------------------------------------------------- /restart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | 4 | source "$BASEDIR"/shell/color-shell.sh 5 | 6 | echo -e "${BGreen}Restart all containers.${Color_Off}" && \ 7 | bash "$BASEDIR"/stop.sh && \ 8 | bash "$BASEDIR"/start.sh && \ 9 | echo -e "${BGreen}All containers have been restarted.${Color_Off}" || \ 10 | echo -e "${BRed}Failed to restart all containers.${Color_Off}" -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | TZ=Asia/Shanghai 2 | 3 | JUDGER_VERSION=ryanlee2014/cupoj-judger:1.7.13 4 | BACKEND_VERSION=ryanlee2014/cupoj-backend:3.30.27 5 | WEBSOCKET_VERSION=ryanlee2014/cupoj-websocket:3.30.27 6 | LANGUAGE_SERVER_VERSION=ryanlee2014/cupoj-language-server:1.0.2 7 | NGINX_VERSION=metowolf/nginx:1.17.10 8 | REDIS_VERSION=redis:6.0.2-alpine 9 | MYSQL_VERSION=mysql/mysql-server:8.0.20 10 | MYSQL_ROOT_PASSWORD=root 11 | -------------------------------------------------------------------------------- /.env.example.full: -------------------------------------------------------------------------------- 1 | TZ=Asia/Shanghai 2 | 3 | JUDGER_VERSION=ryanlee2014/cupoj-judger:1.7.13-full 4 | BACKEND_VERSION=ryanlee2014/cupoj-backend:3.30.27 5 | WEBSOCKET_VERSION=ryanlee2014/cupoj-websocket:3.30.27 6 | LANGUAGE_SERVER_VERSION=ryanlee2014/cupoj-language-server:1.0.2 7 | NGINX_VERSION=metowolf/nginx:1.17.10 8 | REDIS_VERSION=redis:6.0.2-alpine 9 | MYSQL_VERSION=mysql/mysql-server:8.0.20 10 | MYSQL_ROOT_PASSWORD=root 11 | -------------------------------------------------------------------------------- /update-web.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | REGION="$1" 6 | 7 | FRONTEND_MIRROR="" 8 | 9 | LOCAL_FRONTEND_MIRROR=".local" 10 | 11 | if [[ "$REGION" != "" ]]; then 12 | FRONTEND_MIRROR=".$REGION" 13 | fi 14 | 15 | FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR$LOCAL_FRONTEND_MIRROR.sh" 16 | 17 | chmod +x $FRONTEND_SHELL 18 | 19 | echo -e "${BGreen}Update git repositories${Color_Off}" && \ 20 | bash $FRONTEND_SHELL 21 | -------------------------------------------------------------------------------- /stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | 4 | source "$BASEDIR"/shell/color-shell.sh 5 | 6 | if [[ "$#" != 0 ]]; then 7 | for var in "$@" 8 | do 9 | echo -e "${BGreen}Stopping $var${Color_Off}" 10 | docker-compose stop "$var" && \ 11 | echo -e "${BGreen}$var has been stopped.${Color_Off}" || \ 12 | echo -e "${BRed}Failed to stop $var${Color_Off}" 13 | done 14 | else 15 | echo -e "${BGreen}Stop all containers.${Color_Off}" 16 | docker-compose stop 17 | fi 18 | 19 | echo -e "${BGreen}Stopped.${Color_Off}" -------------------------------------------------------------------------------- /judge/etc/config.sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "hostname": "", 3 | "username": "", 4 | "password": "", 5 | "db_name": "jol", 6 | "port": 3306, 7 | "running": 8, 8 | "sleep_time": 4, 9 | "total": 1, 10 | "mod": 0, 11 | "java_time_bonus": 2, 12 | "java_memory_bonus": 128, 13 | "java_xms": "-Xms64M", 14 | "java_xmx": "-Xmx512M", 15 | "sim_enable": 1, 16 | "full_diff": 1, 17 | "judger_name": "DOCKER", 18 | "shm_run": 0, 19 | "use_max_time": 1, 20 | "use_ptrace": 1, 21 | "all_test_mode": 1, 22 | "enable_parallel": 0 23 | } 24 | -------------------------------------------------------------------------------- /update-backend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | REGION="$1" 6 | 7 | LOCAL_FRONTEND="$2" 8 | 9 | echo -e "${BGreen}Update git repositories${Color_Off}" && \ 10 | git pull --rebase && \ 11 | echo -e "${BGreen}Update .env docker-compose.yml${Color_Off}" && \ 12 | bash shell/base-env.sh && \ 13 | bash shell/recreate-container.sh && \ 14 | bash restart.sh && \ 15 | echo -e "Please access to server from:" 16 | echo -e "${BGreen}" 17 | for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') 18 | do 19 | echo -e "http://$i:8080" 20 | done 21 | echo -e "${Color_Off}"; 22 | -------------------------------------------------------------------------------- /judge/etc/judge.conf: -------------------------------------------------------------------------------- 1 | OJ_HOST_NAME= 2 | OJ_USER_NAME= 3 | OJ_PASSWORD= 4 | OJ_DB_NAME=jol 5 | OJ_PORT_NUMBER=3306 6 | OJ_RUNNING=8 7 | OJ_SLEEP_TIME=4 8 | OJ_TOTAL=1 9 | OJ_MOD=0 10 | OJ_JAVA_TIME_BONUS=2 11 | OJ_JAVA_MEMORY_BONUS=128 12 | OJ_JAVA_XMS=-Xms64M 13 | OJ_JAVA_XMX=-Xmx512M 14 | OJ_SIM_ENABLE=1 15 | OJ_FULL_DIFF=1 16 | OJ_HTTP_JUDGE=0 17 | OJ_HTTP_BASEURL=http://127.0.0.1/JudgeOnline 18 | OJ_HTTP_USERNAME=RATH 19 | OJ_HTTP_PASSWORD=admin 20 | OJ_REDISENABLE=0 21 | OJ_REDISSERVER=127.0.0.1 22 | OJ_REDISPORT=6379 23 | OJ_REDISAUTH=123456 24 | OJ_REDISQNAME=hustoj 25 | OJ_OI_MODE=1 26 | OJ_SHM_RUN=0 27 | OJ_USE_MAX_TIME=1 28 | OJ_LANG_SET=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17,18,19,20,21,23,24 29 | -------------------------------------------------------------------------------- /judge/etc/language.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": "c11", 3 | "1": "cpp17", 4 | "2": "pascal", 5 | "3": "java", 6 | "4": "ruby", 7 | "5": "bash", 8 | "6": "python2", 9 | "7": "php", 10 | "8": "perl", 11 | "9": "csharp", 12 | "10": "objectivec", 13 | "11": "freebasic", 14 | "12": "schema", 15 | "13": "clang", 16 | "14": "clangpp", 17 | "15": "lua", 18 | "16": "javascript", 19 | "17": "go", 20 | "18": "python3", 21 | "19": "cpp11", 22 | "20": "cpp98", 23 | "21": "c99", 24 | "22": "kotlin", 25 | "23": "java8", 26 | "24": "java7", 27 | "25": "pypy", 28 | "26": "pypy3", 29 | "27": "java6", 30 | "28": "clang11", 31 | "29": "clangpp17", 32 | "30": "cpp20", 33 | "31": "kotlinnative" 34 | } -------------------------------------------------------------------------------- /shell/download-latest-frontend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR=`pwd` 4 | 5 | LATEST_VERSION=$(curl "https://api.github.com/repos/ryanlee2014/CUP-Online-Judge-CDN/tags" | grep '"name":' | sed -E 's/.*"([^"]+)".*/\1/' | head -n 1) 6 | 7 | rm -rf /tmp/cupoj-frontend 8 | 9 | mkdir /tmp/cupoj-frontend 10 | 11 | cd /tmp/cupoj-frontend 12 | 13 | wget "https://api.github.com/repos/ryanlee2014/CUP-Online-Judge-CDN/zipball/$LATEST_VERSION" 14 | 15 | unzip "$LATEST_VERSION" 16 | 17 | UNZIP_DIR_NAME=$(ls | grep ryan) 18 | 19 | cd ./$UNZIP_DIR_NAME 20 | 21 | rm -rf "$BASEDIR/wwwroot/html/*" 22 | 23 | mkdir -p "$BASEDIR/wwwroot/html" 24 | 25 | cp -r * "$BASEDIR/wwwroot/html" 26 | 27 | cd "$BASEDIR" 28 | 29 | rm -rf /tmp/cupoj-frontend 30 | -------------------------------------------------------------------------------- /shell/download-latest-frontend.local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR=`pwd` 4 | 5 | LATEST_VERSION=$(curl "https://api.github.com/repos/ryanlee2014/CUP-Online-Judge-Frontend-Local/tags" | grep '"name":' | sed -E 's/.*"([^"]+)".*/\1/' | head -n 1) 6 | 7 | rm -rf /tmp/cupoj-frontend 8 | 9 | mkdir /tmp/cupoj-frontend 10 | 11 | cd /tmp/cupoj-frontend 12 | 13 | wget "https://api.github.com/repos/ryanlee2014/CUP-Online-Judge-Frontend-Local/zipball/$LATEST_VERSION" 14 | 15 | unzip "$LATEST_VERSION" 16 | 17 | UNZIP_DIR_NAME=$(ls | grep ryan) 18 | 19 | cd ./$UNZIP_DIR_NAME 20 | 21 | rm -rf "$BASEDIR/wwwroot/html/*" 22 | 23 | mkdir -p "$BASEDIR/wwwroot/html" 24 | 25 | cp -r * "$BASEDIR/wwwroot/html" 26 | 27 | cd "$BASEDIR" 28 | 29 | rm -rf /tmp/cupoj-frontend 30 | -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | if [[ "$#" != 0 ]]; then 6 | for var in "$@" 7 | do 8 | echo -e "${BGreen}Starting $var${Color_Off}" 9 | docker-compose start "$var" && \ 10 | echo -e "${BGreen}$var has been started.${Color_Off}" || \ 11 | echo -e "${BRed}Failed to start $var${Color_Off}"; 12 | done 13 | else 14 | echo -e "${BGreen}Start containers${Color_Off}" && \ 15 | docker-compose start mysql redis cupoj-language-server && \ 16 | docker-compose start cupoj-backend cupoj-judger && \ 17 | docker-compose start cupoj-websocket && \ 18 | docker-compose start nginx && \ 19 | echo -e "${BGreen}All Containers have been started.${Color_Off}" 20 | fi 21 | 22 | -------------------------------------------------------------------------------- /docs/INSTALL_DOCKER.zh-cn.md: -------------------------------------------------------------------------------- 1 | # 安装必要的Docker依赖 2 | 3 | ## 多语言 4 | [English](/docs/INSTALL_DOCKER.md) 5 | 6 | ## Linux(Ubuntu) 7 | 1. 安装必要的Linux依赖软件 8 | ```bash 9 | sudo apt-get update && sudo apt-get install -y vim python-pip curl git 10 | pip install docker-compose 11 | ``` 12 | 13 | 2. 安装Docker软件 14 | 15 | * 中国大陆用户使用的安装命令: 16 | ```bash 17 | sudo curl -sSL https://get.daocloud.io/docker | sh 18 | ``` 19 | * 其他国家和地区使用的安装命令: 20 | ```bash 21 | sudo curl -sSL get.docker.com | sh 22 | ``` 23 | 24 | ## macOS 25 | 1. 安装 Homebrew 26 | ```bash 27 | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 28 | ``` 29 | 30 | 2. 安装 docker 和 docker-compose 31 | ```bash 32 | brew cask install docker 33 | ``` 34 | 35 | ## Windows(**不建议**) 36 | [Google](https://www.google.com)Lol -------------------------------------------------------------------------------- /shell/download-latest-frontend.zh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR=`pwd` 4 | 5 | LATEST_VERSION=$(curl "https://api.github.com/repos/ryanlee2014/CUP-Online-Judge-CDN/tags" | grep '"name":' | sed -E 's/.*"([^"]+)".*/\1/' | head -n 1) 6 | 7 | rm -rf /tmp/cupoj-frontend 8 | 9 | mkdir /tmp/cupoj-frontend 10 | 11 | cd /tmp/cupoj-frontend 12 | 13 | wget "https://shrill-pond-3e81.hunsh.workers.dev/https:/github.com/ryanlee2014/CUP-Online-Judge-CDN/archive/$LATEST_VERSION.zip" 14 | 15 | unzip "$LATEST_VERSION" 16 | 17 | mv ./CUP-Online-Judge-CDN-${LATEST_VERSION:1}/* ./ 18 | 19 | UNZIP_DIR_NAME=$(ls | grep ryan) 20 | 21 | cd ./$UNZIP_DIR_NAME 22 | 23 | rm -rf "$BASEDIR/wwwroot/html/*" 24 | 25 | mkdir -p "$BASEDIR/wwwroot/html" 26 | 27 | cp -r * "$BASEDIR/wwwroot/html" 28 | 29 | cd "$BASEDIR" 30 | 31 | rm -rf /tmp/cupoj-frontend 32 | -------------------------------------------------------------------------------- /etc/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | # from docker metowolf/nginx:1.17.5 2 | 3 | user nginx; 4 | worker_processes auto; 5 | 6 | error_log /var/log/nginx/error.log warn; 7 | pid /var/run/nginx.pid; 8 | 9 | 10 | events { 11 | worker_connections 1024; 12 | } 13 | 14 | 15 | http { 16 | include /etc/nginx/mime.types; 17 | default_type application/octet-stream; 18 | 19 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 20 | '$status $body_bytes_sent "$http_referer" ' 21 | '"$http_user_agent" "$http_x_forwarded_for"'; 22 | 23 | access_log /var/log/nginx/access.log main; 24 | 25 | sendfile on; 26 | #tcp_nopush on; 27 | 28 | keepalive_timeout 65; 29 | 30 | #gzip on; 31 | 32 | include /etc/nginx/conf.d/*.conf; 33 | } 34 | -------------------------------------------------------------------------------- /shell/download-latest-frontend.zh.local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BASEDIR=`pwd` 4 | 5 | LATEST_VERSION=$(curl "https://api.github.com/repos/ryanlee2014/CUP-Online-Judge-Frontend-Local/tags" | grep '"name":' | sed -E 's/.*"([^"]+)".*/\1/' | head -n 1) 6 | 7 | rm -rf /tmp/cupoj-frontend 8 | 9 | mkdir /tmp/cupoj-frontend 10 | 11 | cd /tmp/cupoj-frontend 12 | 13 | wget "https://shrill-pond-3e81.hunsh.workers.dev/https:/github.com/ryanlee2014/CUP-Online-Judge-Frontend-Local/archive/$LATEST_VERSION.zip" 14 | 15 | unzip "$LATEST_VERSION" 16 | 17 | mv ./CUP-Online-Judge-Frontend-Local-${LATEST_VERSION:1}/* ./ 18 | 19 | UNZIP_DIR_NAME=$(ls | grep ryan) 20 | 21 | cd ./$UNZIP_DIR_NAME 22 | 23 | rm -rf "$BASEDIR/wwwroot/html/*" 24 | 25 | mkdir -p "$BASEDIR/wwwroot/html" 26 | 27 | cp -r * "$BASEDIR/wwwroot/html" 28 | 29 | cd "$BASEDIR" 30 | 31 | rm -rf /tmp/cupoj-frontend 32 | -------------------------------------------------------------------------------- /docker/judger-env/full/Dockerfile: -------------------------------------------------------------------------------- 1 | # Pull base image. 2 | FROM ryanlee2014/cupoj-judger-env:1.2.3 3 | LABEL maintainer="Ryan Lee" \ 4 | email="gxlhybh@gmail.com" 5 | # Install Node.js 6 | RUN set -xe && \ 7 | apt-get install -y libncurses5 && \ 8 | useradd -m -u 1536 judge && \ 9 | cd ~ && \ 10 | wget https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-compiler-1.3.72.zip && \ 11 | unzip kotlin-compiler-1.3.72.zip && \ 12 | mv kotlinc /usr/lib/kotlinc && \ 13 | rm -rf kotlin-compiler-1.3.72.zip && \ 14 | cd ~ && \ 15 | echo 'fun main(args: Array) {println("Hello, World!")}' > hello.kt && \ 16 | /usr/lib/kotlin-native/bin/kotlinc hello.kt -o hello -opt && \ 17 | mv ~/.konan /home/judge/.konan && \ 18 | chgrp -R judge /home/judge/.konan && \ 19 | chown -R judge /home/judge/.konan && \ 20 | cd ~ 21 | 22 | CMD echo 'hello world!' 23 | -------------------------------------------------------------------------------- /docs/INSTALL_DOCKER.md: -------------------------------------------------------------------------------- 1 | # Install docker and etc. 2 | 3 | ## Translation 4 | [中文](/docs/INSTALL_DOCKER.zh-cn.md) 5 | 6 | ## Linux(Ubuntu) 7 | 1. Install necessary linux dependencies. 8 | ```bash 9 | sudo apt-get update && sudo apt-get install -y vim python-pip curl git 10 | pip install docker-compose 11 | ``` 12 | 13 | 2. Install docker 14 | 15 | * Install command for Mainland China users: 16 | ```bash 17 | sudo curl -sSL https://get.daocloud.io/docker | sh 18 | ``` 19 | * Other countries and regions: 20 | ```bash 21 | sudo curl -sSL get.docker.com | sh 22 | ``` 23 | 24 | ## macOS 25 | 1. Install Homebrew 26 | ```bash 27 | bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 28 | ``` 29 | 30 | 2. Install docker with docker-compose 31 | ```bash 32 | brew cask install docker 33 | ``` 34 | 35 | ## Windows(**Strongly not recommended**) 36 | [Google](https://www.google.com)Lol -------------------------------------------------------------------------------- /update-local.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | REGION="$1" 6 | 7 | FRONTEND_MIRROR="" 8 | 9 | LOCAL_FRONTEND_MIRROR=".local" 10 | 11 | if [[ "$REGION" != "" ]]; then 12 | FRONTEND_MIRROR=".$REGION" 13 | fi 14 | 15 | FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR$LOCAL_FRONTEND_MIRROR.sh" 16 | 17 | chmod +x $FRONTEND_SHELL 18 | 19 | echo -e "${BGreen}Update git repositories${Color_Off}" && \ 20 | git pull --rebase && \ 21 | bash $FRONTEND_SHELL && \ 22 | echo -e "${BGreen}Update .env docker-compose.yml${Color_Off}" && \ 23 | bash shell/base-env.sh && \ 24 | bash shell/recreate-container.sh && \ 25 | bash restart.sh && \ 26 | echo -e "Please access to server from:" 27 | echo -e "${BGreen}" 28 | for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') 29 | do 30 | echo -e "http://$i:8080" 31 | done 32 | echo -e "${Color_Off}"; 33 | -------------------------------------------------------------------------------- /etc/backend/config.sample.json: -------------------------------------------------------------------------------- 1 | { 2 | "mysql":{ 3 | "host": "mysql", 4 | "user": "root", 5 | "password": "root", 6 | "port": "3306", 7 | "database": "jol", 8 | "connectionLimit": 20 9 | }, 10 | "monitor": { 11 | "port": 3002 12 | }, 13 | "webhook": { 14 | "secret": "yoursecret" 15 | }, 16 | "ws":{ 17 | "http_client_port": 3000, 18 | "websocket_client_port": 3300, 19 | "client_port":3000, 20 | "judger_port":5100 21 | }, 22 | "judger":{ 23 | "oj_home":"/home/judge", 24 | "oj_judge_num":8, 25 | "address": "http://cupoj-judger:5110" 26 | }, 27 | "etc": { 28 | "compile_arguments": "/home/judge/etc/compile.json" 29 | }, 30 | "problem_upload_dest": { 31 | "dir": "/home/uploads" 32 | }, 33 | "website": { 34 | "dir": "/home/website/oj" 35 | }, 36 | "redis": { 37 | "host": "redis", 38 | "port": 6379 39 | }, 40 | "session_secret": "ojsecret", 41 | "salt": "salt", 42 | "init": false 43 | } -------------------------------------------------------------------------------- /update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | REGION="$1" 6 | 7 | LOCAL_FRONTEND="$2" 8 | 9 | FRONTEND_MIRROR="" 10 | 11 | LOCAL_FRONTEND_MIRROR="" 12 | 13 | if [[ "$REGION" != "" ]]; then 14 | FRONTEND_MIRROR=".$REGION" 15 | fi 16 | 17 | if [[ "$LOCAL_FRONTEND" != "" ]]; then 18 | LOCAL_FRONTEND_MIRROR=".local" 19 | fi 20 | 21 | FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR$LOCAL_FRONTEND_MIRROR.sh" 22 | 23 | chmod +x $FRONTEND_SHELL 24 | 25 | echo -e "${BGreen}Update git repositories${Color_Off}" && \ 26 | git pull --rebase && \ 27 | bash $FRONTEND_SHELL && \ 28 | echo -e "${BGreen}Update .env docker-compose.yml${Color_Off}" && \ 29 | bash shell/base-env.sh && \ 30 | bash shell/recreate-container.sh && \ 31 | bash restart.sh && \ 32 | echo -e "Please access to server from:" 33 | echo -e "${BGreen}" 34 | for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') 35 | do 36 | echo -e "http://$i:8080" 37 | done 38 | echo -e "${Color_Off}"; 39 | -------------------------------------------------------------------------------- /update-full.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | REGION="$1" 6 | 7 | LOCAL_FRONTEND="$2" 8 | 9 | FRONTEND_MIRROR="" 10 | 11 | LOCAL_FRONTEND_MIRROR="" 12 | 13 | if [[ "$REGION" != "" ]]; then 14 | FRONTEND_MIRROR=".$REGION" 15 | fi 16 | 17 | if [[ "$LOCAL_FRONTEND" != "" ]]; then 18 | LOCAL_FRONTEND_MIRROR=".local" 19 | fi 20 | 21 | FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR$LOCAL_FRONTEND_MIRROR.sh" 22 | 23 | chmod +x $FRONTEND_SHELL 24 | 25 | echo -e "${BGreen}Update git repositories${Color_Off}" && \ 26 | git pull --rebase && \ 27 | bash $FRONTEND_SHELL && \ 28 | echo -e "${BGreen}Update .env docker-compose.yml${Color_Off}" && \ 29 | bash shell/full-env.sh && \ 30 | bash shell/recreate-container.sh && \ 31 | bash restart.sh && \ 32 | echo -e "Please access to server from:" 33 | echo -e "${BGreen}" 34 | for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') 35 | do 36 | echo -e "http://$i:8080" 37 | done 38 | echo -e "${Color_Off}"; 39 | -------------------------------------------------------------------------------- /docker/judger/base/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Ubuntu Node.js Dockerfile 3 | # 4 | # https://github.com/dockerfile/ubuntu/blob/master/Dockerfile 5 | # https://docs.docker.com/examples/nodejs_web_app/ 6 | # 7 | 8 | # Pull base image. 9 | FROM ryanlee2014/cupoj-judger-env:1.2.3 10 | 11 | LABEL maintainer="Ryan Lee" \ 12 | email="gxlhybh@gmail.com" 13 | 14 | # Install Node.js 15 | RUN set -xe && \ 16 | git clone https://github.com/CUP-ACM-Programming-Club/CUP-Online-Judge-Judger.git judger && \ 17 | cd judger && \ 18 | ./build_docker.sh && \ 19 | dpkg-reconfigure --frontend noninteractive tzdata && \ 20 | cd ../ && \ 21 | git clone https://github.com/ryanlee2014/CUP-Online-Judge-Judge-Daemon-Service.git daemon && \ 22 | cd daemon && \ 23 | npm install && \ 24 | cp ../judger/wsjudged ./ && \ 25 | chmod +x wsjudged && \ 26 | npm run build:main 27 | 28 | 29 | # Binds to port 8080 30 | EXPOSE 5110 31 | 32 | # Defines your runtime(define default command) 33 | # These commands unlike RUN (they are carried out in the construction of the container) are run when the container 34 | CMD cd /daemon && node ./build/index.js 35 | -------------------------------------------------------------------------------- /docker/judger/full/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Ubuntu Node.js Dockerfile 3 | # 4 | # https://github.com/dockerfile/ubuntu/blob/master/Dockerfile 5 | # https://docs.docker.com/examples/nodejs_web_app/ 6 | # 7 | 8 | # Pull base image. 9 | FROM ryanlee2014/cupoj-judger-env:1.2.3-full 10 | 11 | LABEL maintainer="Ryan Lee" \ 12 | email="gxlhybh@gmail.com" 13 | 14 | # Install Node.js 15 | RUN set -xe && \ 16 | git clone https://github.com/CUP-ACM-Programming-Club/CUP-Online-Judge-Judger.git judger && \ 17 | cd judger && \ 18 | ./build_docker.sh && \ 19 | dpkg-reconfigure --frontend noninteractive tzdata && \ 20 | cd ../ && \ 21 | git clone https://github.com/ryanlee2014/CUP-Online-Judge-Judge-Daemon-Service.git daemon && \ 22 | cd daemon && \ 23 | npm install && \ 24 | cp ../judger/wsjudged ./ && \ 25 | chmod +x wsjudged && \ 26 | npm run build:main 27 | 28 | 29 | # Binds to port 8080 30 | EXPOSE 5110 31 | 32 | # Defines your runtime(define default command) 33 | # These commands unlike RUN (they are carried out in the construction of the container) are run when the container 34 | CMD cd /daemon && node ./build/index.js 35 | -------------------------------------------------------------------------------- /init-env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | IMPORT_SLEEP_TIME=30 6 | 7 | REGION="$1" 8 | 9 | FRONTEND_MIRROR="" 10 | 11 | if [[ "$REGION" != "" ]]; then 12 | FRONTEND_MIRROR=".$REGION" 13 | fi 14 | 15 | FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR.sh" 16 | 17 | chmod +x $FRONTEND_SHELL 18 | 19 | bash shell/base-env.sh && \ 20 | cp etc/backend/config.sample.json etc/backend/config.json && \ 21 | cp judge/etc/config.sample.json judge/etc/config.json && \ 22 | bash $FRONTEND_SHELL && \ 23 | docker-compose up -d mysql && \ 24 | echo -e "${BGreen}Container started. Sleep ${IMPORT_SLEEP_TIME} seconds.${Color_Off}" && \ 25 | sleep $IMPORT_SLEEP_TIME && \ 26 | echo -e "${BRed}Import SQL structure... this operation will erase your data." && \ 27 | docker-compose exec -T mysql mysql "-uroot" "-proot" < "./sql/structure.sql" && \ 28 | echo -e "${BWhite}Imported. Sleep 3 seconds.${Color_Off}" && \ 29 | sleep 3 && \ 30 | echo -e "${BGreen}Recreate container and start all services." && \ 31 | bash shell/recreate-container.sh && \ 32 | echo -e "${BWhite}Init system complete." 33 | echo -e "Please access to server from:" 34 | echo -e "${BGreen}" 35 | for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') 36 | do 37 | echo -e "http://$i:8080" 38 | done 39 | echo -e "${Color_Off}"; 40 | -------------------------------------------------------------------------------- /etc/nginx/ssl/localhost.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDpDCCAowCCQCUijlqpakSMjANBgkqhkiG9w0BAQsFADCBkjELMAkGA1UEBhMC 3 | Q04xEjAQBgNVBAgMCUd1YW5nZG9uZzERMA8GA1UEBwwIU2hlbnpoZW4xOjA4BgNV 4 | BAoMMVNoZW56aGVuIFRlbmNlbnQgQ29tcHV0ZXIgU3lzdGVtcyBDb21wYW55IExp 5 | bWl0ZWQxDDAKBgNVBAsMA1ImRDESMBAGA1UEAwwJMTI3LjAuMC4xMCAXDTE5MTEw 6 | NDEwMTIyNVoYDzIxMTkxMDExMTAxMjI1WjCBkjELMAkGA1UEBhMCQ04xEjAQBgNV 7 | BAgMCUd1YW5nZG9uZzERMA8GA1UEBwwIU2hlbnpoZW4xOjA4BgNVBAoMMVNoZW56 8 | aGVuIFRlbmNlbnQgQ29tcHV0ZXIgU3lzdGVtcyBDb21wYW55IExpbWl0ZWQxDDAK 9 | BgNVBAsMA1ImRDESMBAGA1UEAwwJMTI3LjAuMC4xMIIBIjANBgkqhkiG9w0BAQEF 10 | AAOCAQ8AMIIBCgKCAQEA2wvw5N5oRgCEWAGpsiKea10weoa9Gzu4XqpHTDygW0uZ 11 | sq1L0WKtWRfKys91hVJ3YYUfUCvhp57xJdrorEGzE9T1gSdmcOP4Hg9GswGYGerH 12 | ODIcZSJZCZGGX2OqjcveGLLTGVUbS30i5U79DUo9i6pn1aX8uTbGe4CNmaeWAFNq 13 | Ay+jzinYDHbMN1/A/CTbUUfs48D2d/oRcmnNI3wvQSU/5hCTK/U833adKmwIm4nh 14 | OSEKkodaQSWR3+PRpQzmmhHJVpuroKjXRTHM3uc2nBhzDdIMk46hjv7v6DWuTR/D 15 | /I3nT4KCGjHxG2d6WAo1NFNKlDz65qBfoGhEmf7bWQIDAQABMA0GCSqGSIb3DQEB 16 | CwUAA4IBAQBl2/jjbnQtUEdN8MfE6fqGCzVvWdMfHk/4oA+bKQfk4Vh/J2iMtXeV 17 | HlPvJiF7qZI9eipW5pyBTQpp1DuPXhIi9tGhoq30CnEZquX4/0mlQs1j2dU4lscD 18 | MzozE2g+qS0kR4CVLYazJl9zOO25KZFIG32ly36YI9sz4VebMBTkQoEUkl8WWTdX 19 | 0onwzo6SYaQtcqkj2trp9ywqWRFZbiHjRvm4KjU5stOJT5ZU4PzbdQQQpnv8PjXx 20 | MpOX/+H/JY3PCw0sBEf/wuoLhg2gmAS70Km3ySW5oMhkoVL4bo/AipipJR7XitvS 21 | kfCsLaHXmQ+yHwCf83uoZiZLeAGNkx5x 22 | -----END CERTIFICATE----- 23 | -------------------------------------------------------------------------------- /init-env-full.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | BASEDIR=$(dirname "$0") 3 | source "$BASEDIR"/shell/color-shell.sh 4 | 5 | IMPORT_SLEEP_TIME=30 6 | 7 | REGION="$1" 8 | 9 | FRONTEND_MIRROR="" 10 | 11 | if [[ "$REGION" != "" ]]; then 12 | FRONTEND_MIRROR=".$REGION" 13 | fi 14 | 15 | FRONTEND_SHELL="shell/download-latest-frontend$FRONTEND_MIRROR.sh" 16 | 17 | chmod +x $FRONTEND_SHELL 18 | 19 | bash shell/full-env.sh && \ 20 | cp etc/backend/config.sample.json etc/backend/config.json && \ 21 | cp judge/etc/config.sample.json judge/etc/config.json && \ 22 | bash $FRONTEND_SHELL && \ 23 | docker-compose up -d mysql && \ 24 | echo -e "${BGreen}Container started. Sleep ${IMPORT_SLEEP_TIME} seconds.${Color_Off}" && \ 25 | sleep $IMPORT_SLEEP_TIME && \ 26 | echo -e "${BRed}Import SQL structure... this operation will erase your data." && \ 27 | docker-compose exec -T mysql mysql "-uroot" "-proot" < "./sql/structure.sql" && \ 28 | echo -e "${BWhite}Imported. Sleep 3 seconds.${Color_Off}" && \ 29 | sleep 3 && \ 30 | echo -e "${BGreen}Recreate container and start all services." && \ 31 | bash shell/recreate-container.sh && \ 32 | echo -e "${BWhite}Init system complete." 33 | echo -e "Please access to server from:" 34 | echo -e "${BGreen}" 35 | for i in $(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') 36 | do 37 | echo -e "http://$i:8080" 38 | done 39 | echo -e "${Color_Off}"; 40 | -------------------------------------------------------------------------------- /etc/mysql/my.cnf: -------------------------------------------------------------------------------- 1 | # from docker mysql/mysql-server:8.0.18 2 | # 3 | # For advice on how to change settings please see 4 | # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html 5 | 6 | [mysqld] 7 | # 8 | # Remove leading # and set to the amount of RAM for the most important data 9 | # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. 10 | # innodb_buffer_pool_size = 128M 11 | # 12 | # Remove leading # to turn on a very important data integrity option: logging 13 | # changes to the binary log between backups. 14 | # log_bin 15 | # 16 | # Remove leading # to set options mainly useful for reporting servers. 17 | # The server defaults are faster for transactions and fast SELECTs. 18 | # Adjust sizes as needed, experiment to find the optimal values. 19 | # join_buffer_size = 128M 20 | # sort_buffer_size = 2M 21 | # read_rnd_buffer_size = 2M 22 | 23 | # Remove leading # to revert to previous value for default_authentication_plugin, 24 | # this will increase compatibility with older clients. For background, see: 25 | # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin 26 | # default-authentication-plugin=mysql_native_password 27 | skip-host-cache 28 | skip-name-resolve 29 | sql_mode="" 30 | datadir=/var/lib/mysql 31 | socket=/var/lib/mysql/mysql.sock 32 | secure-file-priv=/var/lib/mysql-files 33 | user=mysql 34 | 35 | pid-file=/var/run/mysqld/mysqld.pid 36 | -------------------------------------------------------------------------------- /docker/judger-env/base/Dockerfile: -------------------------------------------------------------------------------- 1 | # Pull base image. 2 | FROM ubuntu:20.04 3 | 4 | LABEL maintainer="Ryan Lee" \ 5 | email="gxlhybh@gmail.com" 6 | # Install Node.js 7 | RUN set -xe && \ 8 | cp /etc/apt/sources.list /etc/apt/sources.list.bak && \ 9 | apt-get update && \ 10 | apt-get install -y wget software-properties-common sudo && \ 11 | apt-get update && \ 12 | export DEBIAN_FRONTEND=noninteractive && \ 13 | ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ 14 | apt-get install --yes curl && \ 15 | curl -sL https://deb.nodesource.com/setup_14.x | bash - && \ 16 | apt-get install -y nodejs cmake flex clang fp-compiler gcc g++ unzip zsh libgmp-dev libmysqlclient-dev build-essential git net-tools vim && \ 17 | apt-get install -y fp-compiler mono-devel openjdk-11-jdk && \ 18 | add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ 19 | apt-get update && \ 20 | apt-get install -y gcc-10 g++-10 && \ 21 | cd ~ && \ 22 | wget https://github.com/JetBrains/kotlin/releases/download/v1.3.72/kotlin-native-linux-1.3.72.tar.gz && \ 23 | tar -zxvf kotlin-native-linux-1.3.72.tar.gz && \ 24 | mv kotlin-native-linux-1.3.72 /usr/lib/kotlin-native && \ 25 | rm -rf kotlin-native-linux-1.3.72.tar.gz && \ 26 | dirname $(find / -name libjli.so) > /etc/ld.so.conf.d/libjvm.conf && \ 27 | ldconfig && \ 28 | cd ~ 29 | 30 | ENV PATH="/usr/lib/kotlinc/bin:/usr/lib/kotlin-native/bin:${PATH}" 31 | 32 | CMD echo 'hello world!' 33 | -------------------------------------------------------------------------------- /etc/nginx/ssl/localhost.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDbC/Dk3mhGAIRY 3 | AamyIp5rXTB6hr0bO7heqkdMPKBbS5myrUvRYq1ZF8rKz3WFUndhhR9QK+GnnvEl 4 | 2uisQbMT1PWBJ2Zw4/geD0azAZgZ6sc4MhxlIlkJkYZfY6qNy94YstMZVRtLfSLl 5 | Tv0NSj2LqmfVpfy5NsZ7gI2Zp5YAU2oDL6POKdgMdsw3X8D8JNtRR+zjwPZ3+hFy 6 | ac0jfC9BJT/mEJMr9Tzfdp0qbAibieE5IQqSh1pBJZHf49GlDOaaEclWm6ugqNdF 7 | Mcze5zacGHMN0gyTjqGO/u/oNa5NH8P8jedPgoIaMfEbZ3pYCjU0U0qUPPrmoF+g 8 | aESZ/ttZAgMBAAECggEBAKnDj2dRl67pJ6itYT9V5UGAb9oGIvnARxvXDHrhYcZf 9 | yTbZaDFXMNIjxl94ebRiPXOvIJ2Z5MFsRaj5B+q44Hk2Sy9VwecsR1fErx581c0A 10 | UHYVIDyhajAoQOQc8koC/pZVwZWYiBbxXOIrXaO3LgvYfbDve/ZvpVSCRTwYzgBh 11 | Nj/nDPQKgWbwLcI0zXSzQk/lLTTsAoUpu51gdPCoowCYRnBHIi12zKICuVDXvxsN 12 | QCjyOuym6sC9NOa2MyDxVvAxgyf9W4nWAETtmV/4d3+G6BS1ahRqMXbc7Yri+3BC 13 | NjusaVqIBFznEY8Zfvb3njjNoWDd+B9XMxxEjO95iAECgYEA9KOaT8uqnOn8TXAd 14 | /x7wIgjRinEA69Sl8Yvy8enR10j7+Ff59d5RuqEgl9SKgocZFKCng4mwgcc4QTV9 15 | Wuxu0EnxomC9vWCPduN9gbGypBrdwZum1rD6a7l4N6pJYm7PokQN/1WnhXv/CcJF 16 | pVx55luEhAuan/bpE5QjKWzU6WECgYEA5TgVAFPT6yuVSQSc7OtvjrppvP/UCzJT 17 | rVoV1OOhxu1rVKgbmhg/lP0jw4NbqEIaSzau+VngNAHkA0Tvqvtd+hSRmXciazXP 18 | Nwmc6nVAEQh5mKujqAaGJhp72d7sYqyHLYumJU9euNp2P3/yOOWD3OWR9cHvHzvt 19 | PBAuzWqpXPkCgYAe2C3Rl8U4KYxFGzi8/OKb9+6rfNn34gTWMqX7+FYbxbj3M+hx 20 | Jom5dS1N119rW6s+3Y6hWA/oHP0rw5m9iAfkvR35MidaJD2SaNZfLs9uP3DsQzrC 21 | 4OeCA41zv0WnYn9NXzVAl0Ua4GpkiZkMY19/OtS3bVsehhwW+tuAEpe5oQKBgQCC 22 | f0Y9lHv+1CY+lti8bWFqsahHSKKw6SsIc1QgiqPsu/gyDy7/sLRqHyAATEWfalrL 23 | 3UsKfOeO1FC6p8GG52reWF14MIIw5Uaef+OM+8nIqLmJeJZIr8Yp5UQDis2rc6vV 24 | +z5Q2XoE5aMSjcYaLFjBJxXNA2cesiBi5JewrPvVCQKBgQCoGZEMwFkhvaLAJzMV 25 | RhdzwZaC7X1TlG1WY0UcC1W16GLQgBfOmGpa7PvIX7DsztEWtBrxZ1j4evBrd+Fw 26 | f2zEPDEkTLos3gUUizMnzfY2og2pxTmVbvy1RLP9aqRyaNaCz7omKTCwrLL1LpuP 27 | vXL7jCwgfO65nucYH3wNBw7e/w== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /.github/workflows/build_judger.yml: -------------------------------------------------------------------------------- 1 | name: Publish to docker registry 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | name: Checkout code 15 | with: 16 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token 17 | fetch-depth: 0 # otherwise, you will failed to push refs to dest repo 18 | - name: Build env 19 | run: | 20 | echo "PKG_VERSION=$(cat docker/judger/VERSION)" >> $GITHUB_ENV 21 | echo "PKG_FULL_VERSION=$(cat docker/judger/VERSION)-full" >> $GITHUB_ENV 22 | - uses: mr-smithers-excellent/docker-build-push@v2 23 | name: Build judger service image 24 | with: 25 | image: ryanlee2014/cupoj-judger 26 | tag: ${{ env.PKG_VERSION }} 27 | registry: docker.io 28 | dockerfile: ./docker/judger/base/Dockerfile 29 | username: ${{ secrets.DOCKER_USERNAME }} 30 | password: ${{ secrets.DOCKER_PASSWORD }} 31 | - uses: mr-smithers-excellent/docker-build-push@v2 32 | name: Update judger service image 33 | with: 34 | image: ryanlee2014/cupoj-judger 35 | tag: latest 36 | registry: docker.io 37 | dockerfile: ./docker/judger/base/Dockerfile 38 | username: ${{ secrets.DOCKER_USERNAME }} 39 | password: ${{ secrets.DOCKER_PASSWORD }} 40 | - uses: mr-smithers-excellent/docker-build-push@v2 41 | name: Update judger service image with full env 42 | with: 43 | image: ryanlee2014/cupoj-judger 44 | tag: ${{ env.PKG_FULL_VERSION }} 45 | registry: docker.io 46 | dockerfile: ./docker/judger/full/Dockerfile 47 | username: ${{ secrets.DOCKER_USERNAME }} 48 | password: ${{ secrets.DOCKER_PASSWORD }} 49 | -------------------------------------------------------------------------------- /.github/workflows/build_judge_env.yml: -------------------------------------------------------------------------------- 1 | name: Build judge environment 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | publish: 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - uses: actions/checkout@v2 14 | name: Checkout code 15 | with: 16 | persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token 17 | fetch-depth: 0 # otherwise, you will failed to push refs to dest repo 18 | - name: Build env 19 | run: | 20 | echo "PKG_VERSION=$(cat docker/judger-env/VERSION)" >> $GITHUB_ENV 21 | echo "PKG_FULL_VERSION=$(cat docker/judger-env/VERSION)-full" >> $GITHUB_ENV 22 | - uses: mr-smithers-excellent/docker-build-push@v2 23 | name: Build judger environment image 24 | with: 25 | image: ryanlee2014/cupoj-judger-env 26 | tag: ${{ env.PKG_VERSION }} 27 | registry: docker.io 28 | dockerfile: ./docker/judger-env/base/Dockerfile 29 | username: ${{ secrets.DOCKER_USERNAME }} 30 | password: ${{ secrets.DOCKER_PASSWORD }} 31 | - uses: mr-smithers-excellent/docker-build-push@v2 32 | name: Update judger environment image 33 | with: 34 | image: ryanlee2014/cupoj-judger-env 35 | tag: latest 36 | registry: docker.io 37 | dockerfile: ./docker/judger-env/base/Dockerfile 38 | username: ${{ secrets.DOCKER_USERNAME }} 39 | password: ${{ secrets.DOCKER_PASSWORD }} 40 | - uses: mr-smithers-excellent/docker-build-push@v2 41 | name: Build judger environment image 42 | with: 43 | image: ryanlee2014/cupoj-judger-env 44 | tag: ${{ env.PKG_FULL_VERSION }} 45 | registry: docker.io 46 | dockerfile: ./docker/judger-env/full/Dockerfile 47 | username: ${{ secrets.DOCKER_USERNAME }} 48 | password: ${{ secrets.DOCKER_PASSWORD }} 49 | -------------------------------------------------------------------------------- /shell/color-shell.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Reset 4 | Color_Off='\033[0m' # Text Reset 5 | 6 | # Regular Colors 7 | Black='\033[0;30m' # Black 8 | Red='\033[0;31m' # Red 9 | Green='\033[0;32m' # Green 10 | Yellow='\033[0;33m' # Yellow 11 | Blue='\033[0;34m' # Blue 12 | Purple='\033[0;35m' # Purple 13 | Cyan='\033[0;36m' # Cyan 14 | White='\033[0;37m' # White 15 | 16 | # Bold 17 | BBlack='\033[1;30m' # Black 18 | BRed='\033[1;31m' # Red 19 | BGreen='\033[1;32m' # Green 20 | BYellow='\033[1;33m' # Yellow 21 | BBlue='\033[1;34m' # Blue 22 | BPurple='\033[1;35m' # Purple 23 | BCyan='\033[1;36m' # Cyan 24 | BWhite='\033[1;37m' # White 25 | 26 | # Underline 27 | UBlack='\033[4;30m' # Black 28 | URed='\033[4;31m' # Red 29 | UGreen='\033[4;32m' # Green 30 | UYellow='\033[4;33m' # Yellow 31 | UBlue='\033[4;34m' # Blue 32 | UPurple='\033[4;35m' # Purple 33 | UCyan='\033[4;36m' # Cyan 34 | UWhite='\033[4;37m' # White 35 | 36 | # Background 37 | On_Black='\033[40m' # Black 38 | On_Red='\033[41m' # Red 39 | On_Green='\033[42m' # Green 40 | On_Yellow='\033[43m' # Yellow 41 | On_Blue='\033[44m' # Blue 42 | On_Purple='\033[45m' # Purple 43 | On_Cyan='\033[46m' # Cyan 44 | On_White='\033[47m' # White 45 | 46 | # High Intensity 47 | IBlack='\033[0;90m' # Black 48 | IRed='\033[0;91m' # Red 49 | IGreen='\033[0;92m' # Green 50 | IYellow='\033[0;93m' # Yellow 51 | IBlue='\033[0;94m' # Blue 52 | IPurple='\033[0;95m' # Purple 53 | ICyan='\033[0;96m' # Cyan 54 | IWhite='\033[0;97m' # White 55 | 56 | # Bold High Intensity 57 | BIBlack='\033[1;90m' # Black 58 | BIRed='\033[1;91m' # Red 59 | BIGreen='\033[1;92m' # Green 60 | BIYellow='\033[1;93m' # Yellow 61 | BIBlue='\033[1;94m' # Blue 62 | BIPurple='\033[1;95m' # Purple 63 | BICyan='\033[1;96m' # Cyan 64 | BIWhite='\033[1;97m' # White 65 | 66 | # High Intensity backgrounds 67 | On_IBlack='\033[0;100m' # Black 68 | On_IRed='\033[0;101m' # Red 69 | On_IGreen='\033[0;102m' # Green 70 | On_IYellow='\033[0;103m' # Yellow 71 | On_IBlue='\033[0;104m' # Blue 72 | On_IPurple='\033[0;105m' # Purple 73 | On_ICyan='\033[0;106m' # Cyan 74 | On_IWhite='\033[0;107m' # White 75 | 76 | -------------------------------------------------------------------------------- /docker-compose.example.yml: -------------------------------------------------------------------------------- 1 | version: '3.2' 2 | 3 | services: 4 | cupoj-judger: 5 | image: "${JUDGER_VERSION}" 6 | privileged: true 7 | ports: 8 | - 5110:5110 9 | volumes: 10 | - ./judge/etc:/home/judge/etc 11 | - ./judge/data:/home/judge/data 12 | - ./log/judger:/daemon/logs 13 | - ./data/submission:/home/judge/submission 14 | - ./judge/config:/daemon/config 15 | environment: 16 | ENABLE_CRONTAB: "true" 17 | TZ: ${TZ} 18 | restart: on-failure 19 | cupoj-backend: 20 | image: "${BACKEND_VERSION}" 21 | volumes: 22 | - ./etc/backend:/config 23 | - ./judge:/home/judge 24 | - ./log/backend:/backend/logs 25 | - ./data/backend:/backend/data 26 | expose: 27 | - "3000" 28 | environment: 29 | ENABLE_CRONTAB: "true" 30 | TZ: ${TZ} 31 | restart: on-failure 32 | cupoj-websocket: 33 | image: "${WEBSOCKET_VERSION}" 34 | volumes: 35 | - ./etc/backend:/config 36 | - ./judge:/home/judge 37 | - ./log/backend:/backend/logs 38 | expose: 39 | - "3300" 40 | environment: 41 | ENABLE_CRONTAB: "true" 42 | TZ: ${TZ} 43 | restart: on-failure 44 | cupoj-language-server: 45 | image: "${LANGUAGE_SERVER_VERSION}" 46 | expose: 47 | - "17779" 48 | environment: 49 | ENABLE_CRONTAB: "true" 50 | TZ: ${TZ} 51 | nginx: 52 | image: "${NGINX_VERSION}" 53 | ports: 54 | - 8080:80 55 | volumes: 56 | - ./log/nginx:/var/log/nginx 57 | - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf 58 | - ./etc/nginx/conf.d:/etc/nginx/conf.d 59 | - ./etc/nginx/ssl:/etc/nginx/ssl 60 | - ./wwwroot:/var/www 61 | environment: 62 | ENABLE_CRONTAB: "true" 63 | TZ: ${TZ} 64 | restart: on-failure 65 | mysql: 66 | image: "${MYSQL_VERSION}" 67 | command: --default-authentication-plugin=mysql_native_password 68 | expose: 69 | - "3306" 70 | volumes: 71 | - ./etc/mysql/my.cnf:/etc/my.cnf 72 | - ./etc/mysql/my.cnf.d:/etc/my.cnf.d 73 | - ./data/mysql/data:/var/lib/mysql 74 | environment: 75 | MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} 76 | MYSQL_ROOT_HOST: "%" 77 | TZ: ${TZ} 78 | restart: on-failure 79 | redis: 80 | image: "${REDIS_VERSION}" 81 | expose: 82 | - "6379" 83 | volumes: 84 | - ./data/redis/data:/data:rw 85 | environment: 86 | TZ: ${TZ} 87 | restart: on-failure 88 | -------------------------------------------------------------------------------- /etc/nginx/conf.d/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | #listen 443 ssl http2; 4 | #listen 443 quic; 5 | 6 | #server_name localhost; 7 | 8 | root /var/www/html; 9 | index index.html; 10 | 11 | #ssl_protocols TLSv1.2 TLSv1.3; 12 | #ssl_ciphers TLS-CHACHA20-POLY1305-SHA256:TLS-AES-256-GCM-SHA384:TLS-AES-128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256; 13 | #ssl_prefer_server_ciphers on; 14 | #ssl_early_data on; 15 | 16 | #ssl_certificate /etc/letsencrypt/live/www.cupacm.com/fullchain.pem; 17 | #ssl_certificate_key /etc/letsencrypt/live/www.cupacm.com/privkey.pem; 18 | #ssl_trusted_certificate /etc/letsencrypt/live/www.cupacm.com/chain.pem; 19 | 20 | # error_page 405 =200 $uri; 21 | # security 22 | #include nginxconfig.io/security.conf; 23 | 24 | # logging 25 | access_log /var/log/nginx/cupacm.com.access.log; 26 | error_log /var/log/nginx/cupacm.com.error.log warn; 27 | 28 | # index.html fallback 29 | location / { 30 | try_files $uri $uri/ /index.html; 31 | } 32 | 33 | location /api/ { 34 | proxy_http_version 1.1; 35 | proxy_cache_bypass $http_upgrade; 36 | 37 | proxy_set_header Upgrade $http_upgrade; 38 | proxy_set_header Connection "upgrade"; 39 | proxy_set_header Host $host; 40 | proxy_set_header X-Real-IP $remote_addr; 41 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 42 | proxy_set_header X-Forwarded-Proto $scheme; 43 | proxy_set_header X-Forwarded-Host $host; 44 | proxy_set_header X-Forwarded-Port $server_port; 45 | error_page 405 =200; 46 | proxy_pass http://cupoj-backend:3000/; 47 | } 48 | 49 | location /socket.io/ { 50 | proxy_http_version 1.1; 51 | proxy_cache_bypass $http_upgrade; 52 | 53 | proxy_set_header Upgrade $http_upgrade; 54 | proxy_set_header Connection "upgrade"; 55 | proxy_set_header Host $host; 56 | proxy_set_header X-Real-IP $remote_addr; 57 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 58 | proxy_set_header X-Forwarded-Proto $scheme; 59 | proxy_set_header X-Forwarded-Host $host; 60 | proxy_set_header X-Forwarded-Port $server_port; 61 | error_page 405 =200; 62 | proxy_pass http://cupoj-websocket:3300/socket.io/; 63 | } 64 | 65 | location /language-server/ { 66 | proxy_http_version 1.1; 67 | proxy_cache_bypass $http_upgrade; 68 | 69 | proxy_set_header Upgrade $http_upgrade; 70 | proxy_set_header Connection "upgrade"; 71 | proxy_set_header Host $host; 72 | proxy_set_header X-Real-IP $remote_addr; 73 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 74 | proxy_set_header X-Forwarded-Proto $scheme; 75 | proxy_set_header X-Forwarded-Host $host; 76 | proxy_set_header X-Forwarded-Port $server_port; 77 | proxy_pass http://cupoj-language-server:17779/; 78 | } 79 | 80 | location /geoip/ { 81 | proxy_http_version 1.1; 82 | proxy_cache_bypass $http_upgrade; 83 | 84 | proxy_set_header Upgrade $http_upgrade; 85 | proxy_set_header Connection "upgrade"; 86 | proxy_set_header Host $host; 87 | proxy_set_header X-Real-IP $remote_addr; 88 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 89 | proxy_set_header X-Forwarded-Proto $scheme; 90 | proxy_set_header X-Forwarded-Host $host; 91 | proxy_set_header X-Forwarded-Port $server_port; 92 | error_page 405 =200; 93 | proxy_pass http://ip-api.com/; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /judge/etc/compile.json: -------------------------------------------------------------------------------- 1 | { 2 | "0": [ 3 | "gcc", 4 | "Main.c", 5 | "-o", 6 | "Main", 7 | "-fmax-errors=10", 8 | "-fno-asm", 9 | "-Wall", 10 | "-pipe", 11 | "-O2", 12 | "-lm", 13 | "-lgmp", 14 | "--static", 15 | "-std=c11", 16 | "-DONLINE_JUDGE" 17 | ], 18 | "1": [ 19 | "g++", 20 | "-fmax-errors=10", 21 | "-fno-asm", 22 | "-pipe", 23 | "-Wall", 24 | "-O2", 25 | "-lm", 26 | "-lgmp", 27 | "--static", 28 | "-std=c++17", 29 | "-DONLINE_JUDGE", 30 | "-o", 31 | "Main", 32 | "Main.cc" 33 | ], 34 | "2": [ 35 | "fpc", 36 | "Main.pas", 37 | "-Cs32000000", 38 | "-Sh", 39 | "-O2", 40 | "-Co", 41 | "-Ct", 42 | "-Ci" 43 | ], 44 | "3": [ 45 | "javac", 46 | "-J%s", 47 | "-J%s", 48 | "-encoding", 49 | "UTF-8", 50 | "Main.java" 51 | ], 52 | "4": [ 53 | "ruby", 54 | "-c", 55 | "Main.rb" 56 | ], 57 | "5": [ 58 | "chmod", 59 | "+rx", 60 | "Main.sh" 61 | ], 62 | "7": [ 63 | "php", 64 | "-l", 65 | "Main.php" 66 | ], 67 | "8": [ 68 | "perl", 69 | "-c", 70 | "Main.pl" 71 | ], 72 | "9": [ 73 | "gmcs", 74 | "-warn:0", 75 | "Main.cs" 76 | ], 77 | "10": [ 78 | "gcc", 79 | "-o", 80 | "Main", 81 | "Main.m", 82 | "-fconstant-string-class=NSConstantString", 83 | "-I", 84 | "/usr/include/GNUstep/", 85 | "-L", 86 | "/usr/lib/GNUstep/Libraries/", 87 | "-lobjc", 88 | "-lgnustep-base" 89 | ], 90 | "11": [ 91 | "fbc", 92 | "-lang", 93 | "qb", 94 | "Main.bas" 95 | ], 96 | "13": [ 97 | "/usr/bin/clang", 98 | "Main.c", 99 | "-pipe", 100 | "-o", 101 | "Main", 102 | "-ferror-limit=10", 103 | "-fno-asm", 104 | "-Wall", 105 | "-lm", 106 | "-lgmp", 107 | "--static", 108 | "-std=c99", 109 | "-DONLINE_JUDGE" 110 | ], 111 | "14": [ 112 | "/usr/bin/clang++", 113 | "Main.cc", 114 | "-pipe", 115 | "-o", 116 | "Main", 117 | "-ferror-limit=10", 118 | "-fno-asm", 119 | "-Wall", 120 | "-lm", 121 | "-lgmp", 122 | "--static", 123 | "-std=c++11", 124 | "-DONLINE_JUDGE" 125 | ], 126 | "15": [ 127 | "luac", 128 | "-o", 129 | "Main", 130 | "Main.lua" 131 | ], 132 | "17": [ 133 | "go", 134 | "build", 135 | "-o", 136 | "Main", 137 | "Main.go" 138 | ], 139 | "19": [ 140 | "g++", 141 | "-fmax-errors=10", 142 | "-fno-asm", 143 | "-Wall", 144 | "-pipe", 145 | "-O2", 146 | "-lm", 147 | "-lgmp", 148 | "--static", 149 | "-std=c++11", 150 | "-DONLINE_JUDGE", 151 | "-o", 152 | "Main", 153 | "Main.cc" 154 | ], 155 | "20": [ 156 | "g++", 157 | "-fmax-errors=10", 158 | "-fno-asm", 159 | "-Wall", 160 | "-pipe", 161 | "-O2", 162 | "-lm", 163 | "-lgmp", 164 | "--static", 165 | "-std=c++98", 166 | "-DONLINE_JUDGE", 167 | "-o", 168 | "Main", 169 | "Main.cc" 170 | ], 171 | "21": [ 172 | "gcc", 173 | "Main.c", 174 | "-pipe", 175 | "-o", 176 | "Main", 177 | "-fmax-errors=10", 178 | "-fno-asm", 179 | "-Wall", 180 | "-O2", 181 | "-lm", 182 | "-lgmp", 183 | "--static", 184 | "-std=c99", 185 | "-DONLINE_JUDGE" 186 | ], 187 | "22": [ 188 | "kotlinc", 189 | "Main.kt", 190 | "-include-runtime", 191 | "-d", 192 | "Main.jar" 193 | ], 194 | "23": [ 195 | "javac", 196 | "-J%s", 197 | "-J%s", 198 | "-source", 199 | "8", 200 | "-encoding", 201 | "UTF-8", 202 | "Main.java" 203 | ], 204 | "24": [ 205 | "javac", 206 | "-J%s", 207 | "-J%s", 208 | "-source", 209 | "7", 210 | "-encoding", 211 | "UTF-8", 212 | "Main.java" 213 | ], 214 | "27": [ 215 | "javac", 216 | "-J%s", 217 | "-J%s", 218 | "-source", 219 | "6", 220 | "-encoding", 221 | "UTF-8", 222 | "Main.java" 223 | ], 224 | "28": [ 225 | "clang", 226 | "Main.c", 227 | "-pipe", 228 | "-o", 229 | "Main", 230 | "-ferror-limit=10", 231 | "-fno-asm", 232 | "-Wall", 233 | "-lm", 234 | "-lgmp", 235 | "--static", 236 | "-std=c11", 237 | "-DONLINE_JUDGE" 238 | ], 239 | "29": [ 240 | "clang++", 241 | "Main.cc", 242 | "-pipe", 243 | "-o", 244 | "Main", 245 | "-ferror-limit=10", 246 | "-fno-asm", 247 | "-Wall", 248 | "-lm", 249 | "-lgmp", 250 | "--static", 251 | "-std=c++17", 252 | "-DONLINE_JUDGE" 253 | ], 254 | "30": [ 255 | "g++-10", 256 | "-fmax-errors=10", 257 | "-fno-asm", 258 | "-pipe", 259 | "-Wall", 260 | "-O2", 261 | "-lm", 262 | "-lgmp", 263 | "--static", 264 | "-std=c++2a", 265 | "-DONLINE_JUDGE", 266 | "-o", 267 | "Main", 268 | "Main.cc" 269 | ], 270 | "31": [ 271 | "/usr/lib/kotlin-native/bin/kotlinc", 272 | "Main.kt", 273 | "-o", 274 | "Main", 275 | "-opt" 276 | ] 277 | } 278 | -------------------------------------------------------------------------------- /README.zh-cn.md: -------------------------------------------------------------------------------- 1 | # CUP Online Judge 2 | 3 | ![License](https://img.shields.io/github/license/ryanlee2014/CUP-Online-Judge) 4 | ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/ryanlee2014/CUP-Online-Judge-Frontend/typescript?label=Frontend) 5 | ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/CUP-ACM-Programming-Club/CUP-Online-Judge-Express/typescript?label=Backend) 6 | ![jsDelivr hits (GitHub)](https://img.shields.io/jsdelivr/gh/hm/ryanlee2014/CUP-Online-Judge-CDN) 7 | 8 | |name|pulls|version|layers|image size| 9 | |:---:|:---:|:---:|:---:|:---:| 10 | |[ryanlee2014/cupoj-backend](https://hub.docker.com/r/ryanlee2014/cupoj-backend)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-backend)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/CUP-ACM-Programming-Club/CUP-Online-Judge-Express)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-backend/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-backend)| 11 | |[ryanlee2014/cupoj-websocket](https://hub.docker.com/r/ryanlee2014/cupoj-websocket)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-websocket)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/CUP-ACM-Programming-Club/CUP-Online-Judge-Express)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-websocket/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-websocket)| 12 | |[ryanlee2014/cupoj-judger](https://hub.docker.com/r/ryanlee2014/cupoj-judger)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-judger)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/CUP-ACM-Programming-Club/CUP-Online-Judge-Judger)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-judger/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-judger)| 13 | |[ryanlee2014/cupoj-language-server](https://hub.docker.com/r/ryanlee2014/cupoj-language-server)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-language-server)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/ryanlee2014/CUPOJ-Language-Server)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-language-server/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-language-server)| 14 | |[ryanlee2014/cupoj-frontend](https://github.com/ryanlee2014/CUP-Online-Judge-Frontend)|![GitHub commit activity](https://img.shields.io/github/commit-activity/w/ryanlee2014/CUP-Online-Judge-Frontend)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/ryanlee2014/CUP-Online-Judge-Frontend)||![GitHub repo size](https://img.shields.io/github/repo-size/ryanlee2014/CUP-Online-Judge-CDN)| 15 | |[metowolf/nginx](https://hub.docker.com/r/metowolf/nginx)|![Pulls Count](https://img.shields.io/docker/pulls/metowolf/nginx.svg)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/metowolf/docker-nginx)|![](https://shields.beevelop.com/docker/image/layers/metowolf/nginx/latest.svg)|![](https://shields.beevelop.com/docker/image/image-size/metowolf/nginx/latest.svg)| 16 | |[mysql/mysql-server](https://hub.docker.com/r/mysql/mysql-server)|![Pulls Count](https://img.shields.io/docker/pulls/mysql/mysql-server.svg)||![](https://shields.beevelop.com/docker/image/layers/mysql/mysql-server/latest.svg)|![](https://shields.beevelop.com/docker/image/image-size/mysql/mysql-server/latest.svg)| 17 | |[library/redis](https://hub.docker.com/_/redis)|![Pulls Count](https://img.shields.io/docker/pulls/library/redis.svg)||![](https://shields.beevelop.com/docker/image/layers/library/redis/alpine.svg)|![](https://shields.beevelop.com/docker/image/image-size/library/redis/alpine.svg)| 18 | 19 | ## 运行要求 20 | 安装 [Docker](https://get.docker.com/) and [Docker Compose](https://docs.docker.com/compose/install/) 21 | 22 | [安装手册](/docs/INSTALL_DOCKER.zh-cn.md) 23 | 24 | ## 使用方法(整合脚本) 25 | ```bash 26 | ./init-env.sh 27 | ``` 28 | 29 | ## 升级(整合脚本) 30 | ```bash 31 | ./update.sh 32 | ``` 33 | 34 | ## 使用方法(手动部署) 35 | 1. Clone该仓库到本地 36 | ```bash 37 | git clone --recursive https://github.com/ryanlee2014/CUP-Online-Judge-NG-Docker-Judger.git docker-judger 38 | ``` 39 | 40 | 2. 进入文件夹后,将 .env.example 重命名为 .env, docker-compose.example.yml 重命名为 docker-compose.yml 41 | ```bash 42 | cd docker-judger 43 | cp .env.example .env 44 | cp docker-compose.example.xml docker.compose.yml 45 | ``` 46 | 47 | 3. 进入 backend 文件夹,将 config.sample.json 重命名为 config.json 48 | ```bash 49 | cd etc/backend 50 | cp config.sample.json config.json 51 | ``` 52 | 53 | 4. 进入 judge 文件夹,将 config.sample.json 重命名为 config.json 54 | Edit judger/etc/config.json and compile.json to your environment settings 55 | ```text 56 | # judge.conf 57 | cd judge/etc 58 | cp config.sample.json config.json 59 | ``` 60 | 61 | 5. 创建 `data` 文件夹,或将其他目录下的 `data` 文件夹软连接到 `judge/data` 62 | ```bash 63 | # make dir 64 | mkdir -p ./judger/data 65 | # link 66 | ln -s path/to/data ./judger/data 67 | ``` 68 | 69 | 6. 启动容器: 70 | ```bash 71 | docker-compose up -d 72 | ``` 73 | 74 | ## 支持 CUP Online Judge 75 | [在爱发电成为赞助商](https://afdian.net/@ryanlee)(仅支持支付宝) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CUP Online Judge 2 | 3 | ![License](https://img.shields.io/github/license/ryanlee2014/CUP-Online-Judge) 4 | ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/ryanlee2014/CUP-Online-Judge-Frontend/typescript?label=Frontend) 5 | ![GitHub package.json version (branch)](https://img.shields.io/github/package-json/v/CUP-ACM-Programming-Club/CUP-Online-Judge-Express/typescript?label=Backend) 6 | ![jsDelivr hits (GitHub)](https://img.shields.io/jsdelivr/gh/hm/ryanlee2014/CUP-Online-Judge-CDN) 7 | 8 | |name|pulls|version|layers|image size| 9 | |:---:|:---:|:---:|:---:|:---:| 10 | |[ryanlee2014/cupoj-backend](https://hub.docker.com/r/ryanlee2014/cupoj-backend)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-backend)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/CUP-ACM-Programming-Club/CUP-Online-Judge-Express)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-backend/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-backend)| 11 | |[ryanlee2014/cupoj-websocket](https://hub.docker.com/r/ryanlee2014/cupoj-websocket)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-websocket)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/CUP-ACM-Programming-Club/CUP-Online-Judge-Express)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-websocket/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-websocket)| 12 | |[ryanlee2014/cupoj-judger](https://hub.docker.com/r/ryanlee2014/cupoj-judger)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-judger)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/CUP-ACM-Programming-Club/CUP-Online-Judge-Judger)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-judger/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-judger)| 13 | |[ryanlee2014/cupoj-language-server](https://hub.docker.com/r/ryanlee2014/cupoj-language-server)|![Pulls Count](https://img.shields.io/docker/pulls/ryanlee2014/cupoj-language-server)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/ryanlee2014/CUPOJ-Language-Server)|![Layers](https://shields.beevelop.com/docker/image/layers/ryanlee2014/cupoj-language-server/latest.svg)|![image size](https://img.shields.io/docker/image-size/ryanlee2014/cupoj-language-server)| 14 | |[ryanlee2014/cupoj-frontend](https://github.com/ryanlee2014/CUP-Online-Judge-Frontend)|![GitHub commit activity](https://img.shields.io/github/commit-activity/w/ryanlee2014/CUP-Online-Judge-Frontend)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/ryanlee2014/CUP-Online-Judge-Frontend)||![GitHub repo size](https://img.shields.io/github/repo-size/ryanlee2014/CUP-Online-Judge-CDN)| 15 | |[metowolf/nginx](https://hub.docker.com/r/metowolf/nginx)|![Pulls Count](https://img.shields.io/docker/pulls/metowolf/nginx.svg)|![GitHub release (latest by date)](https://img.shields.io/github/v/tag/metowolf/docker-nginx)|![](https://shields.beevelop.com/docker/image/layers/metowolf/nginx/latest.svg)|![](https://shields.beevelop.com/docker/image/image-size/metowolf/nginx/latest.svg)| 16 | |[mysql/mysql-server](https://hub.docker.com/r/mysql/mysql-server)|![Pulls Count](https://img.shields.io/docker/pulls/mysql/mysql-server.svg)||![](https://shields.beevelop.com/docker/image/layers/mysql/mysql-server/latest.svg)|![](https://shields.beevelop.com/docker/image/image-size/mysql/mysql-server/latest.svg)| 17 | |[library/redis](https://hub.docker.com/_/redis)|![Pulls Count](https://img.shields.io/docker/pulls/library/redis.svg)||![](https://shields.beevelop.com/docker/image/layers/library/redis/alpine.svg)|![](https://shields.beevelop.com/docker/image/image-size/library/redis/alpine.svg)| 18 | 19 | ## Translation 20 | [中文](/README.zh-cn.md) 21 | 22 | ## Requirements 23 | Install [Docker](https://get.docker.com/) and [Docker Compose](https://docs.docker.com/compose/install/) 24 | 25 | [Manual](/docs/INSTALL_DOCKER.md) 26 | 27 | ## Usage(all in one) 28 | ```bash 29 | ./init-env.sh 30 | ``` 31 | 32 | ## Update(all in one) 33 | ```bash 34 | ./update.sh 35 | ``` 36 | 37 | ## Usage(Manual Installation Guide) 38 | 1. Clone repo inside your project 39 | ```bash 40 | git clone --recursive https://github.com/ryanlee2014/CUP-Online-Judge-NG-Docker-Judger.git docker-judger 41 | ``` 42 | 43 | 2. Enter the folder and rename .env.example to .env, docker-compose.example.yml to docker-compose.yml 44 | ```bash 45 | cd docker-judger 46 | cp .env.example .env 47 | cp docker-compose.example.xml docker.compose.yml 48 | ``` 49 | 50 | 3. Enter the backend folder and rename config.sample.json to config.json 51 | ```bash 52 | cd etc/backend 53 | cp config.sample.json config.json 54 | ``` 55 | 56 | 4. Enter the judge folder and rename config.sample.json to config.json 57 | Edit judger/etc/config.json and compile.json to your environment settings 58 | ```text 59 | # judge.conf 60 | cd judge/etc 61 | cp config.sample.json config.json 62 | ``` 63 | 64 | 5. Make `data` foler and move files into the folder or link `data` folder to `judge/data` 65 | ```bash 66 | # make dir 67 | mkdir -p ./judger/data 68 | # link 69 | ln -s path/to/data ./judger/data 70 | ``` 71 | 72 | 6. Run your containers: 73 | ```bash 74 | docker-compose up -d 75 | ``` 76 | 77 | ## Supporting CUP Online Judge 78 | [Become a sponsor on afdian](https://afdian.net/@ryanlee) (Alipay only) 79 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [2020] [Ryan Lee] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /sql/structure.sql: -------------------------------------------------------------------------------- 1 | -- MySQL dump 10.13 Distrib 8.0.19, for osx10.15 (x86_64) 2 | -- 3 | -- Host: cupacmoj.mysql.rds.aliyuncs.com Database: jol 4 | -- ------------------------------------------------------ 5 | -- Server version 8.0.16 6 | 7 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; 8 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; 9 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; 10 | /*!50503 SET NAMES utf8mb4 */; 11 | /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; 12 | /*!40103 SET TIME_ZONE='+00:00' */; 13 | /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; 14 | /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; 15 | /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; 16 | /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; 17 | 18 | -- 19 | -- Current Database: `jol` 20 | -- 21 | 22 | CREATE DATABASE /*!32312 IF NOT EXISTS*/ `jol` /*!40100 DEFAULT CHARACTER SET utf8 */ /*!80016 DEFAULT ENCRYPTION='N' */; 23 | 24 | USE `jol`; 25 | 26 | -- 27 | -- Table structure for table `acm_member` 28 | -- 29 | 30 | /*!40101 SET @saved_cs_client = @@character_set_client */; 31 | /*!50503 SET character_set_client = utf8mb4 */; 32 | CREATE TABLE `acm_member` ( 33 | `user_id` varchar(48) NOT NULL, 34 | `level` tinyint(4) NOT NULL DEFAULT '0', 35 | KEY `acm_member_user_id_index` (`user_id`) 36 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 37 | /*!40101 SET character_set_client = @saved_cs_client */; 38 | 39 | -- 40 | -- Table structure for table `article` 41 | -- 42 | 43 | /*!40101 SET @saved_cs_client = @@character_set_client */; 44 | /*!50503 SET character_set_client = utf8mb4 */; 45 | CREATE TABLE `article` ( 46 | `user_id` varchar(100) NOT NULL, 47 | `article_id` int(11) NOT NULL AUTO_INCREMENT, 48 | `title` varchar(100) NOT NULL, 49 | `defunct` varchar(2) NOT NULL DEFAULT 'N', 50 | `create_time` datetime DEFAULT CURRENT_TIMESTAMP, 51 | `edit_time` datetime DEFAULT CURRENT_TIMESTAMP, 52 | `content` mediumtext, 53 | `last_post` datetime DEFAULT CURRENT_TIMESTAMP, 54 | PRIMARY KEY (`article_id`), 55 | KEY `article_user_id_index` (`user_id`), 56 | KEY `article_create_time_index` (`create_time`), 57 | KEY `article_edit_time_index` (`edit_time`), 58 | KEY `article_last_post_edit_time_create_time_article_id_index` (`last_post` DESC,`edit_time` DESC,`create_time` DESC,`article_id` DESC) 59 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 60 | /*!40101 SET character_set_client = @saved_cs_client */; 61 | 62 | -- 63 | -- Table structure for table `article_content` 64 | -- 65 | 66 | /*!40101 SET @saved_cs_client = @@character_set_client */; 67 | /*!50503 SET character_set_client = utf8mb4 */; 68 | CREATE TABLE `article_content` ( 69 | `user_id` varchar(35) NOT NULL, 70 | `content` text, 71 | `create_time` datetime DEFAULT CURRENT_TIMESTAMP, 72 | `edit_time` datetime DEFAULT NULL, 73 | `article_id` int(11) NOT NULL, 74 | `comment_id` int(11) NOT NULL AUTO_INCREMENT, 75 | PRIMARY KEY (`comment_id`), 76 | KEY `article_content_user_id_index` (`user_id`), 77 | KEY `article_content_create_time_index` (`create_time`), 78 | KEY `earticle_content__index` (`edit_time`) 79 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 80 | /*!40101 SET character_set_client = @saved_cs_client */; 81 | /*!50003 SET @saved_cs_client = @@character_set_client */ ; 82 | /*!50003 SET @saved_cs_results = @@character_set_results */ ; 83 | /*!50003 SET @saved_col_connection = @@collation_connection */ ; 84 | /*!50003 SET character_set_client = utf8mb4 */ ; 85 | /*!50003 SET character_set_results = utf8mb4 */ ; 86 | /*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ; 87 | /*!50003 SET @saved_sql_mode = @@sql_mode */ ; 88 | /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES' */ ; 89 | DELIMITER ;; 90 | /*!50003 CREATE*/ /*!50017 DEFINER=`cupoj`@`%`*/ /*!50003 TRIGGER `update_article_edit_time_insert` BEFORE INSERT ON `article_content` FOR EACH ROW BEGIN 91 | update article set last_post =NOW() where article.article_id = NEW.article_id; 92 | END */;; 93 | DELIMITER ; 94 | /*!50003 SET sql_mode = @saved_sql_mode */ ; 95 | /*!50003 SET character_set_client = @saved_cs_client */ ; 96 | /*!50003 SET character_set_results = @saved_cs_results */ ; 97 | /*!50003 SET collation_connection = @saved_col_connection */ ; 98 | /*!50003 SET @saved_cs_client = @@character_set_client */ ; 99 | /*!50003 SET @saved_cs_results = @@character_set_results */ ; 100 | /*!50003 SET @saved_col_connection = @@collation_connection */ ; 101 | /*!50003 SET character_set_client = utf8mb4 */ ; 102 | /*!50003 SET character_set_results = utf8mb4 */ ; 103 | /*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ; 104 | /*!50003 SET @saved_sql_mode = @@sql_mode */ ; 105 | /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES' */ ; 106 | DELIMITER ;; 107 | /*!50003 CREATE*/ /*!50017 DEFINER=`cupoj`@`%`*/ /*!50003 TRIGGER `update_article_edit_time` BEFORE UPDATE ON `article_content` FOR EACH ROW BEGIN 108 | update article set last_post = NOW() where article.article_id = NEW.article_id; 109 | END */;; 110 | DELIMITER ; 111 | /*!50003 SET sql_mode = @saved_sql_mode */ ; 112 | /*!50003 SET character_set_client = @saved_cs_client */ ; 113 | /*!50003 SET character_set_results = @saved_cs_results */ ; 114 | /*!50003 SET collation_connection = @saved_col_connection */ ; 115 | 116 | -- 117 | -- Table structure for table `award` 118 | -- 119 | 120 | /*!40101 SET @saved_cs_client = @@character_set_client */; 121 | /*!50503 SET character_set_client = utf8mb4 */; 122 | CREATE TABLE `award` ( 123 | `user_id` varchar(48) NOT NULL, 124 | `award` varchar(48) NOT NULL, 125 | `year` int(11) NOT NULL, 126 | KEY `award_user_id_index` (`user_id`), 127 | KEY `award_year_index` (`year`) 128 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 129 | /*!40101 SET character_set_client = @saved_cs_client */; 130 | 131 | -- 132 | -- Table structure for table `ban_user` 133 | -- 134 | 135 | /*!40101 SET @saved_cs_client = @@character_set_client */; 136 | /*!50503 SET character_set_client = utf8mb4 */; 137 | CREATE TABLE `ban_user` ( 138 | `user_id` varchar(40) NOT NULL, 139 | `bantime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 140 | PRIMARY KEY (`user_id`) 141 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 142 | /*!40101 SET character_set_client = @saved_cs_client */; 143 | 144 | -- 145 | -- Table structure for table `club_register` 146 | -- 147 | 148 | /*!40101 SET @saved_cs_client = @@character_set_client */; 149 | /*!50503 SET character_set_client = utf8mb4 */; 150 | CREATE TABLE `club_register` ( 151 | `user_id` varchar(48) NOT NULL, 152 | `name` varchar(48) NOT NULL, 153 | `sex` tinyint(4) NOT NULL DEFAULT '0', 154 | `class` varchar(48) NOT NULL, 155 | `mobile_phone` varchar(48) NOT NULL, 156 | `qq` varchar(48) NOT NULL, 157 | `wechat` varchar(48) NOT NULL, 158 | `email` char(48) NOT NULL, 159 | `club` tinyint(4) NOT NULL DEFAULT '0' 160 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 161 | /*!40101 SET character_set_client = @saved_cs_client */; 162 | 163 | -- 164 | -- Table structure for table `compileinfo` 165 | -- 166 | 167 | /*!40101 SET @saved_cs_client = @@character_set_client */; 168 | /*!50503 SET character_set_client = utf8mb4 */; 169 | CREATE TABLE `compileinfo` ( 170 | `solution_id` int(11) NOT NULL DEFAULT '0', 171 | `error` text, 172 | PRIMARY KEY (`solution_id`) 173 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 174 | /*!40101 SET character_set_client = @saved_cs_client */; 175 | 176 | -- 177 | -- Table structure for table `config` 178 | -- 179 | 180 | /*!40101 SET @saved_cs_client = @@character_set_client */; 181 | /*!50503 SET character_set_client = utf8mb4 */; 182 | CREATE TABLE `config` ( 183 | `key` varchar(40) NOT NULL, 184 | `value` varchar(4096) NOT NULL, 185 | `comment` varchar(128) DEFAULT '', 186 | `modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 187 | `createdAt` datetime NOT NULL, 188 | `updatedAt` datetime NOT NULL, 189 | PRIMARY KEY (`key`) 190 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 191 | /*!40101 SET character_set_client = @saved_cs_client */; 192 | 193 | -- 194 | -- Table structure for table `config_log` 195 | -- 196 | 197 | /*!40101 SET @saved_cs_client = @@character_set_client */; 198 | /*!50503 SET character_set_client = utf8mb4 */; 199 | CREATE TABLE `config_log` ( 200 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 201 | `operation` int(4) NOT NULL, 202 | `key` varchar(128) NOT NULL, 203 | `value` varchar(1024) NOT NULL, 204 | `comment` varchar(1024) NOT NULL, 205 | `createdAt` datetime NOT NULL, 206 | `updatedAt` datetime NOT NULL, 207 | PRIMARY KEY (`id`) 208 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 209 | /*!40101 SET character_set_client = @saved_cs_client */; 210 | 211 | -- 212 | -- Table structure for table `contest` 213 | -- 214 | 215 | /*!40101 SET @saved_cs_client = @@character_set_client */; 216 | /*!50503 SET character_set_client = utf8mb4 */; 217 | CREATE TABLE `contest` ( 218 | `contest_id` int(11) NOT NULL AUTO_INCREMENT, 219 | `title` varchar(255) DEFAULT NULL, 220 | `start_time` datetime DEFAULT NULL, 221 | `end_time` datetime DEFAULT NULL, 222 | `defunct` char(1) NOT NULL DEFAULT 'N', 223 | `description` text, 224 | `private` tinyint(4) NOT NULL DEFAULT '0', 225 | `vjudge` tinyint(4) NOT NULL DEFAULT '0', 226 | `cmod_visible` tinyint(4) NOT NULL DEFAULT '0', 227 | `homework` tinyint(4) NOT NULL DEFAULT '0', 228 | `langmask` int(11) NOT NULL DEFAULT '0' COMMENT 'bits for LANG to mask', 229 | `password` char(16) NOT NULL DEFAULT '', 230 | `ip_policy` char(40) DEFAULT NULL, 231 | `limit_hostname` varchar(40) DEFAULT NULL, 232 | `maker` varchar(255) DEFAULT '', 233 | `show_all_ranklist` tinyint(4) NOT NULL DEFAULT '0', 234 | PRIMARY KEY (`contest_id`) 235 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 236 | /*!40101 SET character_set_client = @saved_cs_client */; 237 | 238 | -- 239 | -- Table structure for table `contest_assistant` 240 | -- 241 | 242 | /*!40101 SET @saved_cs_client = @@character_set_client */; 243 | /*!50503 SET character_set_client = utf8mb4 */; 244 | create table `contest_assistant` 245 | ( 246 | `contest_id` int not null, 247 | `assistant_id` int auto_increment, 248 | `user_id` varchar(60) not null, 249 | PRIMARY KEY (`assistant_id`) 250 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 251 | /*!40101 SET character_set_client = @saved_cs_client */; 252 | 253 | create index contest_assistant_contest_id_index 254 | on contest_assistant (contest_id); 255 | 256 | create index contest_assistant_user_id_index 257 | on contest_assistant (user_id); 258 | 259 | -- 260 | -- Table structure for table `contest_cheat` 261 | -- 262 | 263 | /*!40101 SET @saved_cs_client = @@character_set_client */; 264 | /*!50503 SET character_set_client = utf8mb4 */; 265 | CREATE TABLE `contest_cheat` ( 266 | `contest_id` int(11) NOT NULL, 267 | `solution_id` int(11) NOT NULL, 268 | `user_id` varchar(48) NOT NULL, 269 | `num` int(11) NOT NULL, 270 | `checked` tinyint(1) NOT NULL DEFAULT '0', 271 | PRIMARY KEY (`solution_id`), 272 | KEY `contest_cheat_contest_id_index` (`contest_id` DESC), 273 | KEY `contest_cheat_user_id_index` (`user_id`) 274 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 275 | /*!40101 SET character_set_client = @saved_cs_client */; 276 | 277 | -- 278 | -- Table structure for table `contest_clarification` 279 | -- 280 | 281 | /*!40101 SET @saved_cs_client = @@character_set_client */; 282 | /*!50503 SET character_set_client = utf8mb4 */; 283 | CREATE TABLE `contest_clarification` ( 284 | `contest_id` int(11) NOT NULL, 285 | `content` text NOT NULL, 286 | `time` datetime DEFAULT NULL, 287 | `discuss_id` int(11) NOT NULL AUTO_INCREMENT, 288 | PRIMARY KEY (`discuss_id`) 289 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 290 | /*!40101 SET character_set_client = @saved_cs_client */; 291 | 292 | -- 293 | -- Table structure for table `contest_problem` 294 | -- 295 | 296 | /*!40101 SET @saved_cs_client = @@character_set_client */; 297 | /*!50503 SET character_set_client = utf8mb4 */; 298 | CREATE TABLE `contest_problem` ( 299 | `problem_id` int(11) NOT NULL DEFAULT '0', 300 | `contest_id` int(11) DEFAULT NULL, 301 | `title` char(200) NOT NULL DEFAULT '', 302 | `oj_name` char(10) DEFAULT NULL, 303 | `num` int(11) NOT NULL DEFAULT '0', 304 | `id` int(11) DEFAULT NULL 305 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 306 | /*!40101 SET character_set_client = @saved_cs_client */; 307 | 308 | -- 309 | -- Table structure for table `contest_set` 310 | -- 311 | 312 | /*!40101 SET @saved_cs_client = @@character_set_client */; 313 | /*!50503 SET character_set_client = utf8mb4 */; 314 | CREATE TABLE `contest_set` ( 315 | `contestset_id` int(11) NOT NULL AUTO_INCREMENT, 316 | `title` varchar(128) NOT NULL, 317 | `creator` varchar(64) NOT NULL, 318 | `description` text, 319 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 320 | `visible` tinyint(1) DEFAULT '1', 321 | `defunct` varchar(1) DEFAULT 'N', 322 | PRIMARY KEY (`contestset_id`) 323 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 324 | /*!40101 SET character_set_client = @saved_cs_client */; 325 | 326 | -- 327 | -- Table structure for table `contest_set_list` 328 | -- 329 | 330 | /*!40101 SET @saved_cs_client = @@character_set_client */; 331 | /*!50503 SET character_set_client = utf8mb4 */; 332 | CREATE TABLE `contest_set_list` ( 333 | `contestset_id` int(11) NOT NULL, 334 | `contest_id` int(11) NOT NULL, 335 | `contest_set_record_id` int(11) NOT NULL AUTO_INCREMENT, 336 | PRIMARY KEY (`contest_set_record_id`) 337 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 338 | /*!40101 SET character_set_client = @saved_cs_client */; 339 | 340 | -- 341 | -- Table structure for table `contestregister` 342 | -- 343 | 344 | /*!40101 SET @saved_cs_client = @@character_set_client */; 345 | /*!50503 SET character_set_client = utf8mb4 */; 346 | CREATE TABLE `contestregister` ( 347 | `user_id` varchar(48) NOT NULL DEFAULT '', 348 | `name` varchar(100) NOT NULL DEFAULT '', 349 | `department` varchar(100) NOT NULL DEFAULT '', 350 | `major` varchar(100) NOT NULL DEFAULT '', 351 | `phonenumber` varchar(100) NOT NULL DEFAULT '', 352 | `email` varchar(100) DEFAULT NULL, 353 | `school` varchar(100) NOT NULL DEFAULT '', 354 | `ip` varchar(20) NOT NULL DEFAULT '', 355 | `reg_time` datetime DEFAULT NULL, 356 | PRIMARY KEY (`user_id`) 357 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 358 | /*!40101 SET character_set_client = @saved_cs_client */; 359 | 360 | -- 361 | -- Table structure for table `cprogram` 362 | -- 363 | 364 | /*!40101 SET @saved_cs_client = @@character_set_client */; 365 | /*!50503 SET character_set_client = utf8mb4 */; 366 | CREATE TABLE `cprogram` ( 367 | `name` varchar(10) NOT NULL, 368 | `user_id` varchar(30) NOT NULL, 369 | `sex` tinyint(4) NOT NULL, 370 | `scholar` varchar(32) NOT NULL, 371 | `subject` varchar(32) NOT NULL, 372 | `teacher` varchar(32) NOT NULL, 373 | `class` varchar(16) NOT NULL, 374 | `bornday` varchar(24) NOT NULL, 375 | `mobile_phone` varchar(15) NOT NULL, 376 | `qq` varchar(15) NOT NULL, 377 | `wechat` varchar(48) NOT NULL, 378 | `email` varchar(48) NOT NULL, 379 | `group` tinyint(4) NOT NULL, 380 | `room` int(11) DEFAULT '0', 381 | `seat` int(11) DEFAULT '0', 382 | `pass` tinyint(1) DEFAULT '0' 383 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 384 | /*!40101 SET character_set_client = @saved_cs_client */; 385 | 386 | -- 387 | -- Table structure for table `custominput` 388 | -- 389 | 390 | /*!40101 SET @saved_cs_client = @@character_set_client */; 391 | /*!50503 SET character_set_client = utf8mb4 */; 392 | CREATE TABLE `custominput` ( 393 | `solution_id` int(11) NOT NULL DEFAULT '0', 394 | `input_text` text, 395 | PRIMARY KEY (`solution_id`) 396 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 397 | /*!40101 SET character_set_client = @saved_cs_client */; 398 | 399 | -- 400 | -- Table structure for table `global_setting` 401 | -- 402 | 403 | /*!40101 SET @saved_cs_client = @@character_set_client */; 404 | /*!50503 SET character_set_client = utf8mb4 */; 405 | CREATE TABLE `global_setting` ( 406 | `label` varchar(24) NOT NULL, 407 | `value` text NOT NULL 408 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 409 | /*!40101 SET character_set_client = @saved_cs_client */; 410 | 411 | -- 412 | -- Table structure for table `invite` 413 | -- 414 | 415 | /*!40101 SET @saved_cs_client = @@character_set_client */; 416 | /*!50503 SET character_set_client = utf8mb4 */; 417 | CREATE TABLE `invite` ( 418 | `invite_id` int(11) NOT NULL AUTO_INCREMENT, 419 | `user_id` varchar(128) NOT NULL, 420 | `invite_code` varchar(96) NOT NULL, 421 | `valid_date` datetime NOT NULL, 422 | `valid_time` int(11) NOT NULL, 423 | PRIMARY KEY (`invite_id`), 424 | UNIQUE KEY `invite_code_invite_id_uindex` (`invite_id`), 425 | UNIQUE KEY `invite_code_invite_code_uindex` (`invite_code`), 426 | KEY `invite_code_user_id_index` (`user_id`), 427 | KEY `invite_code_valid_date_index` (`valid_date`) 428 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 429 | /*!40101 SET character_set_client = @saved_cs_client */; 430 | 431 | -- 432 | -- Table structure for table `invited_user` 433 | -- 434 | 435 | /*!40101 SET @saved_cs_client = @@character_set_client */; 436 | /*!50503 SET character_set_client = utf8mb4 */; 437 | CREATE TABLE `invited_user` ( 438 | `user_id` varchar(64) NOT NULL, 439 | `inviter` varchar(64) NOT NULL, 440 | `invite_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 441 | `invite_code` varchar(96) NOT NULL, 442 | PRIMARY KEY (`user_id`), 443 | UNIQUE KEY `invited_user_user_id_uindex` (`user_id`) 444 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 445 | /*!40101 SET character_set_client = @saved_cs_client */; 446 | 447 | -- 448 | -- Table structure for table `label_list` 449 | -- 450 | 451 | /*!40101 SET @saved_cs_client = @@character_set_client */; 452 | /*!50503 SET character_set_client = utf8mb4 */; 453 | CREATE TABLE `label_list` ( 454 | `label_name` varchar(20) NOT NULL, 455 | `label_id` int(11) NOT NULL AUTO_INCREMENT, 456 | `prev_label_id` int(11) NOT NULL DEFAULT '-1', 457 | PRIMARY KEY (`label_id`), 458 | KEY `label_list_label_name_index` (`label_name`) 459 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 460 | /*!40101 SET character_set_client = @saved_cs_client */; 461 | 462 | -- 463 | -- Table structure for table `loginlog` 464 | -- 465 | 466 | /*!40101 SET @saved_cs_client = @@character_set_client */; 467 | /*!50503 SET character_set_client = utf8mb4 */; 468 | CREATE TABLE `loginlog` ( 469 | `user_id` varchar(48) NOT NULL DEFAULT '', 470 | `password` varchar(40) DEFAULT NULL, 471 | `ip` varchar(100) DEFAULT NULL, 472 | `time` datetime DEFAULT NULL, 473 | `browser_name` varchar(30) DEFAULT NULL, 474 | `browser_version` varchar(10) DEFAULT NULL, 475 | `os_name` varchar(35) DEFAULT NULL, 476 | `os_version` varchar(10) DEFAULT NULL, 477 | KEY `user_log_index` (`user_id`,`time`), 478 | KEY `loginlog_time_index` (`time` DESC) 479 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 480 | /*!40101 SET character_set_client = @saved_cs_client */; 481 | 482 | -- 483 | -- Table structure for table `mail` 484 | -- 485 | 486 | /*!40101 SET @saved_cs_client = @@character_set_client */; 487 | /*!50503 SET character_set_client = utf8mb4 */; 488 | CREATE TABLE `mail` ( 489 | `mail_id` int(11) NOT NULL AUTO_INCREMENT, 490 | `to_user` varchar(48) NOT NULL DEFAULT '', 491 | `from_user` varchar(48) NOT NULL DEFAULT '', 492 | `title` varchar(200) NOT NULL DEFAULT '', 493 | `content` text, 494 | `new_mail` tinyint(1) NOT NULL DEFAULT '1', 495 | `reply` tinyint(4) DEFAULT '0', 496 | `in_date` datetime DEFAULT NULL, 497 | `defunct` char(1) NOT NULL DEFAULT 'N', 498 | PRIMARY KEY (`mail_id`), 499 | KEY `uid` (`to_user`) 500 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 501 | /*!40101 SET character_set_client = @saved_cs_client */; 502 | 503 | -- 504 | -- Table structure for table `maintain_info` 505 | -- 506 | 507 | /*!40101 SET @saved_cs_client = @@character_set_client */; 508 | /*!50503 SET character_set_client = utf8mb4 */; 509 | CREATE TABLE `maintain_info` ( 510 | `mtime` date NOT NULL, 511 | `msg` text NOT NULL, 512 | `version` varchar(20) DEFAULT NULL, 513 | `vj_version` varchar(20) DEFAULT NULL, 514 | `frontend_version` varchar(20) DEFAULT '' 515 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 516 | /*!40101 SET character_set_client = @saved_cs_client */; 517 | 518 | -- 519 | -- Table structure for table `mention` 520 | -- 521 | 522 | /*!40101 SET @saved_cs_client = @@character_set_client */; 523 | /*!50503 SET character_set_client = utf8mb4 */; 524 | CREATE TABLE `mention` ( 525 | `user_id` varchar(40) NOT NULL, 526 | `article_id` int(11) NOT NULL, 527 | `comment_id` int(11) NOT NULL, 528 | `viewed` tinyint(1) NOT NULL DEFAULT '0', 529 | KEY `mention_article_id_index` (`article_id`), 530 | KEY `mention_user_id_index` (`user_id`) 531 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 532 | /*!40101 SET character_set_client = @saved_cs_client */; 533 | 534 | -- 535 | -- Table structure for table `news` 536 | -- 537 | 538 | /*!40101 SET @saved_cs_client = @@character_set_client */; 539 | /*!50503 SET character_set_client = utf8mb4 */; 540 | CREATE TABLE `news` ( 541 | `news_id` int(11) NOT NULL AUTO_INCREMENT, 542 | `user_id` varchar(48) NOT NULL DEFAULT '', 543 | `title` varchar(200) NOT NULL DEFAULT '', 544 | `content` text NOT NULL, 545 | `time` datetime NOT NULL DEFAULT '2016-05-13 19:24:00', 546 | `importance` tinyint(4) NOT NULL DEFAULT '0', 547 | `defunct` char(1) NOT NULL DEFAULT 'N', 548 | PRIMARY KEY (`news_id`) 549 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 550 | /*!40101 SET character_set_client = @saved_cs_client */; 551 | 552 | -- 553 | -- Table structure for table `online` 554 | -- 555 | 556 | /*!40101 SET @saved_cs_client = @@character_set_client */; 557 | /*!50503 SET character_set_client = utf8mb4 */; 558 | CREATE TABLE `online` ( 559 | `hash` varchar(32) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL, 560 | `ip` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', 561 | `ua` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', 562 | `refer` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, 563 | `lastmove` int(10) NOT NULL, 564 | `firsttime` int(10) DEFAULT NULL, 565 | `uri` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL, 566 | PRIMARY KEY (`hash`), 567 | UNIQUE KEY `hash` (`hash`) 568 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 569 | /*!40101 SET character_set_client = @saved_cs_client */; 570 | 571 | -- 572 | -- Table structure for table `prefile` 573 | -- 574 | 575 | /*!40101 SET @saved_cs_client = @@character_set_client */; 576 | /*!50503 SET character_set_client = utf8mb4 */; 577 | CREATE TABLE `prefile` ( 578 | `problem_id` int(11) NOT NULL, 579 | `prepend` tinyint(4) NOT NULL, 580 | `code` text NOT NULL, 581 | `type` varchar(4) NOT NULL 582 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 583 | /*!40101 SET character_set_client = @saved_cs_client */; 584 | 585 | -- 586 | -- Table structure for table `privilege` 587 | -- 588 | 589 | /*!40101 SET @saved_cs_client = @@character_set_client */; 590 | /*!50503 SET character_set_client = utf8mb4 */; 591 | CREATE TABLE `privilege` ( 592 | `user_id` char(48) NOT NULL DEFAULT '', 593 | `rightstr` char(30) NOT NULL DEFAULT '', 594 | `defunct` char(1) NOT NULL DEFAULT 'N' 595 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 596 | /*!40101 SET character_set_client = @saved_cs_client */; 597 | 598 | -- 599 | -- Table structure for table `problem` 600 | -- 601 | 602 | /*!40101 SET @saved_cs_client = @@character_set_client */; 603 | /*!50503 SET character_set_client = utf8mb4 */; 604 | CREATE TABLE `problem` ( 605 | `problem_id` int(11) NOT NULL AUTO_INCREMENT, 606 | `title` varchar(200) NOT NULL DEFAULT '', 607 | `description` mediumtext, 608 | `input` text, 609 | `output` text, 610 | `sample_input` text, 611 | `sample_output` text, 612 | `spj` char(1) NOT NULL DEFAULT '0', 613 | `hint` text, 614 | `source` varchar(100) DEFAULT NULL, 615 | `label` varchar(100) DEFAULT NULL, 616 | `in_date` datetime DEFAULT NULL, 617 | `time_limit` double NOT NULL DEFAULT '0', 618 | `memory_limit` int(11) NOT NULL DEFAULT '0', 619 | `defunct` char(1) NOT NULL DEFAULT 'N', 620 | `accepted` int(11) DEFAULT '0', 621 | `submit` int(11) DEFAULT '0', 622 | `solved` int(11) DEFAULT '0', 623 | `fill_in_blank_problem` int(11) NOT NULL DEFAULT '0', 624 | PRIMARY KEY (`problem_id`), 625 | KEY `problem_defunct_problem_id_index` (`defunct`,`problem_id`), 626 | KEY `problem_defunct_in_date_index` (`defunct`,`in_date`), 627 | KEY `problem_defunct_in_date_index_2` (`defunct`,`in_date` DESC), 628 | KEY `problem_defunct_index` (`defunct`), 629 | KEY `problem_accepted_index` (`accepted`), 630 | KEY `problem_accepted_index_2` (`accepted` DESC), 631 | KEY `problem_submit_index` (`submit`), 632 | KEY `problem_submit_index_2` (`submit` DESC) 633 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 634 | /*!40101 SET character_set_client = @saved_cs_client */; 635 | 636 | -- 637 | -- Table structure for table `runtimeinfo` 638 | -- 639 | 640 | /*!40101 SET @saved_cs_client = @@character_set_client */; 641 | /*!50503 SET character_set_client = utf8mb4 */; 642 | CREATE TABLE `runtimeinfo` ( 643 | `solution_id` int(11) NOT NULL DEFAULT '0', 644 | `error` text, 645 | PRIMARY KEY (`solution_id`) 646 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 647 | /*!40101 SET character_set_client = @saved_cs_client */; 648 | 649 | -- 650 | -- Table structure for table `sim` 651 | -- 652 | 653 | /*!40101 SET @saved_cs_client = @@character_set_client */; 654 | /*!50503 SET character_set_client = utf8mb4 */; 655 | CREATE TABLE `sim` ( 656 | `s_id` int(11) NOT NULL, 657 | `sim_s_id` int(11) DEFAULT NULL, 658 | `sim` int(11) DEFAULT NULL, 659 | `s_user_id` char(48) DEFAULT NULL, 660 | `s_s_user_id` char(48) DEFAULT NULL, 661 | PRIMARY KEY (`s_id`), 662 | KEY `sim_s_id_index` (`s_id`), 663 | KEY `sim_s_user_id_index` (`s_user_id`) 664 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 665 | /*!40101 SET character_set_client = @saved_cs_client */; 666 | /*!50003 SET @saved_cs_client = @@character_set_client */ ; 667 | /*!50003 SET @saved_cs_results = @@character_set_results */ ; 668 | /*!50003 SET @saved_col_connection = @@collation_connection */ ; 669 | /*!50003 SET character_set_client = utf8mb4 */ ; 670 | /*!50003 SET character_set_results = utf8mb4 */ ; 671 | /*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ; 672 | /*!50003 SET @saved_sql_mode = @@sql_mode */ ; 673 | /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ; 674 | DELIMITER ;; 675 | /*!50003 CREATE*/ /*!50017 DEFINER=`cupoj`@`%`*/ /*!50003 TRIGGER `sim_update_name` BEFORE INSERT ON `sim` FOR EACH ROW BEGIN 676 | set NEW.s_user_id = (select user_id from solution where solution_id = new.s_id limit 1); 677 | set NEW.s_s_user_id = (select user_id from solution where solution_id = new.sim_s_id limit 1); 678 | END */;; 679 | DELIMITER ; 680 | /*!50003 SET sql_mode = @saved_sql_mode */ ; 681 | /*!50003 SET character_set_client = @saved_cs_client */ ; 682 | /*!50003 SET character_set_results = @saved_cs_results */ ; 683 | /*!50003 SET collation_connection = @saved_col_connection */ ; 684 | 685 | -- 686 | -- Table structure for table `solution` 687 | -- 688 | 689 | /*!40101 SET @saved_cs_client = @@character_set_client */; 690 | /*!50503 SET character_set_client = utf8mb4 */; 691 | CREATE TABLE `solution` ( 692 | `solution_id` int(11) NOT NULL AUTO_INCREMENT, 693 | `problem_id` int(11) NOT NULL DEFAULT '0', 694 | `user_id` char(48) NOT NULL, 695 | `time` int(11) NOT NULL DEFAULT '0', 696 | `memory` int(11) NOT NULL DEFAULT '0', 697 | `in_date` datetime NOT NULL DEFAULT '2016-05-13 19:24:00', 698 | `result` smallint(6) NOT NULL DEFAULT '0', 699 | `language` int(10) unsigned NOT NULL DEFAULT '0', 700 | `ip` char(100) NOT NULL, 701 | `contest_id` int(11) DEFAULT NULL, 702 | `topic_id` int(11) DEFAULT NULL, 703 | `valid` tinyint(4) NOT NULL DEFAULT '1', 704 | `pass_point` tinyint(3) DEFAULT '0', 705 | `num` tinyint(4) NOT NULL DEFAULT '-1', 706 | `code_length` int(11) NOT NULL DEFAULT '0', 707 | `judgetime` timestamp NULL DEFAULT CURRENT_TIMESTAMP, 708 | `pass_rate` decimal(3,2) unsigned NOT NULL DEFAULT '0.00', 709 | `judger` char(16) NOT NULL DEFAULT 'LOCAL', 710 | `share` tinyint(1) DEFAULT '0', 711 | `fingerprint` varchar(40) DEFAULT NULL, 712 | `fingerprintRaw` varchar(40) DEFAULT NULL, 713 | PRIMARY KEY (`solution_id`), 714 | KEY `uid` (`user_id`), 715 | KEY `pid` (`problem_id`), 716 | KEY `res` (`result`), 717 | KEY `cid` (`contest_id`), 718 | KEY `solution_time_index` (`time`), 719 | KEY `solution_in_date_index` (`in_date`), 720 | KEY `solution_memory_index` (`memory`), 721 | KEY `solution_in_date_result_index` (`in_date`,`result`), 722 | KEY `solution_solution_id_index` (`solution_id`), 723 | KEY `solution_result_solution_id_index` (`result`,`solution_id`), 724 | KEY `solution_solution_id_problem_id_index` (`solution_id`,`problem_id`) 725 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 726 | /*!40101 SET character_set_client = @saved_cs_client */; 727 | /*!50003 SET @saved_cs_client = @@character_set_client */ ; 728 | /*!50003 SET @saved_cs_results = @@character_set_results */ ; 729 | /*!50003 SET @saved_col_connection = @@collation_connection */ ; 730 | /*!50003 SET character_set_client = utf8mb4 */ ; 731 | /*!50003 SET character_set_results = utf8mb4 */ ; 732 | /*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ; 733 | /*!50003 SET @saved_sql_mode = @@sql_mode */ ; 734 | /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES' */ ; 735 | DELIMITER ;; 736 | /*!50003 CREATE*/ /*!50017 DEFINER=`cupoj`@`%`*/ /*!50003 TRIGGER `subaccountResultCopy` BEFORE INSERT ON `solution` FOR EACH ROW BEGIN 737 | declare e int; 738 | set e = (SELECT EXISTS( 739 | SELECT * 740 | FROM users_account 741 | WHERE cup = NEW.user_id)); 742 | if e = 1 then begin 743 | insert into vjudge_record (user_id,oj_name,problem_id,time,result,time_running,memory,code_length,language) 744 | values ((select user_id from users_account where cup = new.user_id), 745 | "CUP",new.problem_id,new.in_date,new.result,new.time,new.memory,new.code_length,new.language); 746 | end; END IF; 747 | END */;; 748 | DELIMITER ; 749 | /*!50003 SET sql_mode = @saved_sql_mode */ ; 750 | /*!50003 SET character_set_client = @saved_cs_client */ ; 751 | /*!50003 SET character_set_results = @saved_cs_results */ ; 752 | /*!50003 SET collation_connection = @saved_col_connection */ ; 753 | /*!50003 SET @saved_cs_client = @@character_set_client */ ; 754 | /*!50003 SET @saved_cs_results = @@character_set_results */ ; 755 | /*!50003 SET @saved_col_connection = @@collation_connection */ ; 756 | /*!50003 SET character_set_client = utf8mb4 */ ; 757 | /*!50003 SET character_set_results = utf8mb4 */ ; 758 | /*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ; 759 | /*!50003 SET @saved_sql_mode = @@sql_mode */ ; 760 | /*!50003 SET sql_mode = 'STRICT_TRANS_TABLES' */ ; 761 | DELIMITER ;; 762 | /*!50003 CREATE*/ /*!50017 DEFINER=`cupoj`@`%`*/ /*!50003 TRIGGER `subaccountResultCopyUpdate` BEFORE UPDATE ON `solution` FOR EACH ROW BEGIN 763 | declare e int; 764 | set e = (SELECT EXISTS( 765 | SELECT * 766 | FROM users_account 767 | WHERE cup = NEW.user_id)); 768 | if e = 1 then begin 769 | update vjudge_record set result = new.result ,time_running = new.time ,memory = new.memory 770 | where time = new.in_date; 771 | end; END IF; 772 | END */;; 773 | DELIMITER ; 774 | /*!50003 SET sql_mode = @saved_sql_mode */ ; 775 | /*!50003 SET character_set_client = @saved_cs_client */ ; 776 | /*!50003 SET character_set_results = @saved_cs_results */ ; 777 | /*!50003 SET collation_connection = @saved_col_connection */ ; 778 | 779 | -- 780 | -- Table structure for table `source_code` 781 | -- 782 | 783 | /*!40101 SET @saved_cs_client = @@character_set_client */; 784 | /*!50503 SET character_set_client = utf8mb4 */; 785 | CREATE TABLE `source_code` ( 786 | `solution_id` int(11) NOT NULL, 787 | `source` text NOT NULL, 788 | PRIMARY KEY (`solution_id`) 789 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 790 | /*!40101 SET character_set_client = @saved_cs_client */; 791 | 792 | -- 793 | -- Table structure for table `source_code_user` 794 | -- 795 | 796 | /*!40101 SET @saved_cs_client = @@character_set_client */; 797 | /*!50503 SET character_set_client = utf8mb4 */; 798 | CREATE TABLE `source_code_user` ( 799 | `solution_id` int(11) NOT NULL, 800 | `source` text NOT NULL, 801 | `hash` varchar(64) DEFAULT NULL, 802 | PRIMARY KEY (`solution_id`), 803 | KEY `source_code_user_hash_index` (`hash`), 804 | KEY `source_code_user_solution_id_index` (`solution_id`) 805 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 806 | /*!40101 SET character_set_client = @saved_cs_client */; 807 | 808 | -- 809 | -- Table structure for table `special_subject` 810 | -- 811 | 812 | /*!40101 SET @saved_cs_client = @@character_set_client */; 813 | /*!50503 SET character_set_client = utf8mb4 */; 814 | CREATE TABLE `special_subject` ( 815 | `topic_id` int(11) NOT NULL AUTO_INCREMENT, 816 | `title` varchar(255) NOT NULL, 817 | `defunct` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL, 818 | `description` text NOT NULL, 819 | `private` tinyint(4) NOT NULL, 820 | `vjudge` tinyint(4) NOT NULL DEFAULT '0', 821 | `langmask` int(11) NOT NULL, 822 | `password` char(16) NOT NULL, 823 | PRIMARY KEY (`topic_id`), 824 | UNIQUE KEY `special_subject_title_pk` (`title`) 825 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 826 | /*!40101 SET character_set_client = @saved_cs_client */; 827 | 828 | -- 829 | -- Table structure for table `special_subject_problem` 830 | -- 831 | 832 | /*!40101 SET @saved_cs_client = @@character_set_client */; 833 | /*!50503 SET character_set_client = utf8mb4 */; 834 | CREATE TABLE `special_subject_problem` ( 835 | `problem_id` int(11) NOT NULL DEFAULT '0', 836 | `topic_id` int(11) DEFAULT NULL, 837 | `title` char(200) DEFAULT NULL, 838 | `oj_name` char(20) DEFAULT NULL, 839 | `num` int(11) NOT NULL 840 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 841 | /*!40101 SET character_set_client = @saved_cs_client */; 842 | 843 | -- 844 | -- Table structure for table `switch` 845 | -- 846 | 847 | /*!40101 SET @saved_cs_client = @@character_set_client */; 848 | /*!50503 SET character_set_client = utf8mb4 */; 849 | CREATE TABLE `switch` ( 850 | `key` varchar(128) NOT NULL, 851 | `value` int(4) NOT NULL DEFAULT '0', 852 | `comment` varchar(128) DEFAULT '', 853 | `modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 854 | `createdAt` datetime NOT NULL, 855 | `updatedAt` datetime NOT NULL, 856 | PRIMARY KEY (`key`) 857 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 858 | /*!40101 SET character_set_client = @saved_cs_client */; 859 | 860 | -- 861 | -- Table structure for table `switch_log` 862 | -- 863 | 864 | /*!40101 SET @saved_cs_client = @@character_set_client */; 865 | /*!50503 SET character_set_client = utf8mb4 */; 866 | CREATE TABLE `switch_log` ( 867 | `id` bigint(20) NOT NULL AUTO_INCREMENT, 868 | `operation` int(4) NOT NULL, 869 | `key` varchar(128) NOT NULL, 870 | `value` int(11) NOT NULL, 871 | `comment` varchar(1024) NOT NULL, 872 | `createdAt` datetime NOT NULL, 873 | `updatedAt` datetime NOT NULL, 874 | PRIMARY KEY (`id`) 875 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 876 | /*!40101 SET character_set_client = @saved_cs_client */; 877 | 878 | -- 879 | -- Table structure for table `topic` 880 | -- 881 | 882 | /*!40101 SET @saved_cs_client = @@character_set_client */; 883 | /*!50503 SET character_set_client = utf8mb4 */; 884 | CREATE TABLE `topic_assistant` ( 885 | `topic_id` int(11) NOT NULL, 886 | `topic_assistant_id` int(11) NOT NULL AUTO_INCREMENT, 887 | `user_id` varchar(64) NOT NULL, 888 | PRIMARY KEY (`topic_assistant_id`), 889 | KEY `topic_assistant_topic_id_index` (`topic_id`), 890 | KEY `topic_assistant_topic_id_user_id_index` (`topic_id`,`user_id`), 891 | KEY `topic_assistant_user_id_index` (`user_id`) 892 | ) ENGINE=InnoDB AUTO_INCREMENT=1976 DEFAULT CHARSET=utf8; 893 | /*!40101 SET character_set_client = @saved_cs_client */; 894 | 895 | -- 896 | -- Table structure for table `tutorial` 897 | -- 898 | 899 | /*!40101 SET @saved_cs_client = @@character_set_client */; 900 | /*!50503 SET character_set_client = utf8mb4 */; 901 | CREATE TABLE `tutorial` ( 902 | `tutorial_id` int(11) NOT NULL AUTO_INCREMENT, 903 | `problem_id` int(11) NOT NULL, 904 | `content` text NOT NULL, 905 | `in_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 906 | `user_id` varchar(30) NOT NULL, 907 | `solution_id` int(11) NOT NULL, 908 | `source` varchar(10) NOT NULL DEFAULT 'local', 909 | `like` int(11) NOT NULL DEFAULT '0', 910 | `dislike` int(11) NOT NULL DEFAULT '0', 911 | PRIMARY KEY (`tutorial_id`) 912 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 913 | /*!40101 SET character_set_client = @saved_cs_client */; 914 | 915 | -- 916 | -- Table structure for table `tutorial_like` 917 | -- 918 | 919 | /*!40101 SET @saved_cs_client = @@character_set_client */; 920 | /*!50503 SET character_set_client = utf8mb4 */; 921 | CREATE TABLE `tutorial_like` ( 922 | `user_id` varchar(40) NOT NULL, 923 | `tutorial_id` int(11) NOT NULL, 924 | `type` int(11) NOT NULL DEFAULT '0', 925 | KEY `tutorial_like_tutorial_tutorial_id_fk` (`tutorial_id`), 926 | CONSTRAINT `tutorial_like_tutorial_tutorial_id_fk` FOREIGN KEY (`tutorial_id`) REFERENCES `tutorial` (`tutorial_id`) ON DELETE CASCADE ON UPDATE CASCADE 927 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 928 | /*!40101 SET character_set_client = @saved_cs_client */; 929 | 930 | -- 931 | -- Table structure for table `users` 932 | -- 933 | 934 | /*!40101 SET @saved_cs_client = @@character_set_client */; 935 | /*!50503 SET character_set_client = utf8mb4 */; 936 | CREATE TABLE `users` ( 937 | `user_id` varchar(48) NOT NULL DEFAULT '', 938 | `email` varchar(100) DEFAULT NULL, 939 | `submit` int(11) DEFAULT '0', 940 | `solved` int(11) DEFAULT '0', 941 | `vjudge_submit` int(11) DEFAULT '0', 942 | `vjudge_accept` int(11) DEFAULT '0', 943 | `vjudge_solved` int(11) DEFAULT '0', 944 | `defunct` char(1) NOT NULL DEFAULT 'N', 945 | `ip` varchar(20) NOT NULL DEFAULT '', 946 | `accesstime` datetime DEFAULT NULL, 947 | `volume` int(11) NOT NULL DEFAULT '1', 948 | `language` int(11) NOT NULL DEFAULT '1', 949 | `password` varchar(32) DEFAULT NULL, 950 | `newpassword` varchar(64) DEFAULT NULL, 951 | `authcode` varchar(32) DEFAULT NULL, 952 | `reg_time` datetime DEFAULT NULL, 953 | `nick` varchar(100) NOT NULL DEFAULT '', 954 | `school` varchar(100) NOT NULL DEFAULT '', 955 | `confirmquestion` char(100) DEFAULT NULL, 956 | `confirmanswer` varchar(100) DEFAULT NULL, 957 | `avatar` tinyint(1) DEFAULT '0', 958 | `money` int(11) NOT NULL DEFAULT '0', 959 | `blog` text, 960 | `github` text, 961 | `biography` text, 962 | `avatarUrl` varchar(100) DEFAULT NULL, 963 | PRIMARY KEY (`user_id`), 964 | KEY `users_solved_submit_reg_time_index` (`solved` DESC,`submit`,`reg_time`) 965 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 966 | /*!40101 SET character_set_client = @saved_cs_client */; 967 | 968 | -- 969 | -- Table structure for table `users_account` 970 | -- 971 | 972 | /*!40101 SET @saved_cs_client = @@character_set_client */; 973 | /*!50503 SET character_set_client = utf8mb4 */; 974 | CREATE TABLE `users_account` ( 975 | `user_id` varchar(48) NOT NULL DEFAULT '', 976 | `hdu` varchar(48) DEFAULT NULL, 977 | `poj` varchar(48) DEFAULT NULL, 978 | `codeforces` varchar(48) DEFAULT NULL, 979 | `uva` varchar(48) DEFAULT NULL, 980 | `vjudge` varchar(48) DEFAULT NULL, 981 | `hustoj-upc` varchar(48) DEFAULT NULL, 982 | `upcvj` varchar(48) DEFAULT NULL, 983 | `cup` varchar(48) DEFAULT NULL 984 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 985 | /*!40101 SET character_set_client = @saved_cs_client */; 986 | 987 | -- 988 | -- Table structure for table `vjudge_accept_language` 989 | -- 990 | 991 | /*!40101 SET @saved_cs_client = @@character_set_client */; 992 | /*!50503 SET character_set_client = utf8mb4 */; 993 | CREATE TABLE `vjudge_accept_language` ( 994 | `problem_id` int(11) NOT NULL, 995 | `accept_language` text NOT NULL, 996 | `source` varchar(12) NOT NULL 997 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 998 | /*!40101 SET character_set_client = @saved_cs_client */; 999 | 1000 | -- 1001 | -- Table structure for table `vjudge_custom_input` 1002 | -- 1003 | 1004 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1005 | /*!50503 SET character_set_client = utf8mb4 */; 1006 | CREATE TABLE `vjudge_custom_input` ( 1007 | `solution_id` int(11) NOT NULL, 1008 | `input_text` text 1009 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 1010 | /*!40101 SET character_set_client = @saved_cs_client */; 1011 | 1012 | -- 1013 | -- Table structure for table `vjudge_label_list` 1014 | -- 1015 | 1016 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1017 | /*!50503 SET character_set_client = utf8mb4 */; 1018 | CREATE TABLE `vjudge_label_list` ( 1019 | `label_name` varchar(30) NOT NULL, 1020 | `label_id` int(11) NOT NULL AUTO_INCREMENT, 1021 | `prev_label_id` int(11) NOT NULL DEFAULT '-1', 1022 | PRIMARY KEY (`label_id`), 1023 | UNIQUE KEY `vjudge_label_list_label_id_uindex` (`label_id`), 1024 | KEY `table_name_label_name_index` (`label_name`) 1025 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 1026 | /*!40101 SET character_set_client = @saved_cs_client */; 1027 | 1028 | -- 1029 | -- Table structure for table `vjudge_original_problem` 1030 | -- 1031 | 1032 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1033 | /*!50503 SET character_set_client = utf8mb4 */; 1034 | CREATE TABLE `vjudge_original_problem` ( 1035 | `original_problem_id` varchar(48) NOT NULL, 1036 | `problem_id` int(11) NOT NULL, 1037 | `source` varchar(10) NOT NULL, 1038 | PRIMARY KEY (`original_problem_id`) 1039 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 1040 | /*!40101 SET character_set_client = @saved_cs_client */; 1041 | 1042 | -- 1043 | -- Table structure for table `vjudge_problem` 1044 | -- 1045 | 1046 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1047 | /*!50503 SET character_set_client = utf8mb4 */; 1048 | CREATE TABLE `vjudge_problem` ( 1049 | `problem_id` int(11) NOT NULL, 1050 | `vjudge_id` int(11) NOT NULL AUTO_INCREMENT, 1051 | `title` varchar(100) NOT NULL, 1052 | `label` varchar(100) DEFAULT NULL, 1053 | `description` text, 1054 | `input` text, 1055 | `output` text, 1056 | `sample_input` text, 1057 | `sample_output` text, 1058 | `accepted` int(11) DEFAULT '0', 1059 | `submit` int(11) DEFAULT '0', 1060 | `time_limit` int(11) NOT NULL, 1061 | `memory_limit` int(11) DEFAULT NULL, 1062 | `source` varchar(10) NOT NULL, 1063 | `spj` tinyint(4) DEFAULT '0', 1064 | `defunct` varchar(3) DEFAULT 'N', 1065 | `in_date` datetime DEFAULT CURRENT_TIMESTAMP, 1066 | PRIMARY KEY (`vjudge_id`), 1067 | KEY `vjudge_problem_problemset` (`source`), 1068 | KEY `vjudge_problem_problem` (`source`,`problem_id`), 1069 | KEY `title` (`title`) 1070 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 1071 | /*!40101 SET character_set_client = @saved_cs_client */; 1072 | 1073 | -- 1074 | -- Table structure for table `vjudge_record` 1075 | -- 1076 | 1077 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1078 | /*!50503 SET character_set_client = utf8mb4 */; 1079 | CREATE TABLE `vjudge_record` ( 1080 | `user_id` varchar(48) NOT NULL, 1081 | `oj_name` varchar(30) NOT NULL, 1082 | `problem_id` varchar(20) NOT NULL, 1083 | `time` datetime NOT NULL, 1084 | `result` int(11) NOT NULL DEFAULT '4', 1085 | `time_running` int(11) NOT NULL DEFAULT '0', 1086 | `memory` int(11) NOT NULL DEFAULT '0', 1087 | `code_length` int(11) NOT NULL DEFAULT '0', 1088 | `language` varchar(25) NOT NULL DEFAULT 'C++', 1089 | KEY `vjudge_record_user_id_index` (`user_id`) 1090 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 1091 | /*!40101 SET character_set_client = @saved_cs_client */; 1092 | 1093 | -- 1094 | -- Table structure for table `vjudge_solution` 1095 | -- 1096 | 1097 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1098 | /*!50503 SET character_set_client = utf8mb4 */; 1099 | CREATE TABLE `vjudge_solution` ( 1100 | `runner_id` text, 1101 | `solution_id` int(11) NOT NULL AUTO_INCREMENT, 1102 | `problem_id` int(11) NOT NULL DEFAULT '0', 1103 | `user_id` char(48) NOT NULL, 1104 | `time` int(11) NOT NULL DEFAULT '0', 1105 | `memory` int(11) NOT NULL DEFAULT '0', 1106 | `in_date` datetime NOT NULL DEFAULT '2016-05-13 19:24:00', 1107 | `result` smallint(6) NOT NULL DEFAULT '0', 1108 | `language` int(10) unsigned NOT NULL DEFAULT '0', 1109 | `ip` char(42) NOT NULL, 1110 | `contest_id` int(11) DEFAULT NULL, 1111 | `num` tinyint(4) NOT NULL DEFAULT '-1', 1112 | `code_length` int(11) NOT NULL DEFAULT '0', 1113 | `oj_name` varchar(24) NOT NULL, 1114 | `judger` varchar(24) NOT NULL, 1115 | `ustatus` tinyint(1) DEFAULT '0', 1116 | `share` tinyint(1) DEFAULT '0', 1117 | PRIMARY KEY (`solution_id`), 1118 | KEY `pid` (`problem_id`), 1119 | KEY `uid` (`user_id`), 1120 | KEY `cid` (`contest_id`), 1121 | KEY `sid` (`solution_id`), 1122 | KEY `problemfrom` (`oj_name`,`problem_id`), 1123 | KEY `vjudge_solution_time_index` (`time`) 1124 | ) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8; 1125 | /*!40101 SET character_set_client = @saved_cs_client */; 1126 | 1127 | -- 1128 | -- Table structure for table `vjudge_source` 1129 | -- 1130 | 1131 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1132 | /*!50503 SET character_set_client = utf8mb4 */; 1133 | CREATE TABLE `vjudge_source` ( 1134 | `source_id` int(11) NOT NULL AUTO_INCREMENT, 1135 | `name` varchar(20) NOT NULL, 1136 | PRIMARY KEY (`source_id`), 1137 | UNIQUE KEY `vjudge_source_name_uindex` (`name`) 1138 | ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; 1139 | /*!40101 SET character_set_client = @saved_cs_client */; 1140 | 1141 | -- 1142 | -- Table structure for table `vjudge_source_code` 1143 | -- 1144 | 1145 | /*!40101 SET @saved_cs_client = @@character_set_client */; 1146 | /*!50503 SET character_set_client = utf8mb4 */; 1147 | CREATE TABLE `vjudge_source_code` ( 1148 | `solution_id` int(11) NOT NULL, 1149 | `source` text NOT NULL 1150 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 1151 | /*!40101 SET character_set_client = @saved_cs_client */; 1152 | /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; 1153 | 1154 | /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; 1155 | /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; 1156 | /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; 1157 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; 1158 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; 1159 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 1160 | /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; 1161 | 1162 | CREATE USER 'cupoj'@'%' IDENTIFIED BY 'root'; 1163 | GRANT ALL ON *.* TO 'cupoj'@'%'; 1164 | flush privileges; 1165 | 1166 | INSERT INTO global_setting(label, value) values('contest', '0'); 1167 | INSERT INTO global_setting(label, value) values('closed', '0'); 1168 | INSERT INTO global_setting(label, value) values('email', '0'); 1169 | INSERT INTO global_setting(label, value) values('view_own_code', '1'); 1170 | INSERT INTO global_setting(label, value) values('label_color', '{}'); 1171 | -- Dump completed on 2020-04-06 5:36:47 1172 | --------------------------------------------------------------------------------