Feat(Docker/bash): docker-compose system rework (#4488)

## ⚠️ATTENTION! ⚠️ Upgrading procedure:

**Database:** After this PR will be merged you need to backup your DB first (you can use the db-assembler or any mysql client to generate the dump) and restore it after.  The reason is that we use now docker named volumes instead of binded ones to improve performance.

**Conf & client data**: if you use the default configuration, both the etc and the data folder are now available inside the **/env/docker**. 

Finally, you can cleanup the /docker folder previously used by our system.

## Changes Proposed:

This PR will implement the [devcontainer ](https://code.visualstudio.com/docs/remote/containers) feature for VSCode. Allowing us to develop and debug directly within the container in the same way on all OSes.

* Implemented support for vscode dev-container feature by remote-extension suite
* Docker performance optimizations for MacOS and non-linux hosts
* Bash system improvements
* Implemented first command using Deno runtime environment (typescript) and [commander.js]
* Implemented wait mechanism for db_assembler
* Implemented db migration command
* possibility to run the authserver and worldserver with GDB using the integrated simple-restarter
* Implemented docker multi-stage mechanism to use one single Dockerfile for all the services
* client-data downloader now creates a placeholder to avoid downloading the same version of data files multiple times
* deployment of pre-compiled docker images on [docker hub](https://hub.docker.com/u/acore), you can test them [here](https://github.com/azerothcore/acore-docker)
This commit is contained in:
Yehonal
2021-04-22 09:57:05 +02:00
committed by GitHub
parent 4a8faafaff
commit 380f406248
100 changed files with 2747 additions and 777 deletions

57
conf/dist/config.sh vendored
View File

@@ -5,7 +5,9 @@ SRCPATH="$AC_PATH_ROOT"
# absolute path where build files must be stored
BUILDPATH="$AC_PATH_ROOT/var/build/obj"
# absolute path where binary files must be stored
# absolute path where azerothcore will be installed
# NOTE: on linux the binaries are stored in a subfolder (/bin)
# of the $BINPATH
BINPATH="$AC_PATH_ROOT/env/dist"
# bash fills it by default with your os type. No need to change it.
@@ -15,12 +17,17 @@ BINPATH="$AC_PATH_ROOT/env/dist"
# When using linux, our installer automatically get information about your distro
# using lsb_release. If your distro is not supported but it's based on ubuntu or debian,
# please change it to one of these values.
#OSDISTRO="ubuntu"
# OSDISTRO="ubuntu"
# absolute path where config. files must be stored
# default: the system will use binpath by default
# CONFDIR="$AC_PATH_ROOT/env/dist/etc/"
# absolute path where maps and client data will be downloaded
# by the AC dashboard
# default: the system will use binpath by default
# DATAPATH="$BINPATH/bin"
##############################################
#
# COMPILER_CONFIGURATIONS
@@ -43,10 +50,16 @@ MTHREADS=0
CWARNINGS=ON
# enable/disable some debug informations ( it's not a debug compilation )
CDEBUG=OFF
# specify compilation type
CTYPE=Release
# specify compilation type:
# * Release: high optimization level, no debug info, code or asserts.
# * Debug: No optimization, asserts enabled, [custom debug (output) code enabled],
# debug info included in executable (so you can step through the code with a
# debugger and have address to source-file:line-number translation).
# * RelWithDebInfo: optimized, *with* debug info, but no debug (output) code or asserts.
# * MinSizeRel: same as Release but optimizing for size rather than speed.
CTYPE=${CTYPE:-Release}
# compile scripts
CSCRIPTS=ON
CSCRIPTS=${CSCRIPTS:-ON}
# compile unit tests
CBUILD_TESTING=OFF
# compile server
@@ -76,17 +89,21 @@ CCUSTOMOPTIONS=""
##############################################
#
# Basically you don't have to edit it
# but if you have another database you can add it here
# and create relative confiugurations below
# Comma separated list of databases
#
# You can add another element here if you need
# to support multiple databases
#
DATABASES=(
"AUTH"
"CHARACTERS"
"WORLD"
)
OUTPUT_FOLDER="$AC_PATH_ROOT/env/dist/sql/"
DBLIST=${DBLIST:-"AUTH,CHARACTERS,WORLD"}
# convert from comma separated list to an array.
# This is needed to support environment variables
readarray -td, DATABASES <<<"$DBLIST";
OUTPUT_FOLDER=${OUTPUT_FOLDER:-"$AC_PATH_ROOT/env/dist/sql/"}
DBASM_WAIT_TIMEOUT=${DBASM_WAIT_TIMEOUT:-1}
DBASM_WAIT_RETRIES=${DBASM_WAIT_RETRIES:-3}
####### BACKUP
# Set to true if you want to backup your azerothcore databases before importing the SQL with the db_assembler
@@ -163,23 +180,23 @@ DB_MYSQL_EXEC="mysql"
DB_MYSQL_DUMP_EXEC="mysqldump"
DB_AUTH_CONF="MYSQL_USER='acore'; \
DB_AUTH_CONF=${DB_AUTH_CONF:-"MYSQL_USER='acore'; \
MYSQL_PASS='acore'; \
MYSQL_HOST='localhost';\
MYSQL_PORT='3306';\
"
"}
DB_CHARACTERS_CONF="MYSQL_USER='acore'; \
DB_CHARACTERS_CONF=${DB_CHARACTERS_CONF:-"MYSQL_USER='acore'; \
MYSQL_PASS='acore'; \
MYSQL_HOST='localhost';\
MYSQL_PORT='3306';\
"
"}
DB_WORLD_CONF="MYSQL_USER='acore'; \
DB_WORLD_CONF=${DB_WORLD_CONF:-"MYSQL_USER='acore'; \
MYSQL_PASS='acore'; \
MYSQL_HOST='localhost';\
MYSQL_PORT='3306';\
"
"}
DB_AUTH_NAME="acore_auth"

4
conf/dist/docker-compose.override.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
version: '3.8'
# services:
# ac-worldserver-2:

31
conf/dist/env.ac vendored Normal file
View File

@@ -0,0 +1,31 @@
#
# GENERAL
#
USER_CONF_PATH=/azerothcore/apps/docker/config-docker.sh
DATAPATH=/azerothcore/env/dist/data
#
# COMPILER
#
CTYPE=RelWithDebInfo
CSCRIPTS=ON
#
# DATABASE
#
OUTPUT_FOLDER=/azerothcore/var/build/sql/
DB_AUTH_CONF="MYSQL_USER='root'; MYSQL_PASS='password'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';"
DB_CHARACTERS_CONF="MYSQL_USER='root'; MYSQL_PASS='password'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';"
DB_WORLD_CONF="MYSQL_USER='root'; MYSQL_PASS='password'; MYSQL_HOST='ac-database'; MYSQL_PORT='3306';"
#
# SIMPLE RESTARTER
#
AC_RESTARTER_BINPATH=
AC_RESTARTER_BINFILE=
AC_RESTARTER_WITHGDB=

23
conf/dist/env.docker vendored Normal file
View File

@@ -0,0 +1,23 @@
#
# Create a .env file in the root folder and use the following
# variables to configure your docker-compose
#
DOCKER_AC_ENV_FILE=
DOCKER_DATA=./env/docker/data
DOCKER_ETC=./env/docker/etc
DOCKER_LOGS=./env/docker/logs
DOCKER_CONF=./conf
DOCKER_WORLD_EXTERNAL_PORT=8085
DOCKER_AUTH_EXTERNAL_PORT=3724
DOCKER_DB_EXTERNAL_PORT=3306
DOCKER_DB_ROOT_PASSWORD=password
DOCKER_SOAP_EXTERNAL_PORT=7878
# To maximize the performance on MAC you can change the DOCKER_EXTENDS_BIND variable
# to "abstract-no-bind", however it won't bind the host directory inside the container.
# It means that you need to work directly within the container using a tool
# like the VScode dev-container of the remote-extension suite
DOCKER_EXTENDS_BIND=abstract-bind