Coder Social home page Coder Social logo

trinitycore-docker's Introduction

trinitycore-docker

Contributor Covenant

TrinityCore is an MMORPG Framework. This project Dockerizes its various components using docker-compose to reduce as much complexity as possible. All you need is Docker and a copy of the 3.3.5a WoW client (any platform).

Quickstart / Example

./action tc-fetch
./action tc-build
./action tc-db-fetch
CLIENT_DIR=/absolutepath/to/installed/WoW3.3.5a ./action tc-extract
docker-compose up

See Initial Setup for more details.

Overview

You should be able to skip this section completely, and go directly to Initial Setup. But if would like more info about this repo and its structure, read on.

A few principles behind the approach this repo takes:

  1. As simple as possible: reduce configuration, reduce code, reduce implicit structures and coupling between scripts. The fewer things that can be configured, and the less code you have, the more maintainable a system is.
  2. Limited scope: this is for you and your friends to setup and play, not for a production-scale deployment. It should be as straightforward to run and debug as possible. This means some things are not configurable automatically, such as passwords.

The action Command

This project uses an "action container" or "cloud builder" docker pattern in the form of the action command seen below. The cloud builder pattern is a docker container that contains general tools, but operates on the contents of the host disk rather than files inside the container.

Therefore, although Docker is being used, all config files, the database, source code, and compiled binaries are stored outside of docker. This greatly simplifies the majority of operations for TrinityCore, since you don't need to worry as much about Docker itself.

Project Layout and Conventions

General

  • /containerfs: this folder will be mounted into the action container as /hostfs. One way to think about this is that when the docker container is running, reading/ a file in /hostfs/* is like reading a file on the system hosting docker.
  • /action: A bash script that builds and executes the action container from /tc-builder.

Containerfs Details

  • /containerfs/bin: Each script in this folder is accessible in the action container's PATH. These scripts are how stuff happen. They run in the action container and NEVER on the host machine. They generally operate on /hostfs inside on the container.
  • /containerfs/tc-client: this path only exists inside the action container if CLIENT_DIR is populated
  • /containerfs/tc-conf: Where you should edit and store your worldserver/authserver conf files. The trinitycore-worldserver and trinitycore-authserver docker services both read from this directory.
  • /containerfs/tc-db/mysql: Where the MySQL (really mariadb) service stores its database files.
  • /containerfs/tc-server/source: The source (git repo) of TrinityCore. You can cd into this directory and pull the latest changes to update your server.
  • /containerfs/tc-server/dist: After a successful build, TrinityCore outputs its build artifacts here (bin for all the binary executables and etc for example configs).
  • /containerfs/tc-wd: The "working directory" for the running worldserver, and authserver. The initial SQL database and extracted maps will/must be placed here, and logs from the processes will also exist here.

Initial Setup

While this project tries to remove as much complication as possible, you still need some awareness of TrinityCore's requirements and general operation. The documentation is very helpful.

You generally only need to do the following steps once.

First, clone this repository. Then:

# Clone/update the TrinityCore repo to the proper location (3.3.5 branch).
./action tc-fetch
# Build TrinityCore
./action tc-build
# Get the matching database backup that matches your TrinityCore build
./action tc-db-fetch

# Extract maps, this will take hours.
# Make sure CLIENT_DIR is the absolute path to your WoW client! You'll get a
# docker error otherwise.
CLIENT_DIR=/absolutepath/to/installed/WoW3.3.5a ./action tc-extract

Configuration

Each time your build TrinityCore, worldserver.conf.dist and authserver.conf.dist will be output to /containerfs/tc-server/dist/etc. You can compare these files to what will be used when running the services:

diff -u containerfs/tc-server/dist/etc/authserver.conf.dist containerfs/tc-conf/authserver.conf
# and
diff -u containerfs/tc-server/dist/etc/worldserver.conf.dist containerfs/tc-conf/worldserver.conf

Feel free to modify /containerfs/tc-conf/*.conf files as you see fit, but it's recommended to first get everything working with the repo as-is before you begin heavy customization.

Server Start / Boot

docker-compose up

On first boot, the database container will start a temporary server to self-initialize. This takes time. After initialization, mysqld/mariadbd will restart and be accessible, allowing the other services to start. Watch the output and check for any errors. Nearly a gigbyte of SQL must be loaded eventually, so give it time.

Once the database is ready TrinityCore worldserver will autopopulate the database with everything it needs, and then startup. Finally, the authserver will boot once the worldserver is ready.

You'll know it's all ready when you see output like:

trinitycore-worldserver_1  | World initialized in 0 minutes 56 seconds
trinitycore-worldserver_1  | Starting up anti-freeze thread (60 seconds max stuck time)...
trinitycore-worldserver_1  | TrinityCore rev. 0b7b7f10f90e 2021-01-15 08:31:35 +0000 (HEAD branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon) ready...
... # and eventually
trinitycore-authserver_1   | Added realm "Trinity" at 127.0.0.1:8085.

Note: CTRL+C will stop all services. On subsequent runs, you might find daemon mode more useful (docker-compose up -d) so you don't need a terminal window open. See the Docker Compose documentation for more details.

Worldserver Terminal / Prompt

Once the services are up, you'll need to create users and general TrinityCore tasks as outlined in Final Server Steps. This project is slightly different, since Docker must be used to connect to TrinityCore's worldserver admin terminal:

docker ps | grep worldserver
# take the name or container id and put it below
# generally will be "trinitycore-worldserver_1"
docker attach trinitycore-worldserver_1
# at worldserver prompt:
TC>
# DO NOT CTRL+C, unless you want the worldserver to restart!
# Detatch instead: CTRL-p CTRL-q

Useful Worldserver Commands

Create a a GM user:

account create <user> <pass>
account set gmlevel <user> 3 -1 # give user GM power on all realms

Connecting to Your Server with a Client

Set your client's WoW-3.3.5a/Data/enUS/realmlist.wtf:

set realmlist localhost

And start your client!

Note for Mac Users: Apple deprecated 32-bit applications, making the 3.3.5a client unrunable natively.

If you have an older mac still capable of running the client, you may need to remove the "quarantine" attribute to avoid "Failed to open archive interface.MPQ" errors:_

cd /path/to/WoW-3.3.5a
xattr -r -d com.apple.quarantine *

An alternative workaround is to run the macos binary directly:

./path/to/WoW-3.3.5a/World\ of\ Warcraft/Contents/MacOS/World\ of\ Warcraft

Shutdown

See Docker Compose documentation, but generally:

docker-compose down # when running in daemon mode, otherwise just CTRL+C

Manual Database Updates

A common manual database change is updating the auth database realmlist ip addresss.

use auth;
UPDATE realmlist
set 
  address='127.0.0.1' /* <-- Replace with whatever you need */
  /*, localAddress='${USER_IP_ADDRESS}'*/
