Skip to content

Commit

Permalink
chore: 更改dp2持久化路径,支持脚本配置
Browse files Browse the repository at this point in the history
  • Loading branch information
XanderYe committed Jan 28, 2022
1 parent 1620bdc commit 7a5cf0b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions dnf-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

详见[docker-compose.yml](docker-compose.yml)

## DP2插件说明

持久化 ./data/dp2/ ,映射到容器中 /dp2/ <br/>
df_game_r.lua 中编写插件,调用到脚本就将脚本放入 script 中。<br/>
容器集成了 mysql 客户端,脚本中需要执行sql命令时,命令为 `mysql -h127.0.0.1 -ugame -p$GAME_PASSWORD`

## 环境变量

AUTO_MYSQL_IP: 和dnfmysql使用统一自定义网桥使用,支持自动获取mysql的ip
Expand Down
4 changes: 3 additions & 1 deletion dnf-server/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ rm -rf /home/template/root-tmp
cp /data/privatekey.pem /root/
# 构建配置文件软链[不能使用硬链接, 硬链接不可跨设备]
ln -s /data/Config.ini /root/Config.ini

# dp2脚本
cp /data/df_game_r.lua /dp2/df_game_r.lua
cp -rf /data/dp2/* /dp2/

# 替换Config.ini中的GM用户名、密码、连接KEY、登录器版本[这里操作的对象是一个软链接不需要指定-type]
sed -i --follow-symlinks "6c IP=$MYSQL_IP" `find /root -name "*.ini"`
sed -i --follow-symlinks "7c Password=$GAME_PASSWORD" `find /root -name "*.ini"`
Expand Down
5 changes: 3 additions & 2 deletions dnf-server/init/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ else
fi

# 判断Config.ini文件是否初始化过
if [ ! -f "/data/df_game_r.lua" ];then
if [ ! -d "/data/dp2" ];then
# 拷贝版本文件到持久化目录
cp /home/template/init/df_game_r.lua /data/
mkdir -p /data/dp2/
cp /home/template/init/df_game_r.lua /data/dp2/
echo "init df_game_r.lua success"
else
echo "df_game_r.lua has already initialized, do nothing!"
Expand Down

0 comments on commit 7a5cf0b

Please sign in to comment.