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

View File

@@ -2,7 +2,7 @@
export GDB_ENABLED=0
# [optional] gdb file
# default: gdb.txt
# default: gdb.conf
export GDB=""
# directory where binary are stored

View File

@@ -2,12 +2,12 @@
PATH_RUNENGINE="./"
source $PATH_RUNENGINE/run-engine
source "$PATH_RUNENGINE/run-engine"
# you must create your conf
# copying conf.sh.dist
# copying conf.sh.dist
# and renaming as below
source ./conf-auth.sh
source "./conf-auth.sh"
restarter

View File

@@ -2,12 +2,12 @@
PATH_RUNENGINE="./"
source $PATH_RUNENGINE/run-engine
source "$PATH_RUNENGINE/run-engine"
# you must create your conf
# copying conf.sh.dist
# copying conf.sh.dist
# and renaming as below
source ./conf-world.sh
source "./conf-world.sh"
restarter

View File

@@ -2,13 +2,12 @@
PATH_RUNENGINE="./"
source $PATH_RUNENGINE/run-engine
source "$PATH_RUNENGINE/run-engine"
# you must create your conf
# copying conf.sh.dist
# and renaming as below
source ./conf-auth.sh
source "./conf-auth.sh"
starter

View File

@@ -2,12 +2,12 @@
PATH_RUNENGINE="./"
source $PATH_RUNENGINE/run-engine
source "$PATH_RUNENGINE/run-engine"
# you must create your conf
# copying conf.sh.dist
# copying conf.sh.dist
# and renaming as below
source ./conf-world.sh
source "./conf-world.sh"
starter

View File

@@ -0,0 +1,4 @@
set logging on
set debug timestamp
run
bt

View File

@@ -2,56 +2,69 @@
#PARAMETER 1: directory
#PARAMETER 2: binary file
#PARAMETER 3: gdb on/off
_bin_path=$1
_bin_file=$2
bin_path="${1:-$AC_RESTARTER_BINPATH}"
bin_file="${2:-$AC_RESTARTER_BINFILE}"
with_gdb="${3:-$AC_RESTARTER_WITHGDB}"
CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd )
_instant_crash_count=0
_restart_count=0
if [ "$#" -ne 2 ]; then
echo "Usage: $0 path filename"
echo "Example: $0 $HOME/azeroth-server/bin worldserver"
echo "Example: $0 $HOME/azerothcore/bin worldserver"
exit 1
fi
while true
do
if [ ! -f "$_bin_path/$_bin_file" ]; then
echo "$_bin_path/$_bin_file doesn't exists!"
if [ ! -f "$bin_path/$bin_file" ]; then
echo "$bin_path/$bin_file doesn't exists!"
exit 1
fi
STARTING_TIME=$(date +%s)
cd "$_bin_path" && "./$_bin_file" # &>/dev/null;
cd "$bin_path";
if [ "$with_gdb" = true ]; then
echo "Running with GDB enabled"
gdb -x "$CURRENT_PATH/gdb.conf" --batch "./$bin_file"
else
echo "Running without GDB"
"./$bin_file"
fi
_exit_code=$?
echo "exit code: $_exit_code"
# stop restarter on SIGKILL (disabled for now)
# 128 + 9 (SIGKILL)
#if [ $_exit_code -eq 137 ]; then
# echo "$_bin_file has been killed"
# echo "$bin_file has been killed"
# exit 0
#fi
echo "$_bin_file terminated, restarting..."
echo "$bin_file terminated, restarting..."
ENDING_TIME=$(date +%s)
DIFFERENCE=$(( $ENDING_TIME - $STARTING_TIME ))
((_restart_count++))
echo "$_bin_file Terminated after $DIFFERENCE seconds, termination count: : $_restart_count"
echo "$bin_file Terminated after $DIFFERENCE seconds, termination count: : $_restart_count"
if [ $DIFFERENCE -lt 10 ]; then
# increment instant crash if runtime is lower than 10 seconds
# increment instant crash if runtime is lower than 10 seconds
((_instant_crash_count++))
else
_instant_crash_count=0 # reset count
fi
if [ $_instant_crash_count -gt 5 ]; then
echo "$_bin_file Restarter exited. Infinite crash loop prevented. Please check your system"
echo "$bin_file Restarter exited. Infinite crash loop prevented. Please check your system"
exit 1
fi
done