Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README.md,docker-build-bot.sh ,docker-start-bot.sh,以及start-bot.sh的修改 #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ A qq-bot named 二狗, 基于 mirai / mirai-http / Garia.

## 运行方法

build bot 所需 docker 镜像: `cd script/docker-image; sh docker-build.sh`
build bot 所需 docker 镜像: `cd script/docker-image; sh docker-build-bot.sh`

运行 bot 容器并启动 bot: `sh scripts/docker-start-bot.sh`

Expand Down Expand Up @@ -62,4 +62,4 @@ build bot 所需 docker 镜像: `cd script/docker-image; sh docker-build.sh`

A Chinese Font derived from SetoFont / Naikai Font / cjkFonts-AllSeto.

一款衍生于濑户字体 / 内海字体 / cjkFonts 全濑体的中文字体。[github repo](https://github.com/lxgw/kose-font)
一款衍生于濑户字体 / 内海字体 / cjkFonts 全濑体的中文字体。[github repo](https://github.com/lxgw/kose-font)
4 changes: 4 additions & 0 deletions scripts/docker-image/docker-build-bot.sh
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
#!/bin/sh
if [ ! -f "mongodb-linux-x86_64-ubuntu1804-4.4.2.tgz" ]; then
wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.4.2.tgz
fi
sudo docker build -t ergo-bot -f Dockerfile.bot .
7 changes: 5 additions & 2 deletions scripts/docker-start-bot.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# 推理API默认已经启动
ERGO_PROJECT_DIR=$1
ERGO_PROJECT_DIR=$( dirname "$(readlink -f -- "$0")" )
ERGO_PROJECT_DIR="${ERGO_PROJECT_DIR}/.."
echo "Using Project Dir: "$ERGO_PROJECT_DIR
# 启动docker容器并启动bot
docker container stop ergo-bot-container
Expand All @@ -11,4 +14,4 @@ docker run \
#-v /mnt/1/Projects/gif-reply/data/processed/dataset/gifs:/gifs \
# 启动mongo db
docker exec ergo-bot-container sh -c "screen -S mongodb -md mongod --dbpath /mongo --logpath /ErGo/logs/mongod.log --fork"
docker exec ergo-bot-container sh -c "sh /ErGo/scripts/start-bot.sh"
docker exec ergo-bot-container sh -c "sh ${ERGO_PROJECT_DIR}/scripts/start-bot.sh"
16 changes: 13 additions & 3 deletions scripts/start-bot.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
#!/bin/bash

ERGO_PROJECT_DIR=$( dirname "$(readlink -f -- "$0")" )
ERGO_PROJECT_DIR="${ERGO_PROJECT_DIR}/.."
# 此脚本应在docker容器内运行
cd /ErGo
mkdir logs
cd $ERGO_PROJECT_DIR
if [ ! -d "${ERGO_PROJECT_DIR}/logs" ]; then
mkdir logs
fi
# 启动miral
if [ ! -d "${ERGO_PROJECT_DIR}/mirai" ]; then
mkdir ${ERGO_PROJECT_DIR}/mirai
#TODO: 添加miraiOK_linux-amd64下载指令,或取消.gitignore中mirai文件夹以及其中不涉及个人隐藏信息的文件,GitHub上原MiraiOK仓库提供的下载地址均已失效
fi
cd mirai
screen -md -S miraiOK ./miraiOK_linux-amd64
cd /ErGo
cd $ERGO_PROJECT_DIR
sleep 3
# 启动bot
screen -md -S bot bash -c 'python3 main.py 2>&1 | tee logs/bot.log'