The alpha project的Alpha core專案是一個模擬魔獸世界alpha 0.5.3版本的模擬器,其特色在用python語言撰寫,佈署相較mangos, trinitycore等來的簡單,而且這個專案更新相當頻繁,有許多熱心的大大參與修復,這就是開源(open source)的美好之處,集思廣益,眾志成城啊。
回到正題,專案本身支援以Docker container的方式佈署伺服器,本文記錄我折騰許久終於成功在我的Synology NAS上成功架設的筆記,我使用的方式特色在於只有伺服器本身使用docker,而資料庫部分使用群暉內建的mariadb,所以會和官方教學稍稍不同。
資料庫篇
1、用phpmyadmin或heidiSQL連上群暉的mariadb,接著新增三個資料庫alpha_dbc,alpha_realm,alpha_world,記得給予一個專用的資料庫使用者帳號,我這裡是新建一個名為alphacore的帳號。
2、將專案庫下載到電腦(git或下載zip包皆可),你會發現etc\databases內有三個資料夾dbc,realm,world,裡面包含上面創建之3個資料庫之所需的所有sql檔案,請將它們匯入到各自DB中,檔名有dbc表示這是dbc用的sql檔,其餘以此類推,別忘了裡面還有updates這個子目錄,這是累積的更新修正,專案常常更新,請務必要記得匯入這個updates.sql
伺服器篇
1、ssh進入你的NAS,網路上有許多教學這邊不贅述,接下來cd /volume1/docker/
2、git clone https://github.com/The-Alpha-Project/alpha-core 把專案程式碼下載回來,完成後cd alpha-core
3、mv ./docker/wow-alpha/etc/config/config.yml.dist ./docker/wow-alpha/etc/config/config.yml 將config檔案樣本修改附檔名,這樣後面要產生docker image時才會讀到這個設定檔
4、用你習慣的編輯器開啟config.yml,下面是我的範例供參
Version:
current: 10
Database:
Connection:
host: #NAS IP:3307
username: #步驟0指派的帳號
password: #步驟0指派的密碼
DBNames:
realm_db: alpha_realm
world_db: alpha_world
dbc_db: alpha_dbc
Server:
Connection: # Change 0.0.0.0 for 127.0.0.1 if it doesn't work
Realm:
local_realm_id: 1 # id of the realm running on this machine (realmlist table)
WorldServer:
# You can use the FORWARD_ADDRESS_OVERRIDE environment variable to define a different forward IP address
# (the one that will be served to external players) than the bind one.
host: 0.0.0.0
port: 8100
Settings:
auto_create_accounts: True # Automatically create an account the first time credentials are provided
auto_create_gm_accounts: False # Give all new accounts GM permissions
blizzlike_names: True # If True, names won't have any restriction as it was back in the day
xp_rate: 1.0
load_gameobjects: True
load_creatures: True
supported_client: 3368
realm_saving_interval_seconds: 60
cell_size: 64 # Shouldn't be much bigger than 200
console_mode: True # Set it to False if you intend to run the server on background
use_map_tiles: False # If True, place 0.5.3 .map files extracted with https://github.com/The-Alpha-Project/MapTools inside 'etc/maps/'
# Nav tiles:
# If True, place *nix '.so' or Windows '.pyd' from Namigator inside './namigator'. (https://github.com/The-Alpha-Project/namigator)
# Also, place extracted BHV and NAVS data inside 'etc/navs/'. They need to be extracted with the MapBuilder tool
# of Namigator.
use_nav_tiles: False
z_resolution: 256 # The resolution used when extracting maps
debug_movement: False # Moving NPCs will leave a trail of temporary gameobjects.
debug_transport: False # Elevators will leave a trail of temporary gameobjects.
Logging:
# Debug level values (you can combine them as a mask):
# None = 0x00 (0)
# Success = 0x01 (1)
# Information = 0x02 (2)
# Anticheat = 0x04 (4)
# Warning = 0x08 (8)
# Error = 0x10 (16)
# Debug = 0x20 (32)
#
# All = 0x3f (63, the sum of all)
logging_mask: 0x3f
log_player_chat: False
log_chat_path: /var/log/alpha-core/chat
log_dev_path: /var/log/alpha-core/dev
General:
# Message of the day
motd: Welcome to the Friends and Family Alpha!
enable_addons_chat_api: False # CUSTOM: Allow addons to use the chat system for data requests.
disabled_race_mask: 0 # Blizzlike 0.5.3: 239
disabled_class_mask: 0 # Blizzlike 0.5.3: 1102
World:
Gameplay:
game_speed: 0.016666668
update_dist: 200
Chat:
ChatRange:
say_range: 50
yell_range: 300
emote_range: 50
Unit:
Defaults:
base_attack_time: 2000
offhand_attack_time: 1000
bounding_radius: 0.388999998569489
combat_reach: 1.5
walk_speed: 2.5
run_speed: 7.0
swim_speed: 4.722222
Player:
Defaults:
starting_level: 1
max_level: 25
turn_speed: 3.141594
flight_speed: 32.0
5、cd回專案根目錄,編輯docker-compose.yml,這邊需要做一些修改,讓realm, world伺服器改為連線群暉的mariadb,而不需要產生db和phpmyadmin container,直接看下方範例
version: '3.9'
x-alpha-core-shared-conf: &alpha-core-shared-conf
environment:
- TZ=Asia/Taipei
- MYSQL_HOST= #NAS IP:3307
- MYSQL_USERNAME= #資料庫帳號
- MYSQL_PASSWORD= #資料庫密碼
- CONSOLE_MODE=False
- FORWARD_ADDRESS_OVERRIDE= 127.0.0.1 # your server ip address 如果只對內開放只需輸入NAS的區網IP,如果要對外開放就輸入你的對外固定IP位址
volumes:
- .:/var/wow/
restart: on-failure
# depends_on:
# - sql
services:
main:
image: alpha-core:latest
container_name: alpha-core-main
build:
context: .
dockerfile: etc/docker/main/Dockerfile
ports:
- "8100:8100"
- "9090:9090"
- "9100:9100"
<<: *alpha-core-shared-conf
world:
image: alpha-core:latest
container_name: alpha-core-world
build:
context: .
dockerfile: etc/docker/world/Dockerfile
ports:
- "8100:8100"
<<: *alpha-core-shared-conf
profiles:
- world
realm:
image: alpha-core:latest
container_name: alpha-core-realm
build:
context: .
dockerfile: etc/docker/realm/Dockerfile
ports:
- "9090:9090"
- "9100:9100"
<<: *alpha-core-shared-conf
profiles:
- realm
# sql:
# image: alpha-mariadb:latest
# build: etc/docker/sql
# environment:
# - MYSQL_ROOT_PASSWORD=root
# ports:
# - "3316:3306"
# volumes:
# - ./etc/databases/:/etc/databases/
# restart: on-failure
# phpmyadmin:
# image: phpmyadmin
# ports:
# - "8080:80"
# environment:
# - PMA_HOST=sql
# - PMA_USER=root
# - PMA_PASSWORD=pwd
# restart: "no"
# depends_on:
# - sql
# profiles:
# - dev
inotify:
image: alpha-inotify:latest
build: etc/docker/inotify
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- .:/var/wow/
environment:
- CONTAINER=alpha-core-main
- VOLUMES=/var/wow
restart: on-failure
profiles:
- dev
networks:
default:
name: alpha-core-network
6、重要的來啦,輸入docker-compose up --build看是否可以順利把docker container建立並把服務跑起來
待續...