WHERE name='Trinity';

You can either connect to the cluster using docker and run mysql manually, or use adminer/phpMyAdmin.

Manual

# Root password is defined in docker-compose.yaml
docker-compose exec trinitycore-db mysql -uroot -psecurity-through-subnets

Adminer / phpMyAdmin

adminer (aka phpMyAdmin) is included as a container. Using it requires the following:

  1. Uncomment the service declaration in docker-compose.yaml (it's commented out since it allows anyone with your IP address and root password to edit the database).
  2. Visit http://localhost:8080/?server=trinitycore-db&username=root . Note: trinitycore-db is the service name within the docker cluster, so that services within can discover each other.
  3. Use your root password as specified in docker-compose.yaml.
  4. Do whatever you need to do, like update your realmlist address with your client-accessible IP address.

Updating the Server

To save space (TrinityCore repo is > 6GB!), the tc-fetch action does a filtered clone. TrinityCore releases use tags. You can run ./action tc-fetch again to always grab the latest tagged (aka official) release of the 3.3.5 branch.

./action tc-fetch
./action tc-build

You can also do it manually, if you'd like to have the full repo or a specific commit:

git -C containerfs/tc-server/source fetch
git -C containerfs/tc-server/source checkout 3.3.5 # or whatever branch/tag/release you'd like
./action tc-build

You can perform a clean build via:

git -C containerfs/tc-server/source clean -dfx
./action tc-build

Starting from Scratch

The truly unique information is in the database, so generally you only need:

# delete the database
rm -rf containerfs/tc-db/mysql/

But if you'd like to fully start over, do the above and the following:

# delete the initial SQL
rm -rf containerfs/tc-wd/*.sql
# delete the source tree
rm -rf containerfs/tc-server/{dist,source}
# delete the maps, logs (CAUTION: MAPS TAKE HOURS TO REGEN!)
rm -rf containerfs/tc-wd/*

Contributing

Any contributions are welcome, as long as they keep this project within scope: simplicity, ease of maintenance, and ease of use.

Additionally, please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

trinitycore-docker's People

Contributors

josefalcon avatar kirbysayshi avatar theoperatore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trinitycore-docker's Issues

DB init error

Following the readme as guide for container creation, i get the following error:
Creating tables... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Creating auth... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Creating characters... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Creating world... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Applying updates... cat: /usr/local/trinitycore/TrinityCore/sql/updates/world/*.sql: No such file or directory ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Finished initializing database

to recreate issue:
docker build -t trinitycore-db .

docker run --name tc-mysql-data trinitycore-db data

docker run --rm -ti --volumes-from tc-mysql-data -e MYSQL_ROOT_PASSWORD=password trinitycore-db init

build fail - cmake error: Unable to find the requested boost libraries

Attempting to do a default build. Fails on step 9/18 while running build_core.sh. Opening issue while i research / troubleshoot

Step 9/18 : RUN /etc/build_core.sh
 ---> Running in 6ffcb7782731
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detected 64-bit platform
-- UNIX: Using default configuration directory
-- UNIX: Using default library directory
-- UNIX: Configuring uninstall target
-- UNIX: Created uninstall target
-- UNIX: Detected compiler: /usr/bin/cc
-- Using mysql-config: /usr/bin/mysql_config
-- Found MySQL library: /usr/lib/x86_64-linux-gnu/libmariadbclient.so
-- Found MySQL headers: /usr/include/mysql
-- Found MySQL executable: /usr/bin/mysql
-- Found git binary : /usr/bin/git
-- 
    Could not find a proper repository signature (hash) - you may need to pull tags with git fetch -t
    Continuing anyway - note that the versionstring will be set to "unknown 1970-01-01 00:00:00 (Archived)"

* TrinityCore revision   : unknown 1970-01-01 00:00:00 +0000 (Archived branch)
* TrinityCore buildtype  : RelWithDebInfo

* Install core to        : /usr/local
* Install libraries to   : /usr/local/lib
* Install configs to     : /usr/local/etc

* Build world/auth       : Yes (default)
* Build with scripts     : Yes (static)
* Build map/vmap tools   : Yes (default)
* Build core w/PCH       : Yes (default)
* Build scripts w/PCH    : Yes (default)
* Show all warnings      : Yes
* Use coreside debug     : No  (default)
* Show source tree       : Yes (hierarchical)
* Use GIT revision hash  : Yes (default)

-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
CMake Error at cmake/macros/FindBoost.cmake:1204 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.62.0

  Boost include path: /usr/include

  Could not find the following Boost libraries:

          boost_system
          boost_filesystem
          boost_thread
          boost_program_options
          boost_iostreams
          boost_regex

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.  If you still have problems search on forum for TCE00020.
Call Stack (most recent call first):
  dep/boost/CMakeLists.txt:44 (find_package)


-- Performing Test boost_filesystem_copy_links_without_NO_SCOPED_ENUM
-- Performing Test boost_filesystem_copy_links_without_NO_SCOPED_ENUM - Failed
CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.8")
Call Stack (most recent call first):
  /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.7/Modules/FindZLIB.cmake:114 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  dep/zlib/CMakeLists.txt:13 (find_package)


-- Configuring incomplete, errors occurred!
See also "/usr/local/trinitycore/TrinityCore/build/CMakeFiles/CMakeOutput.log".
See also "/usr/local/trinitycore/TrinityCore/build/CMakeFiles/CMakeError.log".
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target 'install'.  Stop.
The command '/bin/sh -c /etc/build_core.sh' returned a non-zero code: 2

worldserver segfault

 ______                       __
/\__  _\       __          __/\ \__
\/_/\ \/ _ __ /\_\    ___ /\_\ \, _\  __  __
   \ \ \/\`'__\/\ \ /' _ `\/\ \ \ \/ /\ \/\ \
    \ \ \ \ \/ \ \ \/\ \/\ \ \ \ \ \_\ \ \_\ \
     \ \_\ \_\  \ \_\ \_\ \_\ \_\ \__\\/`____ \
      \/_/\/_/   \/_/\/_/\/_/\/_/\/__/ `/___/> \
                                 C O R E  /\___/

http://TrinityCore.org /__/
Using configuration file /opt/trinitycore/conf/worldserver.conf.
Using SSL version: OpenSSL 1.0.2s 28 May 2019 (library: OpenSSL 1.0.2s 28 May 2019)
using Boost version: 1.62.0
Updating Auth database...

Auth database is up-to-date! Containing 3 new and 46 archived updates.
Updating Character database...
Character database is up-to-date! Containing 1 new and 33 archived updates.
Updating World database...
/etc/entrypoint.sh: line 165: 13 Segmentation fault (core dumped) /usr/local/bin/worldserver -c $CONF_DIR/worldserver.conf

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.