diff --git a/.dockerignore b/.dockerignore
index 5baa9d3d99..44c4511bc4 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -10,3 +10,4 @@
!/env/docker/etc/worldserver.conf.dockerdist
/.env*
.idea
+!.gitkeep
diff --git a/.gitattributes b/.gitattributes
index af7d9cf916..f4cd590bbe 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,10 +1,5 @@
# Auto detect text files and perform LF normalization
-* text=auto
-
-# End of line rules
-*.sh eol=lf
-*.sh.dist eol=lf
-bin/* eol=lf
+* text eol=lf
# Whitespace rules
# strict (no trailing, no tabs)
diff --git a/apps/ci/docker/.env.dist b/apps/ci/docker/.env.dist
deleted file mode 100644
index 3a5f289976..0000000000
--- a/apps/ci/docker/.env.dist
+++ /dev/null
@@ -1,11 +0,0 @@
-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=9000
-DB_ROOT_PASSWORD=password
diff --git a/apps/ci/docker/ci-docker-config.sh b/apps/ci/docker/ci-docker-config.sh
deleted file mode 100755
index f3d6e20928..0000000000
--- a/apps/ci/docker/ci-docker-config.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-cp apps/ci/docker/.env.dist .env
diff --git a/apps/compiler/includes/functions.sh b/apps/compiler/includes/functions.sh
index 7d4bf5176a..1e3c83c6ba 100644
--- a/apps/compiler/includes/functions.sh
+++ b/apps/compiler/includes/functions.sh
@@ -1,16 +1,11 @@
function comp_clean() {
- echo "Cleaning build files"
+ DIRTOCLEAN=${BUILDPATH:-var/build/obj}
+ PATTERN="$DIRTOCLEAN/*"
- CWD=$(pwd)
+ echo "Cleaning build files in $DIRTOCLEAN"
- cd $BUILDPATH
-
- make -f Makefile clean || true
- make clean || true
- find -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} \+
-
- cd $CWD
+ [ -d "$DIRTOCLEAN" ] && rm -rf $PATTERN
}
function comp_configure() {
diff --git a/apps/db_assembler/includes/functions.sh b/apps/db_assembler/includes/functions.sh
index 86973e1042..cedea417cf 100644
--- a/apps/db_assembler/includes/functions.sh
+++ b/apps/db_assembler/includes/functions.sh
@@ -12,7 +12,7 @@ function dbasm_waitMysqlConn() {
echo "DBASM Timeout: Cannot ping mysql!" 1>&2
exit 64
fi
- echo "Cannot ping mysql, retry in $DBASM_WAIT_TIMEOUT seconds (remaining: $COUNT/$DBASM_WAIT_RETRIES)..."
+ echo "Cannot ping mysql on $DBHOST:$DBPORT, retry in $DBASM_WAIT_TIMEOUT seconds (remaining: $COUNT/$DBASM_WAIT_RETRIES)..."
sleep $DBASM_WAIT_TIMEOUT
done
}
diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile
index 6c95ffa211..863d7ba51a 100644
--- a/apps/docker/Dockerfile
+++ b/apps/docker/Dockerfile
@@ -5,11 +5,12 @@
#
#=================================================================
-FROM ubuntu:20.04 as dev
+FROM ubuntu:20.04 as base
ARG USER_ID=1000
ARG GROUP_ID=1000
+ARG DOCKER_USER=acore
-LABEL description="AC Worldserver Debug Container for use with Visual Studio"
+LABEL description="AC base image for dev containers"
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
@@ -21,15 +22,14 @@ ENV TZ=Etc/UTC
# set noninteractive mode so tzdata doesn't ask to set timezone on install
ENV DEBIAN_FRONTEND=noninteractive
-# install essentials
-RUN apt-get update && apt-get install -y gdb gdbserver git dos2unix lsb-core sudo curl unzip
-
-# copy everything so we can work directly within the container
-# using tools such as vscode dev-container
-COPY . /azerothcore
-
-# install the required dependencies to run the worldserver
-RUN /azerothcore/acore.sh install-deps
+# Do not use acore dashboard to install
+# since it's not cacheable by docker
+RUN apt-get update && apt-get install -y gdb gdbserver git dos2unix lsb-core sudo curl unzip \
+ make cmake clang libmysqlclient-dev libace-dev \
+ build-essential libtool cmake-data openssl libgoogle-perftools-dev \
+ libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \
+ libncurses5-dev ccache \
+ && rm -rf /var/lib/apt/lists/*
# change timezone in container
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
@@ -40,27 +40,36 @@ RUN addgroup --gid $GROUP_ID acore && \
passwd -d acore && \
echo 'acore ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
-RUN mkdir -p /azerothcore
+# must be created to set the correct permissions on them
+RUN mkdir -p /azerothcore/env/dist/data
+RUN mkdir -p /azerothcore/env/dist/logs
+RUN mkdir -p /azerothcore/env/dist/etc
+RUN mkdir -p /azerothcore/var/build
# Correct permissions for non-root operations
-RUN chown -R acore:acore \
- /run \
- /home/acore \
- /opt/ \
- /azerothcore
+RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore
+RUN chown -R $DOCKER_USER:$DOCKER_USER /run
+RUN chown -R $DOCKER_USER:$DOCKER_USER /opt
+RUN chown -R $DOCKER_USER:$DOCKER_USER /azerothcore
-USER acore
+USER $DOCKER_USER
+
+# copy everything so we can work directly within the container
+# using tools such as vscode dev-container
+# NOTE: this folder is different by the /azerothcore (which is binded instead)
+COPY --chown=$DOCKER_USER:$DOCKER_USER . /azerothcore
WORKDIR /azerothcore
#================================================================
#
-# BUILD STAGE: to prepare binaries for the production services
+# Dev: create dev server image
#
#=================================================================
-FROM dev as build
-RUN bash acore.sh compiler build
+FROM base as dev
+
+LABEL description="AC dev image for dev containers"
#================================================================
#
@@ -70,6 +79,12 @@ RUN bash acore.sh compiler build
FROM ubuntu:20.04 as servicebase
+ARG USER_ID=1000
+ARG GROUP_ID=1000
+ARG DOCKER_USER=acore
+
+LABEL description="AC service image for server applications"
+
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
# set timezone environment variable
@@ -78,51 +93,105 @@ ENV TZ=Etc/UTC
# set noninteractive mode so tzdata doesn't ask to set timezone on install
ENV DEBIAN_FRONTEND=noninteractive
-COPY --from=build /azerothcore/env /azerothcore/env
+# Create a non-root user
+RUN addgroup --gid $GROUP_ID acore && \
+ adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID acore && \
+ passwd -d acore && \
+ echo 'acore ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
-# 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
-COPY acore.sh /azerothcore/acore.sh
-
-# install the required dependencies to run the authserver
-RUN apt-get update && apt-get install -y gdb gdbserver net-tools tzdata libmysqlclient-dev libace-dev mysql-client curl unzip;
+# install the required dependencies to run the server
+RUN apt-get update && apt-get install -y dos2unix gdb gdbserver net-tools tzdata libmysqlclient-dev libace-dev mysql-client curl unzip && rm -rf /var/lib/apt/lists/* ;
# change timezone in container
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
+# copy the sources from the host machine
+COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps
+COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin
+COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf
+COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data
+COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps
+COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json
+COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh
+
+# Correct permissions for non-root operations
+RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore
+RUN chown -R $DOCKER_USER:$DOCKER_USER /run
+RUN chown -R $DOCKER_USER:$DOCKER_USER /opt
+
+RUN chown $DOCKER_USER:$DOCKER_USER /azerothcore
+
+USER $DOCKER_USER
+
+# must be created to avoid permissions errors
+RUN mkdir -p /azerothcore/env/dist/data
+RUN mkdir -p /azerothcore/env/dist/logs
+RUN mkdir -p /azerothcore/env/dist/etc
+RUN mkdir -p /azerothcore/env/dist/bin
+
WORKDIR /azerothcore/
-RUN cp -n "/azerothcore/env/docker/etc/worldserver.conf.dockerdist" "/azerothcore/env/dist/etc/worldserver.conf"
-RUN cp -n "/azerothcore/env/docker/etc/authserver.conf.dockerdist" "/azerothcore/env/dist/etc/authserver.conf"
+#================================================================
+#
+# AUTH & WORLD local: images used for local services
+# These images don't include binaries by default
+#
+#=================================================================
+
+FROM servicebase as authserver-local
+
+LABEL description="AC authserver image for local environment"
+
+CMD ./acore.sh run-authserver
+
+FROM servicebase as worldserver-local
+
+LABEL description="AC worldserver image for local environment"
+
+CMD ./acore.sh run-worldserver
+
+#================================================================
+#
+# BUILD: compile sources
+#
+#=================================================================
+FROM base as build
+
+LABEL description="AC Image used by the build stage to generate production images"
+
+RUN bash bin/acore-docker-build
#================================================================
#
# AUTH SERVICE: create a ready-to-use authserver image
+# with binaries included
#
#=================================================================
+FROM authserver-local as authserver
-FROM servicebase as authserver
+LABEL description="AC Production ready authserver"
-CMD ./acore.sh run-authserver
+ARG DOCKER_USER=acore
+
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/etc /azerothcore/env/dist/etc
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver
#================================================================
#
# WORLD SERVICE: create a ready-to-use worldserver image
+# with binaries and data included
#
#=================================================================
+FROM worldserver-local as worldserver
-FROM servicebase as worldserver
+LABEL description="AC Production ready worldserver"
+
+ARG DOCKER_USER=acore
+
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/etc /azerothcore/env/dist/etc
+COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build /azerothcore/env/dist/bin/worldserver /azerothcore/env/dist/bin/worldserver
ENV DATAPATH=/azerothcore/env/dist/data
RUN /azerothcore/acore.sh client-data
-CMD ./acore.sh run-worldserver
-
-
-
diff --git a/apps/docker/docker-cmd.ts b/apps/docker/docker-cmd.ts
index f666ca0944..8fdd94e886 100644
--- a/apps/docker/docker-cmd.ts
+++ b/apps/docker/docker-cmd.ts
@@ -7,59 +7,98 @@ import {
const program = new Command();
-program.name("acore.sh docker")
+program
+ .name("acore.sh docker")
.description("Shell scripts for docker")
.version("1.0.0");
shellCommandFactory(
"start:app",
"Startup the authserver and worldserver apps",
- "docker-compose --profile app up",
+ ["docker-compose --profile app up"],
);
shellCommandFactory(
"start:app:d",
"Startup the authserver and worldserver apps in detached mode",
- "docker-compose --profile app up -d",
+ ["docker-compose --profile app up -d"],
);
-shellCommandFactory(
- "start:dev",
- "Startup the dev server",
- "docker-compose --profile dev up",
-);
-
-shellCommandFactory(
- "build",
- "Build the authserver and worldserver",
- `docker-compose run --rm ac-dev-server bash bin/acore-docker-build`,
-);
+shellCommandFactory("build", "Build the authserver and worldserver", [
+ "docker-compose --profile all build",
+ "docker image prune -f",
+ "docker-compose run --rm ac-build bash bin/acore-docker-update",
+]);
shellCommandFactory(
"build:clean",
- "Clean build data",
- `docker-compose run --rm ac-dev-server bash rm -rf var/build`,
+ "Clean and run build",
+ [
+ "docker-compose --profile all build",
+ "docker image prune -f",
+ `docker-compose run --rm ac-build bash acore.sh compiler clean`,
+ "docker-compose run --rm ac-build bash bin/acore-docker-update",
+ ],
+);
+
+shellCommandFactory(
+ "build:nocache",
+ "Build the authserver and worldserver without docker cache",
+ [
+ "docker-compose --profile all build --no-cache",
+ "docker image prune -f",
+ "docker-compose run --rm ac-build bash bin/acore-docker-update",
+ ],
+);
+
+shellCommandFactory(
+ "build:compile",
+ "Run the compilation process only, without rebuilding all docker images and importing db",
+ [
+ "docker-compose build ac-build",
+ "docker image prune -f",
+ "docker-compose run --rm ac-build bash acore.sh compiler build",
+ ],
);
shellCommandFactory(
"client-data",
"Download client data inside the ac-data volume",
- "docker-compose run --rm ac-dev-server bash acore.sh client-data",
+ ["docker-compose run --rm ac-worldserver bash acore.sh client-data"],
);
shellCommandFactory(
"db-import",
"Create and upgrade the database with latest updates",
- "docker-compose run --rm ac-dev-server bash acore.sh db-assembler import-all",
+ ["docker-compose run --rm ac-build bash acore.sh db-assembler import-all"],
);
shellCommandFactory(
- "dashboard [args...]",
- "Execute acore dashboard within a running ac-dev-server",
- "docker-compose exec ac-dev-server bash acore.sh",
+ "dev:up",
+ "Start the dev server container",
+ ["docker-compose up ac-dev-server"],
);
-program.command("attach [service]")
+shellCommandFactory(
+ "dev:build",
+ "Build using the dev server, it uses volumes to compile which can be faster on linux & WSL",
+ ["docker-compose run --rm ac-dev-server bash acore.sh compiler build"],
+);
+
+shellCommandFactory(
+ "dev:dash [args...]",
+ "Execute acore dashboard within a running ac-dev-server",
+ ["docker-compose run --rm ac-dev-server bash acore.sh"],
+);
+
+shellCommandFactory(
+ "dev:shell [args...]",
+ "Open an interactive shell within the dev server",
+ ["docker-compose run --rm ac-dev-server bash"],
+);
+
+program
+ .command("attach [service]")
.description("attach to a service")
.action(async (service: string | undefined) => {
const { run } = Deno;
@@ -84,6 +123,11 @@ program.command("attach [service]")
let services = new TextDecoder().decode(output).split("\n");
+ if (!services) {
+ console.error("No services available!");
+ return
+ }
+
services.pop();
services = services.slice(2);
@@ -99,6 +143,11 @@ program.command("attach [service]")
selService = services[0];
}
+ if (!selService) {
+ console.log(`Service ${service} is not available`)
+ return;
+ }
+
command = `docker attach ${selService.split(" ")[0]}`;
console.log(ink.colorize(`>>>>> Running: ${command}`));
@@ -121,9 +170,12 @@ program.command("attach [service]")
shellCmd.close();
});
-program.command("quit").description("Close docker command").action(()=> {
- process.exit(0)
-})
+program
+ .command("quit")
+ .description("Close docker command")
+ .action(() => {
+ process.exit(0);
+ });
// Handle it however you like
// e.g. display usage
@@ -133,42 +185,63 @@ while (true) {
const command = await Input.prompt({
message: "Enter the command:",
});
+ console.log(command)
await program.parseAsync(command.split(" "));
} else {
await program.parseAsync(Deno.args);
- process.exit(0)
+ process.exit(0);
}
}
-
-
+/**
+ *
+ * @param name
+ * @param description
+ * @param commands you can pass one or more commands, they will be executed sequentially
+ * @returns
+ */
function shellCommandFactory(
name: string,
description: string,
- command: string,
+ commands: string[],
): Command {
- return program.command(name)
+ return program
+ .command(name)
.description(
- `${description}. Command: \n"${ink.colorize(`${command}`)}"\n`,
+ `${description}. Command: \n"${
+ ink.colorize(
+ `${commands.join(" && ")}`,
+ )
+ }"\n`,
)
.action(async (args: any[] | undefined) => {
const { run } = Deno;
- console.log(ink.colorize(`>>>>> Running: ${command}`));
+ for (const command of commands) {
+ console.log(
+ ink.colorize(`>>>>> Running: ${command}`),
+ );
- const cmd = command.split(" ");
+ const cmd = command.split(" ");
- if (Array.isArray(args)) {
- cmd.push(...args);
+ if (Array.isArray(args)) {
+ cmd.push(...args);
+ }
+
+ const shellCmd = run({
+ cmd,
+ cwd: process.cwd(),
+ });
+
+ const status = await shellCmd.status();
+
+ if (!status.success) {
+ throw new Error(`Failed with error: ${status.code}, however,
+ it's not related to this Deno script directly. An error occurred within
+ the script called by the command itself`);
+ }
+
+ shellCmd.close();
}
-
- const shellCmd = run({
- cmd,
- cwd: process.cwd(),
- });
-
- await shellCmd.status();
-
- shellCmd.close();
});
}
diff --git a/apps/installer/includes/os_configs/debian.sh b/apps/installer/includes/os_configs/debian.sh
index a8bd531e07..cfe5b40dbd 100644
--- a/apps/installer/includes/os_configs/debian.sh
+++ b/apps/installer/includes/os_configs/debian.sh
@@ -9,9 +9,9 @@ sudo apt-get update -y
if [[ $DEBIAN_VERSION -eq "10" ]]; then
sudo apt-get install -y git cmake make gcc g++ clang default-libmysqlclient-dev \
libssl-dev libbz2-dev libreadline-dev libncurses-dev mariadb-server \
- libace-6.* libace-dev curl unzip
+ libace-6.* libace-dev curl unzip gdb gdbserver
else # Debian 8 and 9 should work using this
sudo apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev \
libssl1.0-dev libbz2-dev libreadline-dev libncurses-dev \
- mysql-server libace-6.* libace-dev curl unzip
+ mysql-server libace-6.* libace-dev curl unzip gdb gdbserver
fi
diff --git a/apps/installer/includes/os_configs/ubuntu.sh b/apps/installer/includes/os_configs/ubuntu.sh
index 63ef36d513..d37b9c0b3a 100644
--- a/apps/installer/includes/os_configs/ubuntu.sh
+++ b/apps/installer/includes/os_configs/ubuntu.sh
@@ -15,7 +15,7 @@ if [[ $CONTINUOUS_INTEGRATION || $DOCKER ]]; then
libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \
libncurses5-dev ccache curl unzip
else
- sudo apt-get install -y git gcc g++ \
+ sudo apt-get install -y git gcc g++ gdb gdbserver \
libssl-dev libbz2-dev libreadline-dev libncurses-dev \
mysql-server libace-6.*
fi
diff --git a/bin/acore-docker-build b/bin/acore-docker-build
index 1e3d050d76..efe890d445 100755
--- a/bin/acore-docker-build
+++ b/bin/acore-docker-build
@@ -1,15 +1,20 @@
#!/usr/bin/env bash
-bash acore.sh compiler build && bash acore.sh db-assembler import-all
+cd /azerothcore
-CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-
-ENV_PATH=$(readlink -f "$CUR_PATH/../env")
+bash acore.sh compiler build
echo "Generating confs..."
-cp -n "$ENV_PATH/docker/etc/worldserver.conf.dockerdist" "$ENV_PATH/dist/etc/worldserver.conf"
-cp -n "$ENV_PATH/docker/etc/authserver.conf.dockerdist" "$ENV_PATH/dist/etc/authserver.conf"
+cp -n "env/dist/etc/worldserver.conf.dockerdist" "env/dist/etc/worldserver.conf"
+cp -n "env/dist/etc/authserver.conf.dockerdist" "env/dist/etc/authserver.conf"
echo "Fixing EOL..."
-dos2unix "$ENV_PATH/dist/etc/"*
+# using -n (new file mode) should also fix the issue
+# when the file is created with the default acore user but you
+# set a different user into the docker configurations
+for file in "env/dist/etc/"*
+do
+ dos2unix -n $file $file
+done
+
diff --git a/bin/acore-docker-update b/bin/acore-docker-update
new file mode 100644
index 0000000000..0b91b50fb6
--- /dev/null
+++ b/bin/acore-docker-update
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+source "$CUR_PATH/acore-docker-build"
+
+bash acore.sh db-assembler import-all
diff --git a/conf/dist/config.sh b/conf/dist/config.sh
index c9ef22abc7..d6bd5534b8 100644
--- a/conf/dist/config.sh
+++ b/conf/dist/config.sh
@@ -102,7 +102,7 @@ readarray -td, DATABASES <<<"$DBLIST";
OUTPUT_FOLDER=${OUTPUT_FOLDER:-"$AC_PATH_ROOT/env/dist/sql/"}
-DBASM_WAIT_TIMEOUT=${DBASM_WAIT_TIMEOUT:-1}
+DBASM_WAIT_TIMEOUT=${DBASM_WAIT_TIMEOUT:-5}
DBASM_WAIT_RETRIES=${DBASM_WAIT_RETRIES:-3}
####### BACKUP
diff --git a/conf/dist/env.docker b/conf/dist/env.docker
index 28e91af917..434782c2d1 100644
--- a/conf/dist/env.docker
+++ b/conf/dist/env.docker
@@ -5,19 +5,23 @@
DOCKER_AC_ENV_FILE=
-DOCKER_DATA=./env/docker/data
-DOCKER_ETC=./env/docker/etc
-DOCKER_LOGS=./env/docker/logs
-DOCKER_CONF=./conf
+DOCKER_VOL_DATA=
+DOCKER_VOL_ETC=
+DOCKER_VOL_LOGS=
+DOCKER_VOL_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
+DOCKER_WORLD_EXTERNAL_PORT=
+DOCKER_SOAP_EXTERNAL_PORT=
+DOCKER_AUTH_EXTERNAL_PORT=
+DOCKER_DB_EXTERNAL_PORT=
+DOCKER_DB_ROOT_PASSWORD=
+
+DOCKER_USER=
+DOCKER_USER_ID=
+DOCKER_GROUP_ID=
# 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
+DOCKER_EXTENDS_BIND=
diff --git a/deps/acelite/ace/ace_message_table.bin b/deps/acelite/ace/ace_message_table.bin
index 6ac08e5dc6..f70e610b11 100644
Binary files a/deps/acelite/ace/ace_message_table.bin and b/deps/acelite/ace/ace_message_table.bin differ
diff --git a/deps/acore/mysql-tools/.gitignore b/deps/acore/mysql-tools/.gitignore
index c6659cf0c1..fa1ea4671a 100644
--- a/deps/acore/mysql-tools/.gitignore
+++ b/deps/acore/mysql-tools/.gitignore
@@ -1,13 +1,13 @@
-/mysql_config
-mysql_tools_(for usr-local-bin)
-
-#
-# Editors / debuggers / other output files
-#
-*~
-*.bak
-*.orig
-*.patch
-callgrind.out.*
-
-.upt.json
+/mysql_config
+mysql_tools_(for usr-local-bin)
+
+#
+# Editors / debuggers / other output files
+#
+*~
+*.bak
+*.orig
+*.patch
+callgrind.out.*
+
+.upt.json
diff --git a/deps/acore/mysql-tools/bin/mysql.exe b/deps/acore/mysql-tools/bin/mysql.exe
index 66267a989a..cb9a717c89 100644
Binary files a/deps/acore/mysql-tools/bin/mysql.exe and b/deps/acore/mysql-tools/bin/mysql.exe differ
diff --git a/deps/acore/mysql-tools/bin/mysqldump.exe b/deps/acore/mysql-tools/bin/mysqldump.exe
index 24355c07c3..7b545543f7 100644
Binary files a/deps/acore/mysql-tools/bin/mysqldump.exe and b/deps/acore/mysql-tools/bin/mysqldump.exe differ
diff --git a/deps/acore/mysql-tools/bin/mysqlimport.exe b/deps/acore/mysql-tools/bin/mysqlimport.exe
index 8dc3613870..36b5a9fdca 100644
Binary files a/deps/acore/mysql-tools/bin/mysqlimport.exe and b/deps/acore/mysql-tools/bin/mysqlimport.exe differ
diff --git a/deps/acore/mysql-tools/mysql-config.dist b/deps/acore/mysql-tools/mysql-config.dist
index 2075c54c11..ca71fc41ea 100644
--- a/deps/acore/mysql-tools/mysql-config.dist
+++ b/deps/acore/mysql-tools/mysql-config.dist
@@ -1,62 +1,62 @@
-#!/bin/bash
-#
-# * Copyright (C) 2007 - 2015 Hyperweb2 All rights reserved.
-# * GNU General Public License version 3; see www.hyperweb2.com/terms/
-#
-# This file contains login/password information for accessing the MySQL database
-# and is used by all the mysql_* scripts.
-#
-
-#
-# MYSQL
-#
-
-# change these lines with your mysql config
-MYSQL_DB=test
-MYSQL_USER=usr
-MYSQL_PASS=pwd
-MYSQL_HOST=localhost
-#MYSQL_SOCK=/var/lib/mysql/mysql.sock
-
-#
-# File Options
-#
-
-# path of directory where extract separated tables ( without end slash )
-TPATH=./tables
-
-# (boolean) clean directory before dump, in this way non-existant db tables will be deleted
-CLEANFOLDER=1
-
-# path of file to extract database full dump
-FPATH=./full/full.sql
-
-# (boolean) switch to enable(1)/disable(0) the dump/import of full db file
-# ( you can do it manually using command parameters )
-FULL=0
-
-# (boolean) set 1 to enable --tab option for mysqldump and import data from it
-# it's very fast import/export process but doesn't utilize the insert query
-# NOTE: full db continue to be dumped with normal sql format
-# NOTE2: if you have problem with permissions ( mysql errorcode:13) mostly in linux
-# you should enable CHMODE config and disable/edit
-# some protections such as AppArmor in Ubuntu or SELinux in Fedora..
-
-TEXTDUMPS=1
-
-# (boolean) allow to change "TPATH" folder permissions to enable mysql server writing
-
-CHMODE=0
-
-
-#
-# TOOLS OPTIONS
-#
-
-#number of threads you want to use in TEXT import mode ( you can safely set it to your number of processor increasing process speed )
-THREADS=1
-
-IMPORTOPTS_TEXT="--use-threads=$THREADS --local --compress --delete --lock-tables"
-
-DUMPOPTS="--skip-comments --skip-set-charset --extended-insert --order-by-primary --single-transaction --quick"
-
+#!/bin/bash
+#
+# * Copyright (C) 2007 - 2015 Hyperweb2 All rights reserved.
+# * GNU General Public License version 3; see www.hyperweb2.com/terms/
+#
+# This file contains login/password information for accessing the MySQL database
+# and is used by all the mysql_* scripts.
+#
+
+#
+# MYSQL
+#
+
+# change these lines with your mysql config
+MYSQL_DB=test
+MYSQL_USER=usr
+MYSQL_PASS=pwd
+MYSQL_HOST=localhost
+#MYSQL_SOCK=/var/lib/mysql/mysql.sock
+
+#
+# File Options
+#
+
+# path of directory where extract separated tables ( without end slash )
+TPATH=./tables
+
+# (boolean) clean directory before dump, in this way non-existant db tables will be deleted
+CLEANFOLDER=1
+
+# path of file to extract database full dump
+FPATH=./full/full.sql
+
+# (boolean) switch to enable(1)/disable(0) the dump/import of full db file
+# ( you can do it manually using command parameters )
+FULL=0
+
+# (boolean) set 1 to enable --tab option for mysqldump and import data from it
+# it's very fast import/export process but doesn't utilize the insert query
+# NOTE: full db continue to be dumped with normal sql format
+# NOTE2: if you have problem with permissions ( mysql errorcode:13) mostly in linux
+# you should enable CHMODE config and disable/edit
+# some protections such as AppArmor in Ubuntu or SELinux in Fedora..
+
+TEXTDUMPS=1
+
+# (boolean) allow to change "TPATH" folder permissions to enable mysql server writing
+
+CHMODE=0
+
+
+#
+# TOOLS OPTIONS
+#
+
+#number of threads you want to use in TEXT import mode ( you can safely set it to your number of processor increasing process speed )
+THREADS=1
+
+IMPORTOPTS_TEXT="--use-threads=$THREADS --local --compress --delete --lock-tables"
+
+DUMPOPTS="--skip-comments --skip-set-charset --extended-insert --order-by-primary --single-transaction --quick"
+
diff --git a/docker-compose.yml b/docker-compose.yml
index 16ade324fd..3102b4cd8a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -27,11 +27,11 @@ services:
# we cannot use /env/dist to avoid permission issues
- ac-env:/azerothcore/env
# expose some dist folder outside allowing the host to use them
- - ${DOCKER_CONF:-./conf}:/azerothcore/conf
- - ${DOCKER_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc
+ - ${DOCKER_VOL_CONF:-./conf}:/azerothcore/conf
+ - ${DOCKER_VOL_ETC:-./env/docker/etc}:/azerothcore/env/dist/etc
# [osxfs optimization]: https://stackoverflow.com/a/63437557/1964544
- - ${DOCKER_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated
- - ${DOCKER_DATA:-./env/docker/data}:/azerothcore/env/dist/data:delegated
+ - ${DOCKER_VOL_LOGS:-./env/docker/logs}:/azerothcore/env/dist/logs:delegated
+ - ${DOCKER_VOL_DATA:-./env/docker/data}:/azerothcore/env/dist/data:delegated
profiles: [abstract-service] # do not run this
abstract-no-bind:
@@ -63,9 +63,9 @@ services:
target: /var/lib/mysql
healthcheck:
test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\""
- interval: 2s
- timeout: 20s
- retries: 10
+ interval: 5s
+ timeout: 10s
+ retries: 40
ac-worldserver:
@@ -78,11 +78,19 @@ services:
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
+ user: ${DOCKER_USER:-acore}
privileged: true
build:
context: .
- target: ${DOCKER_BUILD_WORLD_TARGET:-dev}
+ target: ${DOCKER_BUILD_WORLD_TARGET:-worldserver-local}
dockerfile: ./apps/docker/Dockerfile
+ args:
+ USER_ID: ${DOCKER_USER_ID:-1000}
+ GROUP_ID: ${DOCKER_GROUP_ID:-1000}
+ DOCKER_USER: ${DOCKER_USER:-acore}
+ cache_from:
+ - acore/authserver:${DOCKER_IMAGE_TAG:-master}
+ - acore/dev-server:${DOCKER_IMAGE_TAG:-master}
ports:
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
@@ -97,10 +105,18 @@ services:
restart: unless-stopped
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
+ user: ${DOCKER_USER:-acore}
build:
context: .
- target: ${DOCKER_BUILD_AUTH_TARGET:-dev}
+ target: ${DOCKER_BUILD_AUTH_TARGET:-authserver-local}
dockerfile: ./apps/docker/Dockerfile
+ args:
+ USER_ID: ${DOCKER_USER_ID:-1000}
+ GROUP_ID: ${DOCKER_GROUP_ID:-1000}
+ DOCKER_USER: ${DOCKER_USER:-acore}
+ cache_from:
+ - acore/worldserver:${DOCKER_IMAGE_TAG:-master}
+ - acore/dev-server:${DOCKER_IMAGE_TAG:-master}
ports:
- ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724
profiles: [all, app, authserver]
@@ -110,13 +126,10 @@ services:
# Dev services
#
#======================
-
- ac-dev-server:
+ ac-build:
<<: *ac-shared-conf
- tty: true
+ extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
image: acore/dev-server:${DOCKER_IMAGE_TAG:-master}
- security_opt:
- - seccomp:unconfined
build:
context: .
target: dev
@@ -124,9 +137,40 @@ services:
args:
USER_ID: ${DOCKER_USER_ID:-1000}
GROUP_ID: ${DOCKER_GROUP_ID:-1000}
- extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
+ DOCKER_USER: ${DOCKER_USER:-acore}
+ cache_from:
+ - acore/dev-server:${DOCKER_IMAGE_TAG:-master}
env_file:
${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
+ working_dir: /azerothcore/
+ volumes:
+ - ac-build:/azerothcore/var/build
+ # use internal copied files instead of volumes
+ - /azerothcore/src
+ - /azerothcore/data
+ - /azerothcore/modules
+ profiles: [all, build]
+
+ ac-dev-server:
+ <<: *ac-shared-conf
+ extends: ${DOCKER_EXTENDS_BIND:-abstract-bind}
+ tty: true
+ image: acore/dev-server:${DOCKER_IMAGE_TAG:-master}
+ build:
+ context: .
+ target: dev
+ dockerfile: ./apps/docker/Dockerfile
+ args:
+ USER_ID: ${DOCKER_USER_ID:-1000}
+ GROUP_ID: ${DOCKER_GROUP_ID:-1000}
+ DOCKER_USER: ${DOCKER_USER:-acore}
+ cache_from:
+ - acore/dev-server:${DOCKER_IMAGE_TAG:-master}
+ security_opt:
+ - seccomp:unconfined
+ env_file:
+ ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac}
+ user: ${DOCKER_USER:-acore}
environment:
DBLIST: AUTH,CHARACTERS,WORLD
ports:
@@ -134,14 +178,24 @@ services:
- ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085
- ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878
volumes:
- - ac-build:/azerothcore/var/build
+ - ac-build-dev:/azerothcore/var/build
profiles: [all, dev]
+ depends_on:
+ ac-database:
+ condition: service_healthy
volumes:
ac-database:
ac-env:
+ ac-build-dev:
ac-build:
ac-proj:
+ # not used, but you can use them by setting
+ # the DOCKER_VOL_* env variabiles
+ ac-conf:
+ ac-etc:
+ ac-logs:
+ ac-client-data:
networks:
ac-network:
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 869d77f9b8..bc4b1391b6 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -72,6 +72,7 @@ struct TargetInfo;
#define VISIBLE_RANGE 166.0f //MAX visible range (size of grid)
+// Check out our guide on how to create new hooks in our wiki! https://www.azerothcore.org/wiki/hooks-script
/*
TODO: Add more script type classes.
@@ -81,72 +82,6 @@ struct TargetInfo;
*/
-/*
- Standard procedure when adding new script type classes:
-
- First of all, define the actual class, and have it inherit from ScriptObject, like so:
-
- class MyScriptType : public ScriptObject
- {
- uint32 _someId;
-
- private:
-
- void RegisterSelf();
-
- protected:
-
- MyScriptType(const char* name, uint32 someId)
- : ScriptObject(name), _someId(someId)
- {
- ScriptRegistry::AddScript(this);
- }
-
- public:
-
- // If a virtual function in your script type class is not necessarily
- // required to be overridden, just declare it virtual with an empty
- // body. If, on the other hand, it's logical only to override it (i.e.
- // if it's the only method in the class), make it pure virtual, by adding
- // = 0 to it.
- virtual void OnSomeEvent(uint32 someArg1, std::string& someArg2) { }
-
- // This is a pure virtual function:
- virtual void OnAnotherEvent(uint32 someArg) = 0;
- }
-
- Next, you need to add a specialization for ScriptRegistry. Put this in the bottom of
- ScriptMgr.cpp:
-
- template class ScriptRegistry;
-
- Now, add a cleanup routine in ScriptMgr::~ScriptMgr:
-
- SCR_CLEAR(MyScriptType);
-
- Now your script type is good to go with the script system. What you need to do now
- is add functions to ScriptMgr that can be called from the core to actually trigger
- certain events. For example, in ScriptMgr.h:
-
- void OnSomeEvent(uint32 someArg1, std::string& someArg2);
- void OnAnotherEvent(uint32 someArg);
-
- In ScriptMgr.cpp:
-
- void ScriptMgr::OnSomeEvent(uint32 someArg1, std::string& someArg2)
- {
- FOREACH_SCRIPT(MyScriptType)->OnSomeEvent(someArg1, someArg2);
- }
-
- void ScriptMgr::OnAnotherEvent(uint32 someArg)
- {
- FOREACH_SCRIPT(MyScriptType)->OnAnotherEvent(someArg1, someArg2);
- }
-
- Now you simply call these two functions from anywhere in the core to trigger the
- event on all registered scripts of that type.
-*/
-
class ScriptObject
{
friend class ScriptMgr;