# ip=192.168.1.11

docker network create qingful2

# 安装mysql2
docker run -p 33060:3306 --restart always -v /etc/localtime:/etc/localtime:ro -e MYSQL_ROOT_PASSWORD=xxxx -v ~/mysql2/data:/var/lib/mysql -v ~/mysql2/log:/var/log/mysql -v ~/mysql2/conf:/etc/mysql/conf.d --name mysql2 --net qingful2 -d registry.cn-hangzhou.aliyuncs.com/qingful/mysql:8.0.19 --default-authentication-plugin=mysql_native_password

sleep 30

# 创建数据库
docker exec -e MYSQL_PWD=xxxx -it mysql2 mysql -uroot -e "CREATE DATABASE human_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

# 安装phpmyadmin2
# docker run -p 3082:80 --restart always -v /etc/localtime:/etc/localtime:ro -e PMA_HOST=mysql2 -e PMA_PORT=3306 -e UPLOAD_LIMIT=200M --link mysql2 --name phpmyadmin2 --net qingful2 -d registry.cn-hangzhou.aliyuncs.com/qingful/phpmyadmin

docker run -p 8000:3000 --restart always -v /var/run/docker.sock:/var/run/docker.sock -v /etc/localtime:/etc/localtime:ro -v ~/license.txt:/www/license.txt -v ~/kf.png:/www/static/kf.png -v ~/logo.png:/www/static/logo.png -v ~/config.yml:/www/config.yml -v ~/lives:/www/public/lives -v ~/upload:/www/public/upload -v ~/temp:/www/public/temp --name human-server --net qingful2 -d registry.cn-hangzhou.aliyuncs.com/qingful/human-server:latest

# docker run --restart always --name srs -p 1935:1935 -p 1985:1985 -p 8080:8080 -p 1990:1990 -p 8088:8088 --net qingful2 --env CANDIDATE=$ip -p 8000:8000/udp -d  registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5
docker run --restart always --name emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 -e EMQX_MQTT__MAX_PACKET_SIZE="10MB" -e EMQX_DASHBOARD__DEFAULT_PASSWORD=xxxx --net qingful2 -d registry.cn-hangzhou.aliyuncs.com/qingful/emqx:5.5.0

sleep 30

# 初始化数据库
docker exec -e MYSQL_PWD=xxxx -it mysql2 mysql -uroot -e "SET NAMES utf8mb4;USE human_server;INSERT INTO \`config\` (\`key\`, \`val\`) VALUES ('name', '数字人');"
docker exec -e MYSQL_PWD=xxxx -it mysql2 mysql -uroot -e "SET NAMES utf8mb4;USE human_server;INSERT INTO \`account\` (\`phone\`, \`password\`, \`workBalance\`, \`status\`, \`startTime\`, \`endTime\`, \`lastLoginAt\`, \`role\`, \`agentId\`, \`islocal\`) VALUES ('admin', 'e10adc3949ba59abbe56e057f20f883e', '100000', '1', '2024-02-23 20:20:25', '2029-02-23 20:20:25', NULL, 'admin', '0', '0')"