Release v0.4.1 (What’s new?).
Welcome to acore_server_bootstrap
Documentation#
项目背景
在大规模游戏服务器 (Azerothcore) 部署的流程中, 我们通常会将其分为以下几个步骤:
游戏服务器核心的编译.
将编译好的游戏服务器打包成镜像.
对用镜像启动的游戏服务器进行自动配置.
而 #3 这一步又可以分为以下几个步骤:
创建数据库的 user.
创建三个数据库 (auth, characters, world), 如果还没创建过的话.
将必要的配置写入数据中 (realmlist).
将最新的配置写入
*.conf
文件中.禁止 ubuntu 的自动升级.
对游戏服务器的启动脚本赋予可执行权限.
启动游戏服务器.
安装其他服务器组件, 例如 SOAP Agent, DB Agent 等.
这一连串步骤在每次开新服, 或是修改了配置文件的时候都需要进行, 非常的麻烦. 为了解决这个问题, 我们开发了 acore_server_bootstrap
这个工具, 它可以帮助我们自动完成上述的所有步骤.
Note
注意, 该工具建立在特定的服务器的文件目录结构之上. 如果服务器的目录结构不符合预期, 则无法使用该工具.
如何进行 Bootstrap
在 EC2 上复制以下脚本即可运行该命令. 其原理是通过 curl
命令下载 install.py 自动化脚本. 这个自动化脚本能 git clone ...
本项目, 安装依赖, 并用命令行工具运行 acorebs bootstrap
命令.
sudo python3 -c "$(curl -fsSL https://raw.githubusercontent.com/MacHu-GWU/acore_server_bootstrap-project/main/install.py)"
如果你需要指定用特定的 Python 版本来运行 (例如用 3.8), 你可以这样做:
sudo python3.8 -c "$(curl -fsSL https://raw.githubusercontent.com/MacHu-GWU/acore_server_bootstrap-project/main/install.py)"
Bootstrap 的过程中需要将这几个项目安装到服务器上 acore_server_bootstrap, acore_soap_app, 如果你需要指定它们的特定版本 (推荐这么做, 以增加确定性), 你可以用下面的命令, 只要修改对应项目的版本即可 (版本号就是 Git Tag 例如 0.1.1
):
sudo python3.8 -c "$(curl -fsSL https://raw.githubusercontent.com/MacHu-GWU/acore_server_bootstrap-project/main/install.py)" --acore_server_bootstrap_version 0.4.2 --acore_soap_app_version 0.3.4 --acore_db_app_version 0.2.2
acorebs 命令行工具
用 Python 安装了本项目后就可以使用 acorebs
命令行工具了. 所有在 bootstrap 期间做的事情都可以单独用命令行再做一次. 下面是所有命令的列表.
acorebs
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs
acorebs hello
:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs hello
acorebs bootstrap_as_sudo
初始化 EC2 游戏服务器 (需要 sudo 权限的部分):
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs bootstrap_as_sudo
acorebs bootstrap
初始化 EC2 游戏服务器:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs bootstrap
acorebs disable_ubuntu_auto_upgrade
禁用 ubuntu 自动升级 (防止 MySQL client 版本升级):
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs disable_ubuntu_auto_upgrade
acorebs create_database
创建 acore_auth, acore_characters, acore_world 数据库:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs create_database
acorebs create_user
创建 acore 数据库用户:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs create_user
acorebs update_realmlist
更新服务器 realmlist 表:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs update_realmlist
acorebs configure_db
配置数据库:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs configure_db
acorebs apply_authserver_conf
更新 authserver.conf 配置文件:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs apply_authserver_conf
acorebs apply_worldserver_conf
更新 worldserver.conf 配置文件:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs apply_worldserver_conf
acorebs apply_mod_lua_engine_conf
更新 mod-LuaEngine.conf 配置文件:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs apply_mod_lua_engine_conf
acorebs apply_server_config
更新以上所有的配置文件:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs apply_server_config
acorebs run_check_server_status_cron_job
启动检测服务器状态的定时任务:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs run_check_server_status_cron_job
acorebs stop_check_server_status_cron_job
关闭检测服务器状态的定时任务:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs stop_check_server_status_cron_job
acorebs run_server
运行魔兽服务器:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs run_server
acorebs list_session
列出 screen sessions:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs list_session
acorebs enter_worldserver
进入 worldserver 交互式命令行:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs enter_worldserver
acorebs stop_server
停止魔兽服务器:
/home/ubuntu/git_repos/acore_server_bootstrap-project/.venv/bin/acorebs stop_server
Install#
acore_server_bootstrap
is released on PyPI, so all you need is to:
$ pip install acore-server-bootstrap
To upgrade to latest version:
$ pip install --upgrade acore-server-bootstrap