docker-compose - 为 azerothcore docker build 设置 lua_scripts 目录
问题描述
我正在运行一个 AzerothCore 服务器,用于通过 LAN 进行个人访问。根据官方网站上提供的设置,我的服务器在 docker 上运行。我还设法通过AzerothCore GitHub 上提供的模块附加了 Eluna lua 工程。
我可以看到 Eluna 已成功地与 worldserver 一起编译,因为我在调用以下命令后收到此消息docker-compose up
:
ac-worldserver_1 | [Eluna]: Executed 0 Lua scripts in 0 ms
我通过客户端登录并正常播放也没有问题。
现在,我遇到的问题是我似乎无法找到放置 lua 脚本的位置,以便服务器使用它们。挖掘配置文件,我在以下位置找到了这个参数azerothcore-wotlk/modules/mod-eluna-lua-engine/conf/mod_LuaEngine.conf.dist
:
Eluna.ScriptPath = "lua_scripts"
这个常量被加载到主LuaEngine.cpp
文件中,所以我确信这是寻找的正确位置。lua_scripts
但是,整个存储库中没有目录,包括附加的模块。我尝试将它(和一个基本hello_world.lua
脚本)放在多个子目录中,但无济于事。考虑到由于使用 docker 可能会在存储库之外找到它,我运行sudo find / | grep lua_scripts
并在这个非常难以访问的位置找到了该文件夹的副本:
/var/snap/docker/common/var-lib-docker/overlay2/3d7f9d1de6602baf9a33ee24333ecdf01d537c2b7b439e90d645ff9643bfdd07/diff/azeroth-server/bin/lua_scripts
显然,这只能通过 访问sudo
,我不能轻易地将这个位置用于开发目的。
作为最后的手段,我尝试将Eluna.ScriptPath
常量更改为存储库中的绝对路径,但这也不成功。没有加载脚本,登录时没有 hello world。有人知道我可能会在哪里查看或放置目录吗?
作为参考,hello_world.lua
:
local PLAYER_EVENT_ON_LOGIN = 3
local function OnLogin(event, player)
player:SendBroadcastMessage("Hello world")
end
RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, OnLogin)
解决方案
我通过添加绑定lua_scripts
文件夹来解决这个问题docker-compose.yml
- type: bind
source: ./docker/worldserver/bin/lua_scripts
target: /azeroth-server/bin/lua_scripts
在. volumes
_ docker-compose.yml
我把它放在worldserver/bin
绑定之下。
然后在docker/worldserver/etc/mod_LuaEngine.conf
集合中Eluna.ScriptPath = "/azeroth-server/bin/lua_scripts"
并将您的脚本放入docker/worldserver/bin/lua_scripts
.
推荐阅读
- amazon-web-services - AWS Elastic Beanstalk 多容器 Docker 配置上的 HTTPS/SSL 问题
- android - 将一些自定义示例数据添加到 TextView
- python - 以所需格式序列化 Django 对象
- python - SQL Alchemy 参数化查询,绑定表名作为参数给出错误
- angular - 如何从当前 url 获取组件名称?
- arrays - Swift - 根据它们的值连接两个元组数组
- javascript - reactjs中如何动态添加、更新和删除表中的行
- javascript - 如何将用户重定向到安全域
- sql-server - SQL 表达式在 Crystal Reports 中返回多行
- python-3.x - cv2.imdecode 错误的颜色(python opencv)