Make the Docker installation easy

See: https://github.com/azerothcore/azerothcore-wotlk/wiki/Install-with-Docker
This commit is contained in:
Francesco Borzì
2019-01-16 20:44:02 +01:00
committed by GitHub
parent 7599624fdf
commit b578bce1d1
14 changed files with 131 additions and 27 deletions

View File

@@ -5,3 +5,6 @@ data/doc/*
modules/* modules/*
conf/* conf/*
!conf/*.dist !conf/*.dist
docker/worldserver/data/*
.idea
cmake-build-debug/*

11
.env.dist Normal file
View File

@@ -0,0 +1,11 @@
WORLDSERVER_DATA="./docker/worldserver/data"
WORLDSERVER_ETC="./docker/worldserver/etc"
WORLDSERVER_LOGS="./docker/worldserver/logs"
AUTHSERVER_ETC="./docker/authserver/etc"
AUTHSERVER_LOGS="./docker/authserver/logs"
WORLD_EXTERNAL_PORT=8085
AUTH_EXTERNAL_PORT=3724
DB_EXTERNAL_PORT=3306
DB_ROOT_PASSWORD=password

2
.gitignore vendored
View File

@@ -16,7 +16,9 @@ docker/authserver/etc/authserver.conf
docker/worldserver/etc/worldserver.conf docker/worldserver/etc/worldserver.conf
docker/authserver/logs/ docker/authserver/logs/
docker/worldserver/logs/ docker/worldserver/logs/
docker/worldserver/data/
!docker/build !docker/build
.env
!.gitkeep !.gitkeep

3
bin/acore-docker-build Normal file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
docker build -t azerothcore/build -f docker/build/Dockerfile .

View File

@@ -0,0 +1,4 @@
#!/usr/bin/env bash
cp docker/worldserver/etc/worldserver.conf.dockerdist docker/worldserver/etc/worldserver.conf
cp docker/authserver/etc/authserver.conf.dockerdist docker/authserver/etc/authserver.conf

61
docker-compose.yml Normal file
View File

@@ -0,0 +1,61 @@
version: '3.2'
services:
ac-database:
image: azerothcore/database
build:
context: .
dockerfile: ./docker/database/Dockerfile
networks:
- ac-network
ports:
- ${DB_EXTERNAL_PORT:-3306}:3306
environment:
- MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-password}
ac-worldserver:
stdin_open: true
tty: true
image: azerothcore/worldserver
build:
context: ./docker/worldserver
dockerfile: Dockerfile
networks:
- ac-network
ports:
- ${WORLD_EXTERNAL_PORT:-8085}:8085
volumes:
- type: bind
source: ${WORLDSERVER_ETC:-./docker/worldserver/etc}
target: /azeroth-server/etc
- type: bind
source: ${WORLDSERVER_LOGS:-./docker/worldserver/logs}
target: /azeroth-server/logs
- type: bind
source: ${WORLDSERVER_DATA:-./docker/worldserver/data}
target: /azeroth-server/data
depends_on:
- ac-database
ac-authserver:
image: azerothcore/authserver
build:
context: ./docker/authserver
dockerfile: Dockerfile
networks:
- ac-network
ports:
- ${AUTH_EXTERNAL_PORT:-3724}:3724
volumes:
- type: bind
source: ${AUTHSERVER_ETC:-./docker/authserver/etc}
target: /azeroth-server/etc
- type: bind
source: ${AUTHSERVER_LOGS:-./docker/authserver/logs}
target: /azeroth-server/logs
depends_on:
- ac-database
networks:
ac-network:

View File

@@ -6,23 +6,29 @@ Docker. is a software that performs operating-system-level virtualization, allow
Thanks to Docker, you can quickly setup and run AzerothCore in any operating system. Thanks to Docker, you can quickly setup and run AzerothCore in any operating system.
The **only** requirement is having Docker installed into your system. Forget about installing mysql, visual studio, cmake, etc... 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 ### Installation instructions
To install AzerothCore using Docker, you have to follow these steps (**respecting the order**): To install and AzerothCore using Docker, you have two options
1) Install [Docker](https://docs.docker.com/install/). #### Option A. Using Docker Compose (very easy - recommended)
2) Create a Docker Network: `docker network create ac-network`. All your docker containers will use it to communicate to each other. - Check the [Install with Docker](https://github.com/azerothcore/azerothcore-wotlk/wiki/install-with-Docker) guide.
3) Launch one instance of the [AzerothCore Dockerized Database](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/database) #### Option B. Build and start each container manually (longer - not recommended)
4) Create an image of the [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build) You have to follow these steps (**respecting the order**):
5) Launch one instance of the [AzerothCore Dockerized Authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) 1) Create a Docker Network: `docker network create ac-network`. All your docker containers will use it to communicate to each other.
6) Launch one instance of the [AzerothCore Dockerized Worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) 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 ### Memory usage

View File

@@ -1,6 +1,8 @@
# AzerothCore Dockerized Authserver # AzerothCore Dockerized Authserver
This provides a way to launch a container with the AzerothCore authserver running inside it. 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](https://github.com/azerothcore/azerothcore-wotlk/wiki/install-with-Docker).
## Requirements ## Requirements
@@ -16,14 +18,16 @@ This provides a way to launch a container with the AzerothCore authserver runnin
To build the container image you have to be in the **main** folder of your local AzerothCore sources directory. 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/``` ```
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/).* *For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).*
## Run the container ## Run the container
``` ```
docker run --name ac-auth-container \ docker run --name ac-authserver \
--mount type=bind,source="$(pwd)"/docker/authserver/etc/,target=/azeroth-server/etc \ --mount type=bind,source="$(pwd)"/docker/authserver/etc/,target=/azeroth-server/etc \
--mount type=bind,source="$(pwd)"/docker/authserver/logs/,target=/azeroth-server/logs \ --mount type=bind,source="$(pwd)"/docker/authserver/logs/,target=/azeroth-server/logs \
-p 127.0.0.1:3724:3724 \ -p 127.0.0.1:3724:3724 \

View File

@@ -10,7 +10,7 @@ LogsDir = "/azeroth-server/logs" # will reflect on your host directory: docker/w
# The format is "hostname;port;username;password;database": # The format is "hostname;port;username;password;database":
# - docker containers must be on the same docker network to be able to communicate # - 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 # - the DB hostname will be the name of the database docker container
LoginDatabaseInfo = "ac-db-container;3306;root;password;acore_auth" LoginDatabaseInfo = "ac-database;3306;root;password;acore_auth"
# Add more configuration overwrites by copying settings from from authserver.conf.dist # Add more configuration overwrites by copying settings from from authserver.conf.dist
LogLevel = 3 LogLevel = 3

View File

@@ -10,4 +10,6 @@ Note: every time you update your AzerothCore sources, you **must** build again t
To build the container image you have to be in the **main** folder of your local AzerothCore sources directory. 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 . ``` ```
docker build -t azerothcore/build -f docker/build/Dockerfile .
```

View File

@@ -9,6 +9,9 @@ Instances (containers) can be easily set up and then destroyed, so you can alway
**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. **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](https://github.com/azerothcore/azerothcore-wotlk/wiki/install-with-Docker).
# Setup & usage instructions # Setup & usage instructions
### Requirements ### Requirements
@@ -28,7 +31,9 @@ and cd into it `cd azerothcore-wotlk`.
You can build the image using: You can build the image using:
`docker build -t azerothcore/database -f docker/database/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. **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.
@@ -39,7 +44,8 @@ You can build the image using:
Run the following command to launch a container: Run the following command to launch a container:
```docker run --name ac-db-container \ ```
docker run --name ac-database \
-p 127.0.0.1:3306:3306 \ -p 127.0.0.1:3306:3306 \
-e MYSQL_ROOT_PASSWORD=password \ -e MYSQL_ROOT_PASSWORD=password \
--network ac-network \ --network ac-network \
@@ -48,7 +54,7 @@ Run the following command to launch a container:
Where: Where:
`--name` is followed by a container name like `ac-db-container`. Put whatever name you like, each container should have an unique name. `--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`. `-p` (port) is followed by `IP_ADDRESS:EXTERNAL_PORT:INTERNAL_PORT`.
@@ -59,7 +65,7 @@ Where:
**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` **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-db-container -p 9000:3306 -e MYSQL_ROOT_PASSWORD=password azerothcore/database` `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. `-e MYSQL_ROOT_PASSWORD=password` lets you change the default password for the `root` user.
@@ -81,9 +87,9 @@ You can easily run more instances. You just have to specify a different **name**
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: 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-db-container-1 -p 127.0.0.1:9001:3306 -e MYSQL_ROOT_PASSWORD=password -d azerothcore/database` `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-db-container-2 -p 127.0.0.1:9002: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-db-container-3 -p 127.0.0.1:9003: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. You can use the `docker ps` command to check your running containers.
@@ -91,6 +97,6 @@ You can use the `docker ps` command to check your running containers.
## Stopping / removing ## Stopping / removing
You can stop a container using `docker stop name-of-the container`, for example `docker stop ac-db-container-1`. 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-db-container-1`. You can then remove the container using `docker rm name-of-the container`, for example `docker rm ac-database-1`.

View File

@@ -1,6 +1,8 @@
# AzerothCore Dockerized Worldserver # AzerothCore Dockerized Worldserver
This provides a way to launch a container with the AzerothCore authserver running inside it. 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](https://github.com/azerothcore/azerothcore-wotlk/wiki/install-with-Docker).
## Requirements ## Requirements
@@ -27,7 +29,7 @@ To build the container image you have to be in the **main** folder of your local
Replace `/path/to/your/data` with the path of where your data folder is. Replace `/path/to/your/data` with the path of where your data folder is.
``` ```
docker run --name ac-world-container \ docker run --name ac-worldserver \
--mount type=bind,source=/path/to/your/data,target=/azeroth-server/data \ --mount type=bind,source=/path/to/your/data,target=/azeroth-server/data \
--mount type=bind,source="$(pwd)"/docker/worldserver/etc/,target=/azeroth-server/etc \ --mount type=bind,source="$(pwd)"/docker/worldserver/etc/,target=/azeroth-server/etc \
--mount type=bind,source="$(pwd)"/docker/worldserver/logs/,target=/azeroth-server/logs \ --mount type=bind,source="$(pwd)"/docker/worldserver/logs/,target=/azeroth-server/logs \

View File

View File

@@ -11,9 +11,9 @@ DataDir = "/azeroth-server/data"
# The format is "hostname;port;username;password;database": # The format is "hostname;port;username;password;database":
# - docker containers must be on the same docker network to be able to communicate # - 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 # - the DB hostname will be the name of the database docker container
LoginDatabaseInfo = "ac-db-container;3306;root;password;acore_auth" LoginDatabaseInfo = "ac-database;3306;root;password;acore_auth"
WorldDatabaseInfo = "ac-db-container;3306;root;password;acore_world" WorldDatabaseInfo = "ac-database;3306;root;password;acore_world"
CharacterDatabaseInfo = "ac-db-container;3306;root;password;acore_characters" CharacterDatabaseInfo = "ac-database;3306;root;password;acore_characters"
# Add more configuration overwrites by copying settings from worldserver.conf.dist # Add more configuration overwrites by copying settings from worldserver.conf.dist
LogLevel = 2 LogLevel = 2