S2OJ/install/db/install.sh
Masco Skray d413b746eb chore(install): separate services with docker-compose support
Without bundle, now you can choose to download single container.
For example, you can only download judger container to setup a new judger.
Also, the web container now no db and judger containing, except local sandbox.
You can use docker-compose to get every single container work together from now.
Single DB this time uses the latest MySQL 8 version, so some preferences are different.
2019-07-16 17:26:05 +08:00

30 lines
993 B
Bash

#!/bin/bash
setLAMPConf(){
printf "\n\n==> Setting LAMP configs\n"
#Set MySQL connection config
cat >/etc/mysql/conf.d/uoj_mysqld.cnf <<UOJEOF
[mysqld]
default-time-zone='+8:00'
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init_connect='SET NAMES utf8mb4'
init_connect='SET collation_connection = utf8mb4_unicode_ci'
skip-character-set-client-handshake
sql-mode=ONLY_FULL_GROUP_BY,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
UOJEOF
}
setWebConf(){
printf "\n\n==> Setting web files\n"
#Import MySQL database
cat >/docker-entrypoint-initdb.d/000-native_password.sql <<UOJEOF
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
UOJEOF
curl $RAW_URL/install/db/app_uoj233.sql >/docker-entrypoint-initdb.d/001-app_uoj233.sql
curl $RAW_URL/install/judger/add_judger.sql >/docker-entrypoint-initdb.d/002-add_judger.sql
}
echo 'Preparing UOJ System db environment...'
setLAMPConf;setWebConf