Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-08-24 22:07:53 +08:00
96 changed files with 3271 additions and 2541 deletions
+10 -9
View File
@@ -1,17 +1,18 @@
#!/usr/bin/env bash
DB_ERRORS_FILE="./env/dist/bin/DBErrors.log";
ERRORS_FILE="./env/dist/bin/Errors.log";
if [[ ! -f ${DB_ERRORS_FILE} ]]; then
echo "File ${DB_ERRORS_FILE} not found!";
exit 1
fi
echo "Checking Startup Errors"
echo
if [[ -s ${DB_ERRORS_FILE} ]]; then
printf "The DBErrors.log file contains startup errors:\n\n";
cat ${DB_ERRORS_FILE};
if [[ -s ${ERRORS_FILE} ]]; then
printf "The Errors.log file contains startup errors:\n\n";
cat ${ERRORS_FILE};
printf "\nPlease solve the startup errors listed above!\n";
exit 1;
else
echo "No startup errors found in DBErrors.log, good job!";
echo "> No startup errors found in Errors.log";
fi
echo
echo "Done"
-59
View File
@@ -143,32 +143,6 @@ function comp_compile() {
find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec sudo chown root:root -- {} +
find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec sudo chmod u+s -- {} +
DOCKER_ETC_FOLDER=${DOCKER_ETC_FOLDER:-"env/dist/etc"}
if [[ $DOCKER = 1 && $DISABLE_DOCKER_CONF != 1 ]]; then
echo "Generating confs..."
# Search for all configs under DOCKER_ETC_FOLDER
for dockerdist in "$DOCKER_ETC_FOLDER"/*.dockerdist; do
# Grab "base" conf. turns foo.conf.dockerdist into foo.conf
baseConf="$(echo "$dockerdist" | rev | cut -f1 -d. --complement | rev)"
# env/dist/etc/foo.conf becomes foo.conf
filename="$(basename "$baseConf")"
# the dist files should be always found inside $confDir
# which may not be the same as DOCKER_ETC_FOLDER
distPath="$confDir/$filename.dist"
# if dist file doesn't exist, skip this iteration
[ ! -f "$distPath" ] && continue
# replace params in foo.conf.dist with params in foo.conf.dockerdist
conf_layer "$dockerdist" "$distPath" " # Copied from dockerdist"
# Copy modified dist file to $confDir/$filename
# Don't overwrite foo.conf if it already exists.
cp --no-clobber --verbose "$distPath" "$confDir/$filename"
done
fi
echo "Done"
;;
esac
@@ -185,36 +159,3 @@ function comp_all() {
comp_clean
comp_build
}
# conf_layer FILENAME FILENAME
# Layer the configuration parameters from the first argument onto the second argument
function conf_layer() {
LAYER="$1"
BASE="$2"
COMMENT="$3"
# Loop over all defined params in conf file
grep -E "^[a-zA-Z\.0-9]+\s*=.*$" "$LAYER" \
| while read -r param
do
# remove spaces from param
# foo = bar becomes foo=bar
NOSPACE="$(tr -d '[:space:]' <<< "$param")"
# split into key and value
KEY="$(cut -f1 -d= <<< "$NOSPACE")"
VAL="$(cut -f2 -d= <<< "$NOSPACE")"
# if key in base and val not in line
if grep -qE "^$KEY" "$BASE" && ! grep -qE "^$KEY.*=.*$VAL" "$BASE"; then
# Replace line
# Prevent issues with shell quoting
sed -i \
's,^'"$KEY"'.*,'"$KEY = $VAL$COMMENT"',g' \
"$BASE"
else
# insert line
echo "$KEY = $VAL$COMMENT" >> "$BASE"
fi
done
echo "Layered $LAYER onto $BASE"
}
-3
View File
@@ -1,3 +0,0 @@
/output/
/backup/
config.sh
-24
View File
@@ -1,24 +0,0 @@
## Description
**ATTENTION:** this tool is not supported anymore. It has been replaced by the **dbimport** tools integrated in AC server sources
This script allows you to assemble all sql files into one so you can easily import it to your databases (or use the main script to import directly). By default, it creates the merged files in `/env/dist`.
## How to use:
First of all, if you need some custom configuration, you have to copy `/conf/dist/config.sh` to `/conf/config.sh` and configure it. The file is here: https://github.com/azerothcore/azerothcore-wotlk/tree/master/conf
_Read it because there are several options to configure._
`db_assembler.sh` script contains an interactive menu to assemble and import sql files.
Just run it to display the options.
Note: You can even use actions directly by command lines specifying the option.
Ex:
./db_assembler.sh 1
It will merge all sql files without an interactive menu.
-121
View File
@@ -1,121 +0,0 @@
##############################################
#
# DB ASSEMBLER / EXPORTER CONFIGURATIONS
#
##############################################
#
# Comma separated list of databases
#
# You can add another element here if you need
# to support multiple databases
#
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:-5}
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
# Do not forget to stop your database software (mysql) before doing so
BACKUP_ENABLE=false
BACKUP_FOLDER="$AC_PATH_ROOT/env/dist/sql/backup/"
#######
# FULL DB
DB_AUTH_PATHS=(
"$SRCPATH/data/sql/base/db_auth/"
)
DB_CHARACTERS_PATHS=(
"$SRCPATH/data/sql/base/db_characters"
)
DB_WORLD_PATHS=(
"$SRCPATH/data/sql/base/db_world/"
)
# UPDATES
DB_AUTH_UPDATES_PATHS=(
"$SRCPATH/data/sql/updates/db_auth/"
"$SRCPATH/data/sql/updates/pending_db_auth/"
)
DB_CHARACTERS_UPDATES_PATHS=(
"$SRCPATH/data/sql/updates/db_characters/"
"$SRCPATH/data/sql/updates/pending_db_characters/"
)
DB_WORLD_UPDATES_PATHS=(
"$SRCPATH/data/sql/updates/db_world/"
"$SRCPATH/data/sql/updates/pending_db_world/"
)
# CUSTOM
DB_AUTH_CUSTOM_PATHS=(
"$SRCPATH/data/sql/custom/db_auth/"
)
DB_CHARACTERS_CUSTOM_PATHS=(
"$SRCPATH/data/sql/custom/db_characters/"
)
DB_WORLD_CUSTOM_PATHS=(
"$SRCPATH/data/sql/custom/db_world/"
)
##############################################
#
# DB EXPORTER/IMPORTER CONFIGURATIONS
#
##############################################
#
# Skip import of base sql files to avoid
# table dropping
#
DB_SKIP_BASE_IMPORT_IF_EXISTS=true
#
# Example:
# "C:/Program Files/MySQL/MySQL Server 8.0/bin/mysql.exe"
# "/usr/bin/mysql"
# "mysql"
#
DB_MYSQL_EXEC="mysql"
DB_MYSQL_DUMP_EXEC="mysqldump"
DB_AUTH_CONF=${DB_AUTH_CONF:-"MYSQL_USER='acore'; \
MYSQL_PASS='acore'; \
MYSQL_HOST='localhost';\
MYSQL_PORT='3306';\
"}
DB_CHARACTERS_CONF=${DB_CHARACTERS_CONF:-"MYSQL_USER='acore'; \
MYSQL_PASS='acore'; \
MYSQL_HOST='localhost';\
MYSQL_PORT='3306';\
"}
DB_WORLD_CONF=${DB_WORLD_CONF:-"MYSQL_USER='acore'; \
MYSQL_PASS='acore'; \
MYSQL_HOST='localhost';\
MYSQL_PORT='3306';\
"}
DB_AUTH_NAME="acore_auth"
DB_CHARACTERS_NAME="acore_characters"
DB_WORLD_NAME="acore_world"
-81
View File
@@ -1,81 +0,0 @@
#!/usr/bin/env bash
echo ----------------------------------------------------------------------------------------------- >&2
echo ATTENTION: This tool is DEPRECATED. To assemble or update your DB, use the worldserver instead. >&2
echo ----------------------------------------------------------------------------------------------- >&2
set -e
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/includes/includes.sh"
cmdopt=$1
PS3='[Please enter your choice]: '
options=(
"all: Assemble all" # 1
"bases: Assemble only bases" # 2
"updates: Assemble only updates" # 3
"customs: Assemble only customs" # 4
"import-all: Assemble & Import all" # 5
"import-bases: Assemble & Import only bases" # 6
"import-updates: Assemble & Import only updates" # 7
"import-customs: Assemble & Import only customs" # 8
"quit: Exit from this menu" # 9
)
function _switch() {
_reply="$1"
_opt="$2"
case $_reply in
""|"all"|"1")
dbasm_run true true true
;;
""|"bases"|"2")
dbasm_run true false false
;;
""|"updates"|"3")
dbasm_run false true false
;;
""|"customs"|"4")
dbasm_run false false true
;;
""|"import-all"|"5")
dbasm_import true true true
;;
""|"import-bases"|"6")
dbasm_import true false false
;;
""|"import-updates"|"7")
dbasm_import false true false
;;
""|"import-customs"|"8")
dbasm_import false false true
;;
""|"quit"|"9")
echo "Goodbye!"
exit
;;
""|"--help")
echo "Available commands:"
printf '%s\n' "${options[@]}"
;;
*) echo "invalid option, use --help option for the commands list";;
esac
}
while true
do
# run option directly if specified in argument
[ ! -z $1 ] && _switch $@
[ ! -z $1 ] && exit 0
select opt in "${options[@]}"
do
echo "===== DB ASSEMBLER MENU ====="
_switch $REPLY
break
done
done
-411
View File
@@ -1,411 +0,0 @@
# globals
PROMPT_USER=""
PROMPT_PASS=""
function dbasm_waitMysqlConn() {
DBHOST="$1"
DBPORT="$2"
COUNT=0
while ! mysqladmin ping -h"$DBHOST" --port="$DBPORT" --silent; do
((COUNT++))
if [ $COUNT -gt $DBASM_WAIT_RETRIES ]; then
echo "DBASM Timeout: Cannot ping mysql!" 1>&2
exit 64
fi
echo "Cannot ping mysql on $DBHOST:$DBPORT, retry in $DBASM_WAIT_TIMEOUT seconds (remaining: $COUNT/$DBASM_WAIT_RETRIES)..."
sleep $DBASM_WAIT_TIMEOUT
done
}
# use in a subshell
function dbasm_resetExitCode() {
exit 0
}
function dbasm_mysqlExec() {
confs=$1
command=$2
options=$3
# MYSQL_PORT needs to be reseted as the next eval might not overwite the current value causing the commands to use wrong port
MYSQL_PORT=3306
eval $confs
if [[ ! -z "${PROMPT_USER// }" ]]; then
MYSQL_USER=$PROMPT_USER
MYSQL_PASS=$PROMPT_PASS
fi
dbasm_waitMysqlConn $MYSQL_HOST $MYSQL_PORT
export MYSQL_PWD=$MYSQL_PASS
retval=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" -P "$MYSQL_PORT" $options -e "$command")
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" -P "$MYSQL_PORT" $options -e "$command" 2>&1 )
if [[ "$err" == *"Access denied"* ]]; then
read -p "Insert mysql user:" PROMPT_USER
read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS
retval=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" -P "$MYSQL_PORT" $options -e "$command")
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" -P "$MYSQL_PORT" $options -e "$command" 2>&1 )
# it happens on new mysql 5.7 installations
# since mysql_native_password is explicit now
if [[ "$err" == *"Access denied"* ]]; then
echo "Setting mysql_native_password and for $PROMPT_USER ..."
sudo -h "$MYSQL_HOST" "$DB_MYSQL_EXEC" -P "$MYSQL_PORT" -e "UPDATE mysql.user SET authentication_string=PASSWORD('${PROMPT_PASS}'), plugin='mysql_native_password' WHERE User='${PROMPT_USER}'; FLUSH PRIVILEGES;"
fi
fi
# create configured account if not exists
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -P "$MYSQL_PORT" -e "CREATE USER IF NOT EXISTS '${MYSQL_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${MYSQL_PASS}' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;"
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -P "$MYSQL_PORT" -e "GRANT CREATE ON *.* TO '${MYSQL_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;"
for db in ${DATABASES[@]}
do
local _uc=${db^^}
local _name="DB_"$_uc"_CONF"
local _confs=${!_name}
local _name="DB_"$_uc"_NAME"
local _dbname=${!_name}
eval $_confs
echo "Grant permissions for ${MYSQL_USER}'@'${MYSQL_HOST} to ${_dbname}"
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" $options -P "$MYSQL_PORT" -e "GRANT ALL PRIVILEGES ON ${_dbname}.* TO '${MYSQL_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION; FLUSH PRIVILEGES;"
done
else
exit
fi
fi
}
function dbasm_isNotEmpty() {
dbname=$1
conf=$2
dbasm_mysqlExec "$conf" "SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '${dbname}'" "--skip-column-names"
if (( $retval > 0 )); then
true
else
false
fi
}
function dbasm_dbExists() {
dbname=$1
conf=$2
dbasm_mysqlExec "$conf" "SHOW DATABASES LIKE '${dbname}'" "--skip-column-names"
if [ "$retval" == "${dbname}" ]; then
true
else
false
fi
}
function dbasm_createDB() {
database=${1,,}
uc=${database^^}
name="DB_"$uc"_CONF"
confs=${!name}
name="DB_"$uc"_NAME"
dbname=${!name}
eval $confs
CONF_USER=$MYSQL_USER
CONF_PASS=$MYSQL_PASS
if dbasm_dbExists $dbname "$confs"; then
echo "$dbname database exists"
else
echo "Creating DB ${dbname} ..."
dbasm_mysqlExec "$confs" "CREATE DATABASE \`${dbname}\`;" ""
echo "Creating User ${CONF_USER}@${MYSQL_HOST} identified by ${CONF_PASS}..."
dbasm_mysqlExec "$confs" "CREATE USER IF NOT EXISTS '${CONF_USER}'@'${MYSQL_HOST}' IDENTIFIED BY '${CONF_PASS}';"
echo "Granting user privileges on: ${dbname} ..."
dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\`.* TO '${CONF_USER}'@'${MYSQL_HOST}'"
echo "Flush privileges"
dbasm_mysqlExec "$confs" "FLUSH PRIVILEGES;"
fi
}
function dbasm_assemble() {
# to lowercase
database=${1,,}
start_sql=$2
with_base=$3
with_updates=$4
with_custom=$5
uc=${database^^}
name="DB_"$uc"_PATHS"
v="$name[@]"
base=("${!v}")
name="DB_"$uc"_UPDATES_PATHS"
v="$name[@]"
updates=("${!v}")
name='DB_'$uc'_CUSTOM_PATHS'
v="$name[@]"
custom=("${!v}")
suffix_base="_base"
suffix_upd="_updates"
suffix_custom="_custom"
curTime=`date +%Y_%m_%d_%H_%M_%S`
# ALLOW FOR RECURSION WITH "**"
shopt -s globstar
if [ $with_base = true ]; then
echo "" > "$OUTPUT_FOLDER$database$suffix_base.sql"
if [ ! ${#base[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_base ..."
for d in "${base[@]}"
do
echo "Searching on $d ..."
if [ ! -z "$d" ]; then
for entry in "$d"/**/*.sql
do
if [[ -e $entry ]]; then
cat "$entry" >> "$OUTPUT_FOLDER$database$suffix_base.sql"
fi
done
fi
done
fi
fi
if [ $with_updates = true ]; then
updFile="$OUTPUT_FOLDER$database$suffix_upd.sql"
echo "" > "$updFile"
if [ ! ${#updates[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_upd ..."
for d in "${updates[@]}"
do
echo "Searching on $d ..."
if [ ! -z "$d" ]; then
for entry in "$d"/**/*.sql
do
if [[ ! -e $entry ]]; then
continue
fi
echo "-- $file" >> "$updFile"
cat "$entry" >> "$updFile"
done
fi
done
fi
fi
if [ $with_custom = true ]; then
custFile="$OUTPUT_FOLDER$database$suffix_custom.sql"
echo "" > "$custFile"
if [ ! ${#custom[@]} -eq 0 ]; then
echo "Generating $OUTPUT_FOLDER$database$suffix_custom ..."
for d in "${custom[@]}"
do
echo "Searching on $d ..."
if [ ! -z "$d" ]; then
for entry in "$d"/**/*.sql
do
if [[ ! -e $entry ]]; then
continue
fi
echo "-- $file" >> "$custFile"
cat "$entry" >> "$custFile"
done
fi
done
fi
fi
}
function dbasm_run() {
echo "===== STARTING ASSEMBLY PROCESS ====="
mkdir -p "$OUTPUT_FOLDER"
for db in ${DATABASES[@]}
do
dbasm_assemble "$db" $version".sql" $1 $2 $3
done
echo "===== DONE ====="
}
function dbasm_db_backup() {
echo "backing up $1"
database=${1,,}
uc=${database^^}
name="DB_"$uc"_CONF"
confs=${!name}
name="DB_"$uc"_NAME"
dbname=${!name}
# MYSQL_PORT needs to be reseted as the next eval might not overwite the current value causing the commands to use wrong port
MYSQL_PORT=3306
eval $confs;
if [[ ! -z "${PROMPT_USER// }" ]]; then
MYSQL_USER=$PROMPT_USER
MYSQL_PASS=$PROMPT_PASS
fi
export MYSQL_PWD=$MYSQL_PASS
now=`date +%s`
"$DB_MYSQL_DUMP_EXEC" --opt --user="$MYSQL_USER" --host="$MYSQL_HOST" --port="$MYSQL_PORT" "$dbname" > "${BACKUP_FOLDER}${database}_backup_${now}.sql" && echo "done"
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_DUMP_EXEC" --opt --user="$MYSQL_USER" --host="$MYSQL_HOST" --port="$MYSQL_PORT" "$dbname" 2>&1 )
if [[ "$err" == *"Access denied"* ]]; then
read -p "Insert mysql user:" PROMPT_USER
read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS
"$DB_MYSQL_DUMP_EXEC" --opt --user="$PROMPT_USER" --host="$MYSQL_HOST" --port="$MYSQL_PORT" "$dbname" > "${BACKUP_FOLDER}${database}_backup_${now}.sql" && echo "done"
else
exit
fi
fi
}
function dbasm_db_import() {
database=${1,,}
type=$2
uc=${database^^}
name="DB_"$uc"_CONF"
confs=${!name}
name="DB_"$uc"_NAME"
dbname=${!name}
if [[ $type = "base" && $DB_SKIP_BASE_IMPORT_IF_EXISTS = true ]]; then
if dbasm_isNotEmpty $dbname "$confs"; then
echo "$dbname is not empty, base importing skipped"
return
else
echo "$dbname seems empty"
fi
fi
echo "importing $1 - $2 ..."
# MYSQL_PORT needs to be reseted as the next eval might not overwite the current value causing the commands to use wrong port
MYSQL_PORT=3306
eval $confs;
if [[ ! -z "${PROMPT_USER// }" ]]; then
MYSQL_USER=$PROMPT_USER
MYSQL_PASS=$PROMPT_PASS
fi
dbasm_waitMysqlConn $MYSQL_HOST $MYSQL_PORT
export MYSQL_PWD=$MYSQL_PASS
# TODO: remove this line after we squash our DB updates
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" --port="$MYSQL_PORT" -e "SET GLOBAL max_allowed_packet=128*1024*1024;"
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" --port="$MYSQL_PORT" --default-character-set=utf8 "$dbname" < "${OUTPUT_FOLDER}${database}_${type}.sql"
if [[ $? -ne 0 ]]; then
err=$("$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$MYSQL_USER" -P "$MYSQL_PORT" "$dbname" 2>&1 )
if [[ "$err" == *"Access denied"* ]]; then
read -p "Insert mysql user:" PROMPT_USER
read -p "Insert mysql pass:" -s PROMPT_PASS
export MYSQL_PWD=$PROMPT_PASS
"$DB_MYSQL_EXEC" -h "$MYSQL_HOST" -u "$PROMPT_USER" -P "$MYSQL_PORT" "$dbname" < "${OUTPUT_FOLDER}${database}_${type}.sql"
else
exit
fi
fi
}
function dbasm_import() {
dbasm_run $1 $2 $3
with_base=$1
with_updates=$2
with_custom=$3
echo "===== CHECKING DBs ====="
for db in ${DATABASES[@]}
do
dbasm_createDB "$db"
done
echo "===== DONE ====="
#
# BACKUP
#
if [ $BACKUP_ENABLE = true ]; then
echo "===== STARTING BACKUP PROCESS ====="
mkdir -p "$BACKUP_FOLDER"
for db in ${DATABASES[@]}
do
dbasm_db_backup "$db"
done
echo "===== DONE ====="
fi
echo "===== STARTING IMPORTING PROCESS ====="
#
# IMPORT
#
if [ $with_base = true ]; then
for db in ${DATABASES[@]}
do
dbasm_db_import "$db" "base"
done
fi
if [ $with_updates = true ]; then
for db in ${DATABASES[@]}
do
dbasm_db_import "$db" "updates"
done
fi
if [ $with_custom = true ]; then
for db in ${DATABASES[@]}
do
dbasm_db_import "$db" "custom"
done
fi
echo "===== DONE ====="
}
-11
View File
@@ -1,11 +0,0 @@
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_PATH/../../bash_shared/includes.sh"
AC_PATH_DBASSEMBLER="$AC_PATH_APPS/db_assembler"
if [ -f "$AC_PATH_DBASSEMBLER/config.sh" ]; then
source "$AC_PATH_DBASSEMBLER/config.sh" # should overwrite previous
fi
source "$AC_PATH_DBASSEMBLER/includes/functions.sh"
+22 -24
View File
@@ -18,6 +18,9 @@ LABEL description="AC base image for dev containers"
ENV DOCKER=1
# Ensure ac-dev-server can properly pull versions
ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
# set timezone environment variable
ENV TZ=Etc/UTC
@@ -34,14 +37,17 @@ RUN apt-get update && apt-get install -y gdb gdbserver git dos2unix lsb-core sud
libncurses5-dev ccache \
&& rm -rf /var/lib/apt/lists/*
# Ensure git will work with the AzerothCore source directory
RUN git config --global --add safe.directory /azerothcore
# change timezone in container
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
# 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
RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
passwd -d "$DOCKER_USER" && \
echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
# must be created to set the correct permissions on them
RUN mkdir -p /azerothcore/env/dist/bin
@@ -94,11 +100,6 @@ USER $DOCKER_USER
# NOTE: this folder is different by the /azerothcore (which is binded instead)
COPY --chown=$DOCKER_USER:$DOCKER_USER . /azerothcore
# Needed if we use the dev image without linking any external folder (e.g. acore-docker)
COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/authserver.conf.dockerdist /azerothcore/env/dist/etc/authserver.conf.dockerdist
COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/worldserver.conf.dockerdist /azerothcore/env/dist/etc/worldserver.conf.dockerdist
COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/dbimport.conf.dockerdist /azerothcore/env/dist/etc/dbimport.conf.dockerdist
#================================================================
#
# SERVICE BASE: prepare the OS for the production-ready services
@@ -122,10 +123,10 @@ ENV TZ=Etc/UTC
ENV DEBIAN_FRONTEND=noninteractive
# 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
RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
passwd -d "$DOCKER_USER" && \
echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
# install the required dependencies to run the server
RUN apt-get update && apt-get install -y dos2unix gdb gdbserver google-perftools libgoogle-perftools-dev net-tools \
@@ -205,9 +206,6 @@ COPY --chown=$DOCKER_USER:$DOCKER_USER ./modules /azerothcore/modules
# check if we have ccache files available outside
RUN rm -rf /azerothcore/var/ccache/*
COPY --chown=$DOCKER_USER:$DOCKER_USER var/docker/ccache /azerothcore/var/ccache
COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/authserver.conf.dockerdist /azerothcore/env/dist/etc/authserver.conf.dockerdist
COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/worldserver.conf.dockerdist /azerothcore/env/dist/etc/worldserver.conf.dockerdist
COPY --chown=$DOCKER_USER:$DOCKER_USER env/docker/etc/dbimport.conf.dockerdist /azerothcore/env/dist/etc/dbimport.conf.dockerdist
# install eluna
RUN git clone --depth=1 --branch=master https://github.com/azerothcore/mod-eluna.git /azerothcore/modules/mod-eluna
@@ -279,10 +277,10 @@ ENV TZ=Etc/UTC
# set noninteractive mode so tzdata doesn't ask to set timezone on install
ENV DEBIAN_FRONTEND=noninteractive
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
RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
passwd -d "$DOCKER_USER" && \
echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
# ENV DATAPATH=/azerothcore/env/dist/data-temp
ENV DATAPATH=/azerothcore/env/dist/data
@@ -321,10 +319,10 @@ RUN apt-get update && apt-get install -y libmysqlclient-dev libssl-dev libbz2-de
sudo && rm -rf /var/lib/apt/lists/* ;
# 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
RUN addgroup --gid "$GROUP_ID" "$DOCKER_USER" && \
adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
passwd -d "$DOCKER_USER" && \
echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN mkdir -p /azerothcore/env/client/
RUN chown -R $DOCKER_USER:$DOCKER_USER /azerothcore