AzerothCore complete Docker solution

Check https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker for all details.
This commit is contained in:
Francesco Borzì
2019-01-12 21:48:33 +01:00
committed by GitHub
parent e7dafc18d2
commit 7bff043a1b
13 changed files with 186 additions and 2 deletions

3
.gitignore vendored
View File

@@ -12,6 +12,9 @@ modules/*
!modules/*.sh
build*/
var/*
docker/authserver/authserver.conf
docker/worldserver/worldserver.conf
!docker/build
!.gitkeep

36
docker/README.md Normal file
View File

@@ -0,0 +1,36 @@
# 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.
### Installation instructions
To install AzerothCore using Docker, you have to:
1) Install [Docker](https://docs.docker.com/install/).
2) Launch one instance of the [AzerothCore Dockerized Database](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/database)
3) Create an image of the [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,11 @@
FROM ubuntu:bionic
COPY --from=azerothcore/build:latest /azeroth-server /azeroth-server
COPY authserver.conf.dist /azeroth-server/etc/authserver.conf
COPY authserver.conf /azeroth-server/etc/authserver.conf
RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.* libace-dev; \
rm /azeroth-server/etc/worldserver.conf.dist; \
mkdir /azeroth-server/logs;
CMD ["/azeroth-server/bin/authserver"]

View File

@@ -0,0 +1,25 @@
# AzerothCore Dockerized Authserver
This provides a way to launch a container with the AzerothCore authserver running inside it.
## 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).
- You have to copy the file `docker/authserver/authserver.conf.dist` and rename the copied file to `docker/authserver/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 azt-authserver --network host -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

@@ -0,0 +1,13 @@
###############################################
# AzerothCore Auth Server configuration file #
###############################################
[authserver]
# Do not change this
LogsDir = "/azeroth-server/etc/logs"
# Change this configuration accordingly with your setup
LoginDatabaseInfo = "127.0.0.1;3600;root;password;acore_auth"
# Add more configuration overwrites
LogLevel = 3

17
docker/build/Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM ubuntu:bionic
RUN apt update && apt install -y git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev libace-6.* libace-dev
ADD .git /azerothcore/.git
ADD deps /azerothcore/deps
ADD conf/config.cmake.dist /azerothcore/conf/config.cmake.dist
ADD src /azerothcore/src
ADD CMakeLists.txt /azerothcore/CMakeLists.txt
RUN cd azerothcore; \
mkdir build; \
cd build; \
cmake ../ -DCMAKE_INSTALL_PREFIX=/azeroth-server -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=0 -DSCRIPTS=1; \
MTHREADS=`grep -c ^processor /proc/cpuinfo`; MTHREADS=$(($MTHREADS + 2)); \
make -j $MTHREADS; \
make install -j $MTHREADS;

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

@@ -0,0 +1,13 @@
# AzerothCore Dockerized Build
The AzerothCore Build Dockerfile is not meant to create containers, it is a stage that both 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 images will use.
Note: every time you update your AzerothCore sources, you **must** build again this image and the authserver & worldserver images to get the new version on your docker containers.
*For more information about Docker multi-stage builds, refer to the [docker multi-stage builds doc](https://docs.docker.com/develop/develop-images/multistage-build/).*
# Usage
To build the container image you have to be in the **main** folder of your local AzerothCore sources directory.
```docker build -t azerothcore/build -f docker/build/Dockerfile . ```

View File

@@ -15,4 +15,4 @@ FROM mysql:5.7
COPY --from=builder /azerothcore/env/dist/sql /sql
ADD docker/DB/generate-databases.sh /docker-entrypoint-initdb.d
ADD docker/database/generate-databases.sh /docker-entrypoint-initdb.d

View File

@@ -28,7 +28,7 @@ and cd into it `cd azerothcore-wotlk`.
You can build the image using:
`docker build -t azerothcore/database -f docker/DB/Dockerfile .`
`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.
@@ -58,8 +58,14 @@ Where:
`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

View File

@@ -0,0 +1,11 @@
FROM ubuntu:bionic
COPY --from=azerothcore/build:latest /azeroth-server /azeroth-server
COPY worldserver.conf.dist /azeroth-server/etc/worldserver.conf
COPY worldserver.conf /azeroth-server/etc/worldserver.conf
RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.* libace-dev libreadline-dev; \
rm /azeroth-server/etc/authserver.conf.dist; \
mkdir /azeroth-server/logs;
CMD ["/azeroth-server/bin/worldserver"]

View File

@@ -0,0 +1,33 @@
# AzerothCore Dockerized Worldserver
This provides a way to launch a container with the AzerothCore authserver running inside it.
## 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).
- You have to copy the file `docker/worldserver/worldserver.conf.dist` 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](https://github.com/AzerothCore/azerothcore-wotlk/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 azt-worldserver --mount type=bind,source=/path/to/your/data,target=/azeroth-server/data --network host -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

@@ -0,0 +1,16 @@
################################################
# AzerothCore World Server configuration file #
################################################
[worldserver]
# Do not change those
LogsDir = "/azeroth-server/etc/logs"
DataDir = "/azeroth-server/data"
# Change those configuration accordingly with your setup
LoginDatabaseInfo = "127.0.0.1;3600;root;password;acore_auth"
WorldDatabaseInfo = "127.0.0.1;3600;root;password;acore_world"
CharacterDatabaseInfo = "127.0.0.1;3600;root;password;acore_characters"
# Add more configuration overwrites
LogLevel = 2