ported double tracking from TC

This commit is contained in:
mikx
2020-10-30 23:45:46 -04:00
commit 44b1f31c23
4914 changed files with 4961129 additions and 0 deletions

46
docker/README.md Normal file
View File

@@ -0,0 +1,46 @@
# Run AzerothCore with Docker
*This readme it's a summary of the AzerothCore docker features.*
Docker. is a software that performs operating-system-level virtualization, allowing to wrap and launch applications inside containers.
Thanks to Docker, you can quickly setup and run AzerothCore in any operating system.
The **only** requirement is having [Docker](https://docs.docker.com/install/) installed into your system. Forget about installing mysql, visual studio, cmake, etc...
### Installation instructions
To install and AzerothCore using Docker, you have two options
#### Option A. Using Docker Compose (very easy - recommended)
- Check the [Install with Docker](http://www.azerothcore.org/wiki/install-with-Docker) guide.
#### Option B. Build and start each container manually (longer - not recommended)
You have to follow these steps (**respecting the order**):
1) Create a Docker Network: `docker network create ac-network`. All your docker containers will use it to communicate to each other.
2) Launch one instance of the [AzerothCore Dockerized Database](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/database)
3) Build AzerothCore using [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build)
4) Launch one instance of the [AzerothCore Dockerized Authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver)
5) Launch one instance of the [AzerothCore Dockerized Worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver)
### Memory usage
The total amount of RAM when running all AzerothCore docker containers is **less than 2 GB**.
![AzerothCore containers memory](https://user-images.githubusercontent.com/75517/51078287-10e65b80-16b3-11e9-807f-f59a5844dae5.png)
### Docker containers vs Virtual machines
Usind Docker will have the same benefits as using virtual machines, but with much less overhead:
![Docker containers vs Virtual machines](https://user-images.githubusercontent.com/75517/51078179-d4fec680-16b1-11e9-8ce6-87b5053f55dd.png)

View File

@@ -0,0 +1,9 @@
FROM ubuntu:20.04
# install the required dependencies to run the authserver
RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev net-tools;
HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD netstat -lnpt | grep :3724 || exit 1
# run the authserver located in the directory "docker/authserver/bin" of the host machine
CMD ["/azeroth-server/bin/authserver"]

View File

@@ -0,0 +1,39 @@
# AzerothCore Dockerized Authserver
This provides a way to manually build and launch a container with the AzerothCore authserver running inside it.
If you just want to install the whole AzerothCore quickly using Docker Compose, we recommend [this guide](http://www.azerothcore.org/wiki/install-with-Docker).
## Requirements
- You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system.
- You need to first build the [AzerothCore Build Image](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build).
- If you haven't created a docker network yet, create it by simply using `docker network create ac-network`.
- You have to copy the file `docker/authserver/etc/authserver.conf.dockerdist` and rename the copied file to `docker/authserver/etc/authserver.conf`. Then open it and change the values where needed (you may need to change the DB port).
## Building the container image
To build the container image you have to be in the **main** folder of your local AzerothCore sources directory.
```
docker build -t azerothcore/authserver -f docker/authserver/Dockerfile docker/authserver
```
*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).*
## Run the container
```
docker run --name ac-authserver \
--mount type=bind,source="$(pwd)"/docker/authserver/bin/,target=/azeroth-server/bin \
--mount type=bind,source="$(pwd)"/docker/authserver/etc/,target=/azeroth-server/etc \
--mount type=bind,source="$(pwd)"/docker/authserver/logs/,target=/azeroth-server/logs \
-p 127.0.0.1:3724:3724 \
--network ac-network \
-it azerothcore/authserver
```
*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).*

View File

View File

@@ -0,0 +1,19 @@
###############################################
# AzerothCore Auth Server configuration file #
###############################################
[authserver]
# Do not change this
LogsDir = "/azeroth-server/logs" # will reflect on your host directory: docker/worldserver/logs
# Change this configuration accordingly with your docker setup
# The format is "hostname;port;username;password;database":
# - docker containers must be on the same docker network to be able to communicate
# - the DB hostname will be the name of the database docker container
LoginDatabaseInfo = "ac-database;3306;root;password;acore_auth"
# Add more configuration overwrites by copying settings from from authserver.conf.dist
LogLevel = 3
SQLDriverLogFile = "SQLDriver.log"
SQLDriverQueryLogging = 1

30
docker/build/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
FROM ubuntu:20.04
# install the required dependencies to compile AzerothCore
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && apt install -y git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev libace-6.4.5 libace-dev
# copy the sources from the host machine to the Docker container
ADD .git /azerothcore/.git
ADD deps /azerothcore/deps
ADD conf/dist /azerothcore/conf/dist
ADD src /azerothcore/src
ADD modules /azerothcore/modules
ADD CMakeLists.txt /azerothcore/CMakeLists.txt
ARG ENABLE_SCRIPTS=1
ENV ENABLE_SCRIPTS=$ENABLE_SCRIPTS
ENTRYPOINT cd azerothcore/build && \
# run cmake
cmake ../ -DCMAKE_INSTALL_PREFIX=/azeroth-server -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=0 -DSCRIPTS=$ENABLE_SCRIPTS -DWITH_WARNINGS=1 -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && \
# calculate the optimal number of threads
MTHREADS=`grep -c ^processor /proc/cpuinfo`; MTHREADS=$(($MTHREADS + 2)) && \
# run compilation
make -j $MTHREADS && \
make install -j $MTHREADS && \
# copy the binary files "authserver" and "worldserver" files back to the host
# - the directories "/binworldserver" and "/binauthserver" are meant to be bound to the host directories
# - see docker/build/README.md to view the bindings
cp /azeroth-server/bin/worldserver /binworldserver && \
cp /azeroth-server/bin/authserver /binauthserver

35
docker/build/README.md Normal file
View File

@@ -0,0 +1,35 @@
# AzerothCore Dockerized Build
The AzerothCore Build Dockerfile will create a container that will run the AC build.
When this container runs, it will compile AC and generate:
- the build cache in the `docker/build/cache` directory
- the `worldserver` executable file in `docker/worldserver/bin`
- the `authserver` executable file in `docker/authserver/bin`
The executable files will be used by the [authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) and the [worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) docker containers.
Note: every time you update your AzerothCore sources, you **must** run again the build container and restart your `worldserver` and `authserver` containers.
## Usage
To build the container image you have to be in the **main** folder of your local AzerothCore sources directory and run:
```
docker build -t acbuild -f docker/build/Dockerfile .
```
Then you can launch the container to rebuild AC using:
```
docker run \
-v /$(pwd)/docker/build/cache:/azerothcore/build \
-v /$(pwd)/docker/worldserver/bin:/binworldserver \
-v /$(pwd)/docker/authserver/bin:/binauthserver \
acbuild
```
### Clearing the cache
To clear the build cache, delete all files contained under the `docker/build/cache` directory.

View File

@@ -0,0 +1,28 @@
FROM alpine:3.9 as builder
# install bash
RUN apk add --no-cache bash
# copy the sources from the host machine
COPY apps /azerothcore/apps
COPY bin /azerothcore/bin
COPY conf /azerothcore/conf
COPY data /azerothcore/data
COPY deps /azerothcore/deps
COPY acore.json /azerothcore/acore.json
# run the AzerothCore database assembler
RUN ./azerothcore/bin/acore-db-asm 1
FROM mysql:5.7
ENV LANG C.UTF-8
# copy files from the previous build stage - see: https://docs.docker.com/develop/develop-images/multistage-build/
COPY --from=builder /azerothcore/env/dist/sql /sql
# adding the "generate-databases.sh" to the directory "/docker-entrypoint-initdb.d"
# because all scripts included in that directory will automatically be executed when the docker container starts
COPY docker/database/generate-databases.sh /docker-entrypoint-initdb.d
HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD mysqladmin -uroot -p$MYSQL_ROOT_PASSWORD ping -h localhost

102
docker/database/README.md Normal file
View File

@@ -0,0 +1,102 @@
# AzerothCore Dockerized Database
This provides a way to quickly launch one or more instances of a fully-ready AzerothCore database. It is particularly useful for testing/development purposes.
For example, with this you can quickly create a new, clean instance of the AzerothCore DB. Or create **multiple** instances each one available on a different **port** (that can be handy to test & compare things).
Instances (containers) can be easily set up and then destroyed, so you can always switch to a clean state after your experiments. Every instance will have the three `acore_auth`, `acore_characters` and `acore_world` mysql databases.
**NOTE**: you do **not** need to install any mysql-server manually in your system and if you already have it, the docker instances will **not** interfere with it.
If you just want to install the whole AzerothCore quickly using Docker Compose, we recommend following [this guide instead](http://www.azerothcore.org/wiki/install-with-Docker).
# Setup & usage instructions
### Requirements
The only requirement is [Docker](https://docs.docker.com/install/). You can install it on any operating system.
## Building the container image
To build the container image you have to be in the **main folder** of your local AzerothCore sources directory.
If you don't have the AzerothCore sources, clone it using:
`git clone https://github.com/azerothcore/azerothcore-wotlk.git`
and cd into it `cd azerothcore-wotlk`.
You can build the image using:
```
docker build -t azerothcore/database -f docker/database/Dockerfile .
```
**Note:** the version of your DB will be the one of your sources when you built the image. If you want to update it, just update your sources (`git pull`) and build the image again.
*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).*
## How to launch a container
Run the following command to launch a container:
```
docker run --name ac-database \
-p 127.0.0.1:3306:3306 \
-e MYSQL_ROOT_PASSWORD=password \
--network ac-network \
azerothcore/database
```
Where:
`--name` is followed by a container name like `ac-database`. Put whatever name you like, each container should have an unique name.
`-p` (port) is followed by `IP_ADDRESS:EXTERNAL_PORT:INTERNAL_PORT`.
- INTERNAL_PORT **must** always be 3306.
- EXTERNAL_PORT is the port that you will use to access the mysql-server from outside docker
`--network` takes the name of the internal docker network. Containers must be on the same network to communicate to each other.
**NOTE**: You may want to use an external port different than 3306 in case you have already mysql-server installed in your system (or some other service that is using that port). So you can use for example port 9000 with `-p 127.0.0.1:9000:3306`
`docker run --name ac-database -p 9000:3306 -e MYSQL_ROOT_PASSWORD=password azerothcore/database`
`-e MYSQL_ROOT_PASSWORD=password` lets you change the default password for the `root` user.
`azerothcore/database` will be the name of your docker image.
When the container is ready, you will see a message similar to:
> Version: '5.7.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
You can optionally pass option `-d` to detach the container run from your terminal.
You can optionally pass option `-it` to run the container as an interactive process (so you can kill it with ctrl+c).
*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).*
## Launching more instances
You can easily run more instances. You just have to specify a different **name** and **port** for each.
Example: I want to launch three instances of the AzerothCore databases, each one listening respectively on port 9001, 9002 and 9003. I can do it with the following commands:
`docker run --name ac-database-1 -p 127.0.0.1:9001:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name ac-database-2 -p 127.0.0.1:9002:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
`docker run --name ac-database-3 -p 127.0.0.1:9003:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database`
You can use the `docker ps` command to check your running containers.
*For more information about the `docker ps` command, check the [docker ps doc](https://docs.docker.com/engine/reference/commandline/ps/).*
## Stopping / removing
You can stop a container using `docker stop name-of-the container`, for example `docker stop ac-database-1`.
You can then remove the container using `docker rm name-of-the container`, for example `docker rm ac-database-1`.

View File

@@ -0,0 +1,40 @@
# TODO: remove this line after we squash our DB updates
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "SET GLOBAL max_allowed_packet=128*1024*1024;"
echo "Creating DBs..."
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_auth"
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_characters"
mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_world"
echo "Importing auth base..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_base.sql
echo "Importing characters base..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_base.sql
echo "Importing world base..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_base.sql
echo "Importing auth updates..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_updates.sql
echo "Importing characters updates..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_updates.sql
echo "Importing world updates..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_updates.sql
echo "Importing auth custom (if any)..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_custom.sql
echo "Importing characters custom (if any)..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_custom.sql
echo "Importing world custom (if any)..."
mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_custom.sql
echo "Done!"

View File

@@ -0,0 +1,9 @@
FROM ubuntu:20.04
# install the required dependencies to run the authserver
RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev libreadline-dev net-tools;
HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD netstat -lnpt | grep :8085 || exit 1
# run the worldserver located in the directory "docker/worldserver/bin" of the host machine
CMD ["/azeroth-server/bin/worldserver"]

View File

@@ -0,0 +1,42 @@
# AzerothCore Dockerized Worldserver
This provides a way to build and launch a container with the AzerothCore authserver running inside it.
If you just want to install the whole AzerothCore quickly using Docker Compose, we recommend following [this guide instead](http://www.azerothcore.org/wiki/install-with-Docker).
## Requirements
- You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system.
- You need to first build AzerothCore using the [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build).
- If you haven't created a docker network yet, create it by simply using `docker network create ac-network`.
- You have to copy the file `docker/worldserver/worldserver.conf.dockerdist` and rename the copied file to `docker/worldserver/worldserver.conf`. Then open it and change the values where needed (you may need to change the DB port).
- You need to have the **data files** somewhere in your system. If you don't have them yet, check the step ["Download the data files" from the installation guide](http://www.azerothcore.org/wiki/Installation#5-download-the-data-files).
## Building the container image
To build the container image you have to be in the **main** folder of your local AzerothCore sources directory.
```docker build -t azerothcore/worldserver -f docker/worldserver/Dockerfile docker/worldserver```
*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).*
## Run the container
Replace `/path/to/your/data` with the path of where your data folder is.
```
docker run --name ac-worldserver \
--mount type=bind,source=/path/to/your/data,target=/azeroth-server/data \
--mount type=bind,source="$(pwd)"/docker/worldserver/bin/,target=/azeroth-server/bin \
--mount type=bind,source="$(pwd)"/docker/worldserver/etc/,target=/azeroth-server/etc \
--mount type=bind,source="$(pwd)"/docker/worldserver/logs/,target=/azeroth-server/logs \
-p 127.0.0.1:8085:8085 \
--network ac-network \
-it azerothcore/worldserver
```
*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).*

View File

View File

@@ -0,0 +1,22 @@
################################################
# AzerothCore World Server configuration file #
################################################
[worldserver]
# Do NOT change those Dir configs
LogsDir = "/azeroth-server/logs" # will reflect on your host directory: docker/worldserver/logs
DataDir = "/azeroth-server/data"
# Change this configuration accordingly with your docker setup
# The format is "hostname;port;username;password;database":
# - docker containers must be on the same docker network to be able to communicate
# - the DB hostname will be the name of the database docker container
LoginDatabaseInfo = "ac-database;3306;root;password;acore_auth"
WorldDatabaseInfo = "ac-database;3306;root;password;acore_world"
CharacterDatabaseInfo = "ac-database;3306;root;password;acore_characters"
# Add more configuration overwrites by copying settings from worldserver.conf.dist
LogLevel = 2
# Disable idle connections automatic kick since it doesn't work well on macOS + Docker
CloseIdleConnections = 0