diff options
author | Yehonal <yehonal.azeroth@gmail.com> | 2021-04-22 09:57:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-22 09:57:05 +0200 |
commit | 380f406248bdc1f15227a7b2f8a75b4bf922f730 (patch) | |
tree | 497bb589f7bd80073ea755f14e33505ff572353b | |
parent | 4a8faafaff2753349ea15aa602cc3816f4e42de6 (diff) |
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)
100 files changed, 2745 insertions, 776 deletions
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..ea659ebfe1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,53 @@ +// If you want to run as a non-root user in the container, see .devcontainer/docker-compose.yml. +{ + "name": "ac-dev-server", + + // Update the 'dockerComposeFile' list if you have more compose files or use different names. + // The .devcontainer/docker-compose.yml file contains any overrides you need/want to make. + "dockerComposeFile": [ + "../docker-compose.yml", + "../docker-compose.override.yml", // needed until this issue will be solved: https://github.com/microsoft/vscode-remote-release/issues/1080 + "docker-compose.yml" + ], + // The 'service' property is the name of the service for the container that VS Code should + // use. Update this value and .devcontainer/docker-compose.yml to the real service name. + "service": "ac-dev-server", + + // The optional 'workspaceFolder' property is the path VS Code should open by default when + // connected. This is typically a file mount in .devcontainer/docker-compose.yml + "workspaceFolder": "/azerothcore", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": null + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "notskm.clang-tidy", + "xaver.clang-format", + "bbenoist.doxygen", + "ms-vscode.cpptools", + "austin.code-gnu-global", + "twxs.cmake", + "mhutchie.git-graph", + "github.vscode-pull-request-github", + "eamodio.gitlens", + "cschlosser.doxdocgen" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line if you want start specific services in your Docker Compose config. + "runServices": ["ac-dev-server", "ac-database"], + + // Uncomment the next line if you want to keep your containers running after VS Code shuts down. + // "shutdownAction": "none", + + // Uncomment the next line to run commands after the container is created - for example installing curl. + // "postCreateCommand": "apt-get update && apt-get install -y curl", + + // Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "acore" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 0000000000..a1daace7c5 --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,35 @@ +version: '3.9' +services: + # Update this to the name of the service you want to work with in your docker-compose.yml file + ac-dev-server: + # If you want add a non-root user to your Dockerfile, you can use the "remoteUser" + # property in devcontainer.json to cause VS Code its sub-processes (terminals, tasks, + # debugging) to execute as the user. Uncomment the next line if you want the entire + # container to run as this user instead. Note that, on Linux, you may need to + # ensure the UID and GID of the container user you create matches your local user. + # See https://aka.ms/vscode-remote/containers/non-root for details. + # + # user: vscode + + # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer + # folder. Note that the path of the Dockerfile and context is relative to the *primary* + # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" + # array). The sample below assumes your primary file is in the root of your project. + # + # build: + # context: . + # dockerfile: .devcontainer/Dockerfile + + #volumes: + # Update this to wherever you want VS Code to mount the folder of your project + #- .:/workspace:cached + + # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details. + # - /var/run/docker.sock:/var/run/docker.sock + + # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. + # cap_add: + # - SYS_PTRACE + # security_opt: + # - seccomp:unconfined + tty: true diff --git a/.dockerignore b/.dockerignore index 18644dcc28..5baa9d3d99 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,10 +1,12 @@ -build*/ -var/* -data/contrib/* -data/doc/* -conf/* -!conf/dist -docker/worldserver/data/* -docker/build/cache +/cmake-build-debug/* +/build*/ +/var/* +/env/dist/* +/env/user/* +/env/docker/data/* +/env/docker/logs/* +/env/docker/etc/* +!/env/docker/etc/authserver.conf.dockerdist +!/env/docker/etc/worldserver.conf.dockerdist +/.env* .idea -cmake-build-debug/* diff --git a/.env.dist b/.env.dist deleted file mode 100644 index f3dc4b6225..0000000000 --- a/.env.dist +++ /dev/null @@ -1,12 +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=3306 -DB_ROOT_PASSWORD=password -SOAP_EXTERNAL_PORT=7878 diff --git a/.github/workflows/core_build.yml b/.github/workflows/core_build.yml index 1be5d9168d..c855277967 100644 --- a/.github/workflows/core_build.yml +++ b/.github/workflows/core_build.yml @@ -139,62 +139,39 @@ jobs: name: windows-2019-MSVC16-release path: build/bin/Release - docker-build: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build - run: | - ./bin/acore-docker-build-no-scripts - - docker-worldserver: + docker-build-n-deploy: strategy: fail-fast: true runs-on: ubuntu-20.04 if: github.repository == 'azerothcore/azerothcore-wotlk' + env: + DOCKER_EXTENDS_BIND: abstract-no-bind + DOCKER_BUILD_WORLD_TARGET: worldserver + DOCKER_BUILD_AUTH_TARGET: authserver steps: + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch - uses: actions/checkout@v2 - name: Configure run: | docker --version docker-compose --version - name: Build + #env: + # DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }} run: | - docker build -t azerothcore/worldserver -f docker/worldserver/Dockerfile docker/worldserver - - docker-authserver: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build + docker-compose --profile all build + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Deploy + #env: + # DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }} + if: ${{ steps.extract_branch.outputs.branch == 'master' }} run: | - docker build -t azerothcore/authserver -f docker/authserver/Dockerfile docker/authserver + docker-compose --profile all push - docker-database: - strategy: - fail-fast: true - runs-on: ubuntu-20.04 - if: github.repository == 'azerothcore/azerothcore-wotlk' - steps: - - uses: actions/checkout@v2 - - name: Configure - run: | - docker --version - docker-compose --version - - name: Build - run: | - docker build -t azerothcore/database -f docker/database/Dockerfile . diff --git a/.gitignore b/.gitignore index d9a08b14a5..ca628ad590 100644 --- a/.gitignore +++ b/.gitignore @@ -2,29 +2,25 @@ # AzerothCore # -conf/* -!conf/dist -apps/drassil/* -env/dist/* -env/user/* -modules/* -!modules/*.md -!modules/*.sh -build*/ -var/* -docker/build/cache -docker/authserver/bin -docker/worldserver/bin -docker/authserver/etc/authserver.conf -docker/authserver/etc/authserver.conf.dist -docker/worldserver/etc/worldserver.conf -docker/worldserver/etc/worldserver.conf.dist -docker/authserver/logs/ -docker/worldserver/logs/ -docker/worldserver/data/ -!docker/build -.env -apps/joiner +/conf/* +!/conf/dist +/modules/* +!/modules/*.md +!/modules/*.sh +/build*/ +/var/* +/env/dist/* +/env/user/* +/env/docker/data/* +/env/docker/logs/* +/env/docker/etc/* +!/env/docker/etc/authserver.conf.dockerdist +!/env/docker/etc/worldserver.conf.dockerdist +/.env* +/apps/joiner +/deps/deno + +/docker-compose.override.yml !.gitkeep @@ -59,7 +55,6 @@ nbproject/ .sync.ffs_db *.kate-swp .browse.VC* -.vscode .idea cmake-build-debug/* cmake-build-debug-coverage/* @@ -85,9 +80,9 @@ local.properties # ================== # # CUSTOM -# +# # put below your custom ignore rules -# for example , if you want to include a +# for example , if you want to include a # module directly in repositoryyou can do: # # !modules/yourmodule diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..8fbdb5467d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/git-subrepo"] + path = deps/git-subrepo + url = https://github.com/ingydotnet/git-subrepo.git diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000000..f78da7e8aa --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,15 @@ +{ + "recommendations": [ + "ms-vscode-remote.remote-containers", + "notskm.clang-tidy", + "xaver.clang-format", + "bbenoist.doxygen", + "ms-vscode.cpptools", + "austin.code-gnu-global", + "twxs.cmake", + "mhutchie.git-graph", + "github.vscode-pull-request-github", + "eamodio.gitlens", + "cschlosser.doxdocgen" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..bb4fa23a78 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,68 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Linux/Docker debug", + "type": "cppdbg", + "request": "launch", + "program": "/azerothcore/env/dist/bin/worldserver", + "cwd": "/azerothcore", + "args": [], + "environment": [], + "externalConsole": false, + "sourceFileMap": { + "/azerothcore": "${workspaceFolder}" + }, + "linux": { + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": false + } + ] + } + }, + { + "name": "(docker run) Pipe Launch", + "type": "cppdbg", + "request": "launch", + "program": "/azerothcore/env/dist/bin/worldserver", + "cwd": "/azerothcore", + "args": [], + "environment": [], + "externalConsole": true, + "pipeTransport": { + "debuggerPath": "/usr/bin/gdb", + "pipeProgram": "docker-compose", + "pipeArgs": [ + "exec", "-T", "ac-worldserver", "sh", "-c" + ], + "pipeCwd": "${workspaceFolder}" + }, + "sourceFileMap": { + "/azerothcore": "${workspaceFolder}" + }, + "linux": { + "MIMode": "gdb", + "miDebuggerPath": "/usr/bin/gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": false + } + ] + }, + "osx": { + "MIMode": "lldb" + }, + "windows": { + "MIMode": "gdb", + "miDebuggerPath": "C:\\MinGw\\bin\\gdb.exe" + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..1cf6801393 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,69 @@ +{ + "files.associations": { + "array": "cpp", + "atomic": "cpp", + "bit": "cpp", + "*.tcc": "cpp", + "bitset": "cpp", + "cctype": "cpp", + "chrono": "cpp", + "cinttypes": "cpp", + "clocale": "cpp", + "cmath": "cpp", + "complex": "cpp", + "condition_variable": "cpp", + "csignal": "cpp", + "cstdarg": "cpp", + "cstddef": "cpp", + "cstdint": "cpp", + "cstdio": "cpp", + "cstdlib": "cpp", + "cstring": "cpp", + "ctime": "cpp", + "cwchar": "cpp", + "cwctype": "cpp", + "deque": "cpp", + "list": "cpp", + "map": "cpp", + "set": "cpp", + "unordered_map": "cpp", + "unordered_set": "cpp", + "vector": "cpp", + "exception": "cpp", + "algorithm": "cpp", + "functional": "cpp", + "iterator": "cpp", + "memory": "cpp", + "memory_resource": "cpp", + "numeric": "cpp", + "optional": "cpp", + "random": "cpp", + "ratio": "cpp", + "string": "cpp", + "string_view": "cpp", + "system_error": "cpp", + "tuple": "cpp", + "type_traits": "cpp", + "utility": "cpp", + "fstream": "cpp", + "initializer_list": "cpp", + "iomanip": "cpp", + "iosfwd": "cpp", + "iostream": "cpp", + "istream": "cpp", + "limits": "cpp", + "mutex": "cpp", + "new": "cpp", + "ostream": "cpp", + "shared_mutex": "cpp", + "sstream": "cpp", + "stdexcept": "cpp", + "streambuf": "cpp", + "thread": "cpp", + "cfenv": "cpp", + "typeinfo": "cpp", + "codecvt": "cpp" + }, + "deno.enable": true, + "deno.path" : "deps/deno/bin/deno" +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..eeba203d70 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,19 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "./acore.sh compiler build", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] + } diff --git a/CMakeLists.txt b/CMakeLists.txt index 21700f6eab..2dbcfddd5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ include(CheckIncludeFiles) include(ConfigureScripts) # some utils for cmake -include(deps/drassil/cmake-utils/utils.cmake) +include(deps/acore/cmake-utils/utils.cmake) include(src/cmake/ac_macros.cmake) diff --git a/apps/bash_shared/common.sh b/apps/bash_shared/common.sh index ed0859319c..c8d8880cf8 100644 --- a/apps/bash_shared/common.sh +++ b/apps/bash_shared/common.sh @@ -1,12 +1,15 @@ -function registerHooks() { hwc_event_register_hooks "$@"; } -function runHooks() { hwc_event_run_hooks "$@"; } +function registerHooks() { acore_event_registerHooks "$@"; } +function runHooks() { acore_event_runHooks "$@"; } source "$AC_PATH_CONF/dist/config.sh" # include dist to avoid missing conf variables -if [ -f "$AC_PATH_CONF/config.sh" ]; then - source "$AC_PATH_CONF/config.sh" # should overwrite previous +# first check if it's defined in env, otherwise use the default +USER_CONF_PATH=${USER_CONF_PATH:-"$AC_PATH_CONF/config.sh"} + +if [ -f "$USER_CONF_PATH" ]; then + source "$USER_CONF_PATH" # should overwrite previous else - echo "NOTICE: file <$AC_PATH_CONF/config.sh> has not been found, you should create and configure it." + echo "NOTICE: file <$USER_CONF_PATH> has not been found, you should create and configure it." fi # @@ -15,7 +18,7 @@ fi for entry in "$AC_PATH_MODULES/"*/include.sh do - if [ -e "$entry" ]; then + if [ -e "$entry" ]; then source "$entry" fi done diff --git a/apps/bash_shared/deno.sh b/apps/bash_shared/deno.sh new file mode 100644 index 0000000000..f539b60a2a --- /dev/null +++ b/apps/bash_shared/deno.sh @@ -0,0 +1,22 @@ +DENO_MIN_VERSION="1.7.4" + +function denoInstall() { + + { # try + echo "Deno version check:" && denoCmd upgrade --version $DENO_MIN_VERSION + } || + { # catch + echo "Installing Deno..." + # just one line of command that works on all OSes + # (temporary cd into AC_PATH_DEPS) + curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL="$AC_PATH_DEPS/deno" sh + } +} + +function denoCmd() { + (cd "$AC_PATH_ROOT" ; ./deps/deno/bin/deno "$@") +} + +function denoRunFile() { + denoCmd run --allow-all --unstable "$@" +} diff --git a/apps/bash_shared/includes.sh b/apps/bash_shared/includes.sh index 1817683ad9..22a4d91b7e 100644 --- a/apps/bash_shared/includes.sh +++ b/apps/bash_shared/includes.sh @@ -1,7 +1,7 @@ [[ ${GUARDYVAR:-} -eq 1 ]] && return || readonly GUARDYVAR=1 # include it once # force default language for applications -LC_ALL=C +LC_ALL=C AC_PATH_APPS="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )" @@ -9,9 +9,13 @@ AC_PATH_SHARED="$AC_PATH_APPS/bash_shared" source "$AC_PATH_SHARED/defines.sh" -source "$AC_PATH_DEPS/hw-core/bash-lib-event/src/hooks.sh" +source "$AC_PATH_DEPS/acore/bash-lib/src/event/hooks.sh" source "$AC_PATH_SHARED/common.sh" +source "$AC_PATH_SHARED/deno.sh" + +denoInstall + [[ "$OSTYPE" = "msys" ]] && AC_BINPATH_FULL="$BINPATH" || AC_BINPATH_FULL="$BINPATH/bin" diff --git a/apps/db_assembler/includes/functions.sh b/apps/db_assembler/includes/functions.sh index 8e7ff5a5e1..86973e1042 100644 --- a/apps/db_assembler/includes/functions.sh +++ b/apps/db_assembler/includes/functions.sh @@ -2,6 +2,21 @@ 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, 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 @@ -11,7 +26,7 @@ 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 @@ -21,6 +36,7 @@ function dbasm_mysqlExec() { MYSQL_PASS=$PROMPT_PASS fi + dbasm_waitMysqlConn $MYSQL_HOST $MYSQL_PORT export MYSQL_PWD=$MYSQL_PASS @@ -57,7 +73,7 @@ function dbasm_mysqlExec() { 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;" + "$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 @@ -109,9 +125,13 @@ function dbasm_createDB() { echo "$dbname database exists" else echo "Creating DB ${dbname} ..." - dbasm_mysqlExec "$confs" "CREATE DATABASE \`${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}';" - dbasm_mysqlExec "$confs" "GRANT ALL PRIVILEGES ON \`${dbname}\`.* TO '${CONF_USER}'@'${MYSQL_HOST}' WITH GRANT OPTION;" + 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 } @@ -247,7 +267,7 @@ function dbasm_db_backup() { 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; @@ -299,7 +319,7 @@ function dbasm_db_import() { 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; @@ -309,6 +329,8 @@ function dbasm_db_import() { MYSQL_PASS=$PROMPT_PASS fi + dbasm_waitMysqlConn $MYSQL_HOST $MYSQL_PORT + export MYSQL_PWD=$MYSQL_PASS diff --git a/apps/db_exporter/db_export.sh b/apps/db_exporter/db_export.sh index c9e6db8f2e..e5ce4a5c67 100644 --- a/apps/db_exporter/db_export.sh +++ b/apps/db_exporter/db_export.sh @@ -2,7 +2,7 @@ ROOTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )" -source $ROOTPATH"/apps/bash_shared/includes.sh" +source "$ROOTPATH/apps/bash_shared/includes.sh" if [ -f "./config.sh" ]; then source "./config.sh" # should overwrite previous @@ -24,7 +24,7 @@ function export() { var_base_path="DB_"$database"_PATHS" base_path=${!var_base_path%/} - + base_conf="TPATH="$base_path";\ CLEANFOLDER=1; \ CHMODE=0; \ @@ -33,15 +33,15 @@ function export() { FULL=0; \ DUMPOPTS='--skip-comments --skip-set-charset --routines --extended-insert --order-by-primary --single-transaction --quick'; \ " - + var_base_conf="DB_"$database"_CONF" base_conf=$base_conf${!var_base_conf} - + var_base_name="DB_"$database"_NAME" base_name=${!var_base_name} - bash $AC_PATH_DEPS"/drassil/mysql-tools/mysql-tools" dump "" $base_name "" "$base_conf" + bash "$AC_PATH_DEPS/acore/mysql-tools/mysql-tools" "dump" "" "$base_name" "" "$base_conf" } for db in ${DATABASES[@]} diff --git a/apps/docker/Dockerfile b/apps/docker/Dockerfile new file mode 100644 index 0000000000..6c95ffa211 --- /dev/null +++ b/apps/docker/Dockerfile @@ -0,0 +1,128 @@ +#================================================================ +# +# DEV: Stage used for the development environment +# and the locally built services +# +#================================================================= + +FROM ubuntu:20.04 as dev +ARG USER_ID=1000 +ARG GROUP_ID=1000 + +LABEL description="AC Worldserver Debug Container for use with Visual Studio" + +# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + +ENV DOCKER=1 + +# set timezone environment variable +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 + +# 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 mkdir -p /azerothcore + +# Correct permissions for non-root operations +RUN chown -R acore:acore \ + /run \ + /home/acore \ + /opt/ \ + /azerothcore + +USER acore + +WORKDIR /azerothcore + +#================================================================ +# +# BUILD STAGE: to prepare binaries for the production services +# +#================================================================= +FROM dev as build + +RUN bash acore.sh compiler build + +#================================================================ +# +# SERVICE BASE: prepare the OS for the production-ready services +# +#================================================================= + +FROM ubuntu:20.04 as servicebase + +# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones + +# set timezone environment variable +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 + +# 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; + +# change timezone in container +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata + +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 SERVICE: create a ready-to-use authserver image +# +#================================================================= + +FROM servicebase as authserver + +CMD ./acore.sh run-authserver + +#================================================================ +# +# WORLD SERVICE: create a ready-to-use worldserver image +# +#================================================================= + +FROM servicebase as worldserver + +ENV DATAPATH=/azerothcore/env/dist/data + +RUN /azerothcore/acore.sh client-data + +CMD ./acore.sh run-worldserver + + + diff --git a/apps/docker/README.md b/apps/docker/README.md new file mode 100644 index 0000000000..80cd4fa100 --- /dev/null +++ b/apps/docker/README.md @@ -0,0 +1,27 @@ +# Run AzerothCore with Docker + +*This readme it's a summary of the AzerothCore docker features.* + +Docker. is a software that performs operating-system-level virtualization, allowing to wrap and launch applications inside containers. + +Thanks to Docker, you can quickly setup and run AzerothCore in any operating system. + +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 + +Check the [Install with Docker](https://www.azerothcore.org/wiki/Install-with-Docker) guide. + +### Memory usage + +The total amount of RAM when running all AzerothCore docker containers is **less than 2 GB**. + + + + +### Docker containers vs Virtual machines + +Using Docker will have the same benefits as using virtual machines, but with much less overhead: + + + diff --git a/apps/docker/config-docker.sh b/apps/docker/config-docker.sh new file mode 100644 index 0000000000..8c3ac42067 --- /dev/null +++ b/apps/docker/config-docker.sh @@ -0,0 +1,6 @@ +CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# allow the user to override configs +if [ -f "$AC_PATH_CONF/config.sh" ]; then + source "$AC_PATH_CONF/config.sh" # should overwrite previous +fi diff --git a/apps/docker/docker-cmd.ts b/apps/docker/docker-cmd.ts new file mode 100644 index 0000000000..f666ca0944 --- /dev/null +++ b/apps/docker/docker-cmd.ts @@ -0,0 +1,174 @@ +import { Command } from "https://cdn.depjs.com/cmd/mod.ts"; +import * as ink from "https://deno.land/x/ink/mod.ts"; +import { + Input, + Select, +} from "https://deno.land/x/cliffy@v0.18.2/prompt/mod.ts"; + +const program = new Command(); + +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", +); + +shellCommandFactory( + "start:app:d", + "Startup the authserver and worldserver apps in detached mode", + "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:clean", + "Clean build data", + `docker-compose run --rm ac-dev-server bash rm -rf var/build`, +); + +shellCommandFactory( + "client-data", + "Download client data inside the ac-data volume", + "docker-compose run --rm ac-dev-server 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", +); + +shellCommandFactory( + "dashboard [args...]", + "Execute acore dashboard within a running ac-dev-server", + "docker-compose exec ac-dev-server bash acore.sh", +); + +program.command("attach [service]") + .description("attach to a service") + .action(async (service: string | undefined) => { + const { run } = Deno; + + let command = `docker-compose ps`; + + if (service) { + command = `${command} ${service}`; + } + + console.log(ink.colorize(`<green>>>>>> Running: ${command}</green>`)); + + let cmd = command.split(" "); + const res = Deno.run({ + cmd, + cwd: process.cwd(), + stdout: "piped", + stderr: "piped", + }); + + const output = await res.output(); // "piped" must be set + + let services = new TextDecoder().decode(output).split("\n"); + + services.pop(); + services = services.slice(2); + + res.close(); // Don't forget to close it + + let selService: string; + if (services.length > 1) { + selService = await Select.prompt({ + message: `Select a service`, + options: services, + }); + } else { + selService = services[0]; + } + + command = `docker attach ${selService.split(" ")[0]}`; + + console.log(ink.colorize(`<green>>>>>> Running: ${command}</green>`)); + + console.log( + ink.colorize( + "<yellow>NOTE: you can detach from a container and leave it running using the CTRL-p CTRL-q key sequence.</yellow>", + ), + ); + + cmd = command.split(" "); + + const shellCmd = run({ + cmd, + cwd: process.cwd(), + }); + + await shellCmd.status(); + + shellCmd.close(); + }); + +program.command("quit").description("Close docker command").action(()=> { + process.exit(0) +}) + +// Handle it however you like +// e.g. display usage +while (true) { + if (Deno.args.length === 0) { + program.outputHelp(); + const command = await Input.prompt({ + message: "Enter the command:", + }); + await program.parseAsync(command.split(" ")); + } else { + await program.parseAsync(Deno.args); + process.exit(0) + } +} + + + +function shellCommandFactory( + name: string, + description: string, + command: string, +): Command { + return program.command(name) + .description( + `${description}. Command: \n"${ink.colorize(`<green>${command}</green>`)}"\n`, + ) + .action(async (args: any[] | undefined) => { + const { run } = Deno; + + console.log(ink.colorize(`<green>>>>>> Running: ${command}</green>`)); + + const cmd = command.split(" "); + + if (Array.isArray(args)) { + cmd.push(...args); + } + + const shellCmd = run({ + cmd, + cwd: process.cwd(), + }); + + await shellCmd.status(); + + shellCmd.close(); + }); +} diff --git a/apps/installer/includes/functions.sh b/apps/installer/includes/functions.sh index ff00f91e2c..1204362e7a 100644 --- a/apps/installer/includes/functions.sh +++ b/apps/installer/includes/functions.sh @@ -2,7 +2,7 @@ function inst_configureOS() { echo "Platform: $OSTYPE" case "$OSTYPE" in solaris*) echo "Solaris is not supported yet" ;; - darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;; + darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;; linux*) # If $OSDISTRO is set, use this value (from config.sh) if [ ! -z "$OSDISTRO" ]; then @@ -68,7 +68,6 @@ function inst_cleanCompile() { function inst_allInOne() { inst_configureOS - inst_updateRepo inst_compile dbasm_import true true true } @@ -153,7 +152,7 @@ function inst_module_install { if [[ "$b" != "none" ]]; then Joiner:add_repo "https://github.com/azerothcore/$res" "$res" "$b" && echo "Done, please re-run compiling and db assembly. Read instruction on module repository for more information" else - echo "Cannot install $res module: it doesn't exists or no version compatible with AC v$ACORE_VERSION are available" + echo "Cannot install $res module: it doesn't exists or no version compatible with AC v$ACORE_VERSION are available" fi echo ""; @@ -219,9 +218,31 @@ function inst_simple_restarter { } function inst_download_client_data { - local path="$AC_BINPATH_FULL" + # change the following version when needed + local VERSION=v10 + + echo "#######################" + echo "Client data downloader" + echo "#######################" + + # first check if it's defined in env, otherwise use the default + local path="${DATAPATH:-$AC_BINPATH_FULL}" + + dataVersionFile="$path/data-version" + + [ -f "$dataVersionFile" ] && source "$dataVersionFile" + + # create the path if doesn't exists + mkdir -p "$path" + + if [ "$VERSION" == "$INSTALLED_VERSION" ]; then + echo "Data $VERSION already installed. If you want to force the download remove the following file: $dataVersionFile" + return + fi echo "Downloading client data in: $path/data.zip ..." - curl -L https://github.com/wowgaming/client-data/releases/download/v10/data.zip > "$path/data.zip" \ - && unzip -o "$path/data.zip" -d "$path/" && rm "$path/data.zip" + curl -L https://github.com/wowgaming/client-data/releases/download/$VERSION/data.zip > "$path/data.zip" \ + && echo "unzip downloaded file..." && unzip -q -o "$path/data.zip" -d "$path/" \ + && echo "Remove downloaded file" && rm "$path/data.zip" \ + && echo "INSTALLED_VERSION=$VERSION" > "$dataVersionFile" } diff --git a/apps/installer/includes/includes.sh b/apps/installer/includes/includes.sh index 5afd4a159b..5b99c45cc5 100644 --- a/apps/installer/includes/includes.sh +++ b/apps/installer/includes/includes.sh @@ -6,24 +6,9 @@ source "$CURRENT_PATH/../../bash_shared/includes.sh" AC_PATH_INSTALLER="$AC_PATH_APPS/installer" - -J_VER_REQ="v0.8.3" -J_PATH="$AC_PATH_APPS/joiner" +J_PATH="$AC_PATH_DEPS/acore/joiner" J_PATH_MODULES="$AC_PATH_MODULES" -#install/update and include joiner -if [ ! -d "$J_PATH/.git" ]; then - git clone https://github.com/azerothcore/joiner "$J_PATH" -b master - git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" reset --hard "$J_VER_REQ" -else - # legacy code, with new rev of joiner the update process is internally handled - _cur_branch=$(git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse --abbrev-ref HEAD) - _cur_ver=$(git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" name-rev --tags --name-only $_cur_branch) - if [ "$_cur_ver" != "$J_VER_REQ" ]; then - git --git-dir="$J_PATH/.git" --work-tree="$J_PATH/" rev-parse && git --git-dir="$J_PATH/.git" --work-tree="$J_PATH/" fetch --tags origin master --quiet - git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" reset --hard "$J_VER_REQ" - fi -fi source "$J_PATH/joiner.sh" if [ -f "$AC_PATH_INSTALLER/config.sh" ]; then diff --git a/apps/installer/includes/os_configs/ubuntu.sh b/apps/installer/includes/os_configs/ubuntu.sh index 6edaad51d6..63ef36d513 100644 --- a/apps/installer/includes/os_configs/ubuntu.sh +++ b/apps/installer/includes/os_configs/ubuntu.sh @@ -7,13 +7,16 @@ UBUNTU_VERSION=$(lsb_release -sr); sudo apt-get update -y -if [[ $CONTINUOUS_INTEGRATION ]]; then - sudo apt-get -y install build-essential libtool make cmake cmake-data clang openssl libgoogle-perftools-dev \ - libssl-dev libmysqlclient-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev libace-dev mysql-client \ - libncurses5-dev ccache +# shared deps +sudo apt-get -y install make cmake clang curl unzip libmysqlclient-dev libace-dev + +if [[ $CONTINUOUS_INTEGRATION || $DOCKER ]]; then + sudo apt-get -y install build-essential libtool cmake-data openssl libgoogle-perftools-dev \ + libssl-dev libmysql++-dev libreadline6-dev zlib1g-dev libbz2-dev mysql-client \ + libncurses5-dev ccache curl unzip else - sudo apt-get install -y git cmake make gcc g++ clang libmysqlclient-dev \ + sudo apt-get install -y git gcc g++ \ libssl-dev libbz2-dev libreadline-dev libncurses-dev \ - mysql-server libace-6.* libace-dev curl unzip + mysql-server libace-6.* fi - + diff --git a/apps/installer/main.sh b/apps/installer/main.sh index 71df484244..b985b225b4 100644 --- a/apps/installer/main.sh +++ b/apps/installer/main.sh @@ -19,7 +19,8 @@ options=( "client-data: (gd): download client data from github repository (beta)" # 11 "run-worldserver (rw): execute a simple restarter for worldserver" # 12 "run-authserver (ra): execute a simple restarter for authserver" # 13 - "quit: Exit from this menu" # 14 + "docker (dr): Run docker tools" # 14 + "quit: Exit from this menu" # 15 ) function _switch() { @@ -66,7 +67,11 @@ function _switch() { ""|"ra"|"run-authserver"|"13") inst_simple_restarter authserver ;; - ""|"quit"|"14") + ""|"dr"|"docker"|"14") + DOCKER=1 denoRunFile "$AC_PATH_APPS/docker/docker-cmd.ts" "${@:2}" + exit + ;; + ""|"quit"|"15") echo "Goodbye!" exit ;; diff --git a/apps/startup-scripts/conf.sh.dist b/apps/startup-scripts/conf.sh.dist index 774a7c01ce..3a2c395782 100644 --- a/apps/startup-scripts/conf.sh.dist +++ b/apps/startup-scripts/conf.sh.dist @@ -2,7 +2,7 @@ export GDB_ENABLED=0 # [optional] gdb file -# default: gdb.txt +# default: gdb.conf export GDB="" # directory where binary are stored diff --git a/apps/startup-scripts/examples/restarter-auth.sh b/apps/startup-scripts/examples/restarter-auth.sh index 575981cf2a..61ea8b9cfa 100644 --- a/apps/startup-scripts/examples/restarter-auth.sh +++ b/apps/startup-scripts/examples/restarter-auth.sh @@ -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 diff --git a/apps/startup-scripts/examples/restarter-world.sh b/apps/startup-scripts/examples/restarter-world.sh index 5307eb4a76..9b34e114e0 100644 --- a/apps/startup-scripts/examples/restarter-world.sh +++ b/apps/startup-scripts/examples/restarter-world.sh @@ -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 diff --git a/apps/startup-scripts/examples/starter-auth.sh b/apps/startup-scripts/examples/starter-auth.sh index 0aedb9bca7..734cfb5a22 100644 --- a/apps/startup-scripts/examples/starter-auth.sh +++ b/apps/startup-scripts/examples/starter-auth.sh @@ -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 - diff --git a/apps/startup-scripts/examples/starter-world.sh b/apps/startup-scripts/examples/starter-world.sh index 4b866dee1d..697a2c85ac 100644 --- a/apps/startup-scripts/examples/starter-world.sh +++ b/apps/startup-scripts/examples/starter-world.sh @@ -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 diff --git a/apps/startup-scripts/gdb.conf b/apps/startup-scripts/gdb.conf new file mode 100644 index 0000000000..bcedc28ffc --- /dev/null +++ b/apps/startup-scripts/gdb.conf @@ -0,0 +1,4 @@ +set logging on +set debug timestamp +run +bt diff --git a/apps/startup-scripts/simple-restarter b/apps/startup-scripts/simple-restarter index dc04ce0743..6415c0a449 100755 --- a/apps/startup-scripts/simple-restarter +++ b/apps/startup-scripts/simple-restarter @@ -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 diff --git a/bin/acore-db-asm b/bin/acore-db-asm deleted file mode 100755 index 962a70b233..0000000000 --- a/bin/acore-db-asm +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -source "$CUR_PATH/../apps/db_assembler/db_assembler.sh" diff --git a/bin/acore-docker-build b/bin/acore-docker-build index 5ec93feafb..1e3d050d76 100755 --- a/bin/acore-docker-build +++ b/bin/acore-docker-build @@ -1,9 +1,15 @@ #!/usr/bin/env bash -docker build -t acbuild -f docker/build/Dockerfile . +bash acore.sh compiler build && bash acore.sh db-assembler import-all + +CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +ENV_PATH=$(readlink -f "$CUR_PATH/../env") + +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" + +echo "Fixing EOL..." +dos2unix "$ENV_PATH/dist/etc/"* -docker run \ - -v /"$(pwd)"/docker/build/cache:/azerothcore/build \ - -v /"$(pwd)"/docker/worldserver/bin:/binworldserver \ - -v /"$(pwd)"/docker/authserver/bin:/binauthserver \ - acbuild diff --git a/bin/acore-docker-build-no-scripts b/bin/acore-docker-build-no-scripts deleted file mode 100755 index a0c80a5e33..0000000000 --- a/bin/acore-docker-build-no-scripts +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -docker build --build-arg ENABLE_SCRIPTS=0 -t acbuild -f docker/build/Dockerfile . - -docker run \ - -v /"$(pwd)"/docker/build/cache:/azerothcore/build \ - -v /"$(pwd)"/docker/worldserver/bin:/binworldserver \ - -v /"$(pwd)"/docker/authserver/bin:/binauthserver \ - acbuild diff --git a/bin/acore-docker-generate-etc b/bin/acore-docker-generate-etc deleted file mode 100755 index c6062088a0..0000000000 --- a/bin/acore-docker-generate-etc +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -cp src/server/worldserver/worldserver.conf.dist docker/worldserver/etc/worldserver.conf.dist -cp src/server/authserver/authserver.conf.dist docker/authserver/etc/authserver.conf.dist - -cp docker/worldserver/etc/worldserver.conf.dockerdist docker/worldserver/etc/worldserver.conf -cp docker/authserver/etc/authserver.conf.dockerdist docker/authserver/etc/authserver.conf - -if [ $OSTYPE = msys ]; then - dos2unix docker/worldserver/etc/* docker/authserver/etc/* -fi diff --git a/bin/acore-docker-remove-build-cache b/bin/acore-docker-remove-build-cache deleted file mode 100755 index d455f2a976..0000000000 --- a/bin/acore-docker-remove-build-cache +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -if [ "$(id -u)" != "0" ] && [ "$OSTYPE" != "msys" ] ; then - echo "Please run the script with sudo" -else - rm -rf ./docker/build/cache/CMakeFiles - rm -rf ./docker/build/cache/deps - rm -rf ./docker/build/cache/src - rm ./docker/build/cache/*.cmake - rm ./docker/build/cache/*.txt - rm ./docker/build/cache/*.h - rm ./docker/build/cache/*.cpp - rm ./docker/build/cache/Makefile -fi diff --git a/bin/acore-subrepo-update b/bin/acore-subrepo-update new file mode 100755 index 0000000000..bc05e4a042 --- /dev/null +++ b/bin/acore-subrepo-update @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +####################### +# +# README +# +# This script is used to automatically update +# submodules and subrepos included in this project +# Subrepo are updated in bidirectional way (pull + push) +# because they are intended to be developed by this organization +# +# NOTE: only maintainers and CI should run this script and +# keep it updated +# +####################### + +set -e +ROOT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../" +# update all submodules +git submodule update --init --recursive +git submodule foreach git pull origin master +# include libraries for git subrepo +source "$ROOT_PATH/deps/git-subrepo/.rc" +source "$ROOT_PATH/deps/acore/bash-lib/src/git-utils/subrepo.sh" + +echo "> Pulling and update all subrepos" + +subrepoUpdate https://github.com/azerothcore/bash-lib master deps/acore/bash-lib + +subrepoUpdate https://github.com/azerothcore/cmake-utils master deps/acore/cmake-utils + +subrepoUpdate https://github.com/azerothcore/mysql-tools master deps/acore/mysql-tools + +subrepoUpdate https://github.com/azerothcore/joiner master deps/acore/joiner diff --git a/conf/dist/config.sh b/conf/dist/config.sh index 8feef71197..c9ef22abc7 100644 --- a/conf/dist/config.sh +++ b/conf/dist/config.sh @@ -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 # -DATABASES=( - "AUTH" - "CHARACTERS" - "WORLD" -) +# 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/"} -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" diff --git a/conf/dist/docker-compose.override.yml b/conf/dist/docker-compose.override.yml new file mode 100644 index 0000000000..1e71bd8c64 --- /dev/null +++ b/conf/dist/docker-compose.override.yml @@ -0,0 +1,4 @@ +version: '3.8' +# services: +# ac-worldserver-2: + diff --git a/conf/dist/env.ac b/conf/dist/env.ac new file mode 100644 index 0000000000..0639e2349f --- /dev/null +++ b/conf/dist/env.ac @@ -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= diff --git a/conf/dist/env.docker b/conf/dist/env.docker new file mode 100644 index 0000000000..28e91af917 --- /dev/null +++ b/conf/dist/env.docker @@ -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 diff --git a/deps/acore/bash-lib/.gitrepo b/deps/acore/bash-lib/.gitrepo new file mode 100644 index 0000000000..d62898c2b5 --- /dev/null +++ b/deps/acore/bash-lib/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/bash-lib + branch = master + commit = 86fcff1dd6167078f863d45b3cd233e802bebe89 + parent = 0ebf9eb7365e4c73f423e2acd9fb1f21b84c6ef6 + method = merge + cmdver = 0.4.3 diff --git a/deps/hw-core/bash-lib-git/bin/git-subtree-list b/deps/acore/bash-lib/bin/git-subtree-list index d3af413e9c..7111d4d646 100644 --- a/deps/hw-core/bash-lib-git/bin/git-subtree-list +++ b/deps/acore/bash-lib/bin/git-subtree-list @@ -4,4 +4,4 @@ CUR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $CUR_DIR"/../src/subtree.sh" -hwc_git_subtree_list +subtreeFlow diff --git a/deps/acore/bash-lib/docs/README.md b/deps/acore/bash-lib/docs/README.md new file mode 100644 index 0000000000..b35c31e86f --- /dev/null +++ b/deps/acore/bash-lib/docs/README.md @@ -0,0 +1,23 @@ +# BASH-LIB + +## description + +bash-lib is a collection of generic purpose functions and defines that can be used +and shared by other bash scripts. + +## Documentation + +### src/event + +Libraries for event-driven functions + +#### hooks.sh + +Library that implements a simple Observer Pattern + +### src/git-utils + +#### subrepo.sh + + +#### subtree.sh diff --git a/deps/acore/bash-lib/docs/_config.yml b/deps/acore/bash-lib/docs/_config.yml new file mode 100644 index 0000000000..17bd07cb1d --- /dev/null +++ b/deps/acore/bash-lib/docs/_config.yml @@ -0,0 +1,152 @@ +# based on git-wiki-theme 2.6.1 +remote_theme: Drassil/git-wiki-theme@master +# (string) Title of your wiki +title: "bash-lib" +baseurl: /bash-lib/ +# (string) if you've installed your wiki in subfolder, you must change this configuration +# with your folder name, otherwise leave it empty +# baseurl: "/git-wiki-skeleton" +# (string) Description of your wiki +description: +# (boolean) Enable/disable wiki page list in sidebar +show_wiki_pages: true +# (integer) Maximum number of wiki page to shown in sidebar +show_wiki_pages_limit: 10 +# (boolean) Enable/disable blog feature +blog_feature: true +# (boolean) Enable/disable wiki posts list in sidebar (needs blog_feature enabled) +show_wiki_posts: true +# (integer) Maximum number of wiki posts to shown in sidebar +show_wiki_posts_limit: 10 +# from jekyll (read jekyll doc) +paginate: 5 +paginate_path: "/blog/page:num" +permalink: /blog/posts/:year/:month/:day/:title:output_ext +# (boolean) Enable/disable download buttons in sidebar +show_downloads: true +# (string) Specify branch rendered by gitpages allowing wiki tool buttons to work +git_branch: "master" +# (string) Url of logo image, it can be full, absolute or relative. +logo_url: https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Gnu-bash-logo.svg/1200px-Gnu-bash-logo.svg.png +# (string) The UA-XXXXX-Y code from google analytic to enable GA on your wiki +google_analytics: +# (string) folder where wiki pages are stored, it's needed for tool buttons +wiki_folder: +# (boolean) if you're using github wiki as submodule then this config +# must be enabled to allow tool buttons to work properly +use_github_wiki: false +# (boolean) Enable "Edit with Prose.io" button in tools, it's a 3rd party +# service to edit github markdown pages easily +use_prose_io: true +# Select search_engine component from: +# - js: it uses a built in javascript component that uses generated js object +# - js_rss: it uses a built in javascript component that uses generated sitemap_full.xml to search inside your wiki with lunr library (slow and experimental) +# - github : it uses internal github repository search +# - google : it uses cse search bar, you need to configure google_cse_token +# +search_engine : "js" +# Setting google custom search engine for google. Default: empty +# cse search bar (https://cse.google.it/cse/) +google_cse_token: + + +# (string) path of site root. Normally it's must be empty because _config.yml resides in the root of your repository. +# If you have _config.yml and your site in a subfolder, then change this config accordly +site_root: docs/ + +# +# Jekyll configurations +# + +# You can customize it changing default layout for all pages +# More info: https://jekyllrb.com/docs/configuration/ +# +# git-wiki includes some internal themes that you can choose +# check _layouts folder +# +markdown: kramdown +highlighter: rouge +kramdown: + input: GFM + syntax_highlighter: rouge + +defaults: + - + scope: + path: "wiki" + values: + permalink: /:basename + - + scope: + path: "" # an empty string here means all files in the project + values: + layout: "git-wiki-default" + - + scope: + path: "" + type: "pages" + values: + layout: "git-wiki-default" + - + scope: + path: "" + type: "posts" + values: + layout: "git-wiki-post" + - + scope: + path: blog + values: + layout: "git-wiki-blog" +sass: + style: compressed +plugins: + - jekyll-avatar + - jekyll-coffeescript + - jekyll-default-layout + - jekyll-feed + - jekyll-gist + - jekyll-paginate + - jekyll-mentions + - jekyll-optional-front-matter + - jekyll-readme-index + - jekyll-redirect-from + - jekyll-remote-theme + - jekyll-relative-links + - jekyll-seo-tag + - jekyll-sitemap + - jekyll-titles-from-headings + - jemoji + - jekyll-gitlab-metadata + +# +# INCLUDING HOOKS +# They are optional, change them only if you need +# Check wiki documentation to learn how they work +# + +inc_before_toc : +inc_after_toc : +inc_before_content : +inc_after_content : +inc_before_footer : +inc_after_footer : +inc_before_head : +inc_after_head : +inc_before_meta : +inc_after_meta : +inc_before_scripts : +inc_after_scripts : +inc_before_styles : +inc_after_styles : +inc_before_header : +inc_after_header : +inc_before_tail : +inc_after_tail : +inc_before_tools : +inc_after_tools : + +inc_before_page_list : +inc_after_page_list : +inc_before_post_list : +inc_after_post_list : diff --git a/deps/hw-core/bash-lib-event/src/hooks.sh b/deps/acore/bash-lib/src/event/hooks.sh index b791a600fb..77cd6456e2 100644 --- a/deps/hw-core/bash-lib-event/src/hooks.sh +++ b/deps/acore/bash-lib/src/event/hooks.sh @@ -1,5 +1,5 @@ # par 1: hook_name -function hwc_event_run_hooks() { +function acore_event_runHooks() { hook_name="HOOKS_MAP_$1" read -r -a SRCS <<< ${!hook_name} echo "Running hooks: $hook_name" @@ -9,7 +9,7 @@ function hwc_event_run_hooks() { done } -function hwc_event_register_hooks() { +function acore_event_registerHooks() { hook_name="HOOKS_MAP_$1" hooks=${@:2} declare -g "$hook_name+=$hooks " diff --git a/deps/acore/bash-lib/src/git-utils/subrepo.sh b/deps/acore/bash-lib/src/git-utils/subrepo.sh new file mode 100644 index 0000000000..e0d36d9a82 --- /dev/null +++ b/deps/acore/bash-lib/src/git-utils/subrepo.sh @@ -0,0 +1,36 @@ + +#!/usr/bin/env bash + + + +CUR_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" + +echo "> Init and updating submodules..." + +function subrepoUpdate() { + repo=$1 + branch=$2 + folder=$3 + + toClone=$(git ls-remote --heads "$repo" "$branch" | wc -l) + + if [[ -d "$folder" ]]; then + if [[ ! -f "$folder/.gitrepo" ]]; then + git subrepo init "$folder" -r "$repo" -b "$branch" + fi + + if [[ $toClone -eq 0 ]]; then + git subrepo push "$folder" + fi + else + # try-catch + set +e + git subrepo clone "$repo" "$folder" -b "$branch" + set -e + fi + + git subrepo clean "$folder" + git subrepo pull "$folder" + git subrepo push "$folder" -s + git subrepo clean "$folder" +} diff --git a/deps/acore/bash-lib/src/git-utils/subtree.sh b/deps/acore/bash-lib/src/git-utils/subtree.sh new file mode 100644 index 0000000000..1b32c97286 --- /dev/null +++ b/deps/acore/bash-lib/src/git-utils/subtree.sh @@ -0,0 +1,12 @@ +function subtreeFlow { + local name=$1 + local path=$2 + local repo=$3 + local branch=$4 + local prefix="$path/$name" + + echo "> Adding subtree if not exists" + git subtree add --prefix "$prefix" "$repo" "$branch" + echo "> Pulling latest changes from remote subtree" + git subtree pull --prefix "$prefix" "$repo" "$branch" +} diff --git a/deps/drassil/cmake-utils/.gitignore b/deps/acore/cmake-utils/.gitignore index 92da74b036..92da74b036 100644 --- a/deps/drassil/cmake-utils/.gitignore +++ b/deps/acore/cmake-utils/.gitignore diff --git a/deps/acore/cmake-utils/.gitrepo b/deps/acore/cmake-utils/.gitrepo new file mode 100644 index 0000000000..67403e7fa5 --- /dev/null +++ b/deps/acore/cmake-utils/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/cmake-utils + branch = master + commit = 1589c53ac61b7909c6950f1d85833441cbd58790 + method = merge + cmdver = 0.4.3 + parent = ebcbd4e904f835beef8db05c88f2e971c48c2820 diff --git a/docker/authserver/bin/.gitkeep b/deps/acore/cmake-utils/README.md index e69de29bb2..e69de29bb2 100644 --- a/docker/authserver/bin/.gitkeep +++ b/deps/acore/cmake-utils/README.md diff --git a/deps/drassil/cmake-utils/utils.cmake b/deps/acore/cmake-utils/utils.cmake index e395530cf0..e395530cf0 100644 --- a/deps/drassil/cmake-utils/utils.cmake +++ b/deps/acore/cmake-utils/utils.cmake diff --git a/deps/acore/joiner/.gitrepo b/deps/acore/joiner/.gitrepo new file mode 100644 index 0000000000..4fd20b2c13 --- /dev/null +++ b/deps/acore/joiner/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/joiner + branch = master + commit = 9b74caa2ca609738a944bcf25c025a2a67de78ed + parent = 5f910409ec1e5f27f49fe26b0662b19b37bdabb3 + method = merge + cmdver = 0.4.3 diff --git a/deps/acore/joiner/LICENSE b/deps/acore/joiner/LICENSE new file mode 100644 index 0000000000..1ce875873d --- /dev/null +++ b/deps/acore/joiner/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +<http://www.gnu.org/licenses/>.
\ No newline at end of file diff --git a/deps/acore/joiner/README.md b/deps/acore/joiner/README.md new file mode 100644 index 0000000000..0fc3d26b4e --- /dev/null +++ b/deps/acore/joiner/README.md @@ -0,0 +1,211 @@ +# Joiner v0.8.4 + +Universal crossplatform and agnostic dependency manager written in bash for any kind of module. + +it is compatible with: + +- Linux (natively) +- MacOS (natively) +- Windows (via mingw, wsl or other installable bash console) + +This script is able to install and update modules and its dependencies via git clone, submodule or files directly. +To install dependencies you must configure your repository to support Joiner. Read instructions below. + +## Projects that are using Joiner + +- https://github.com/azerothcore/azerothcore-wotlk + +- https://github.com/hw-core + +## features + +- install modules via git clone/submodule or files/zipped folders +- update modules downloaded via git +- remove modules and its dependencies +- define and install dependencies or suggested modules +- since it uses bash, you can run any kind of task/script during install/uninstall (compilation, configuration etc.) + +## requirements + +- bash +- git +- unzip +- curl + +## Installation + +This command will download the script then you can directly run it or include in your script to run commands programmatically + +``` +git clone https://github.com/drassil/joiner.git drassil/joiner +``` + +if you want to include in your scripts you can use this code that will also automatically download the joiner if you don't have it yet and will keep it updated at each run (internally handled by joiner script): + +``` +J_PATH_MODULES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/modules" +[ ! -d $J_PATH_MODULES/drassil/joiner ] && git clone https://github.com/drassil/joiner $J_PATH_MODULES/drassil/joiner -b master +source "$J_PATH_MODULES/drassil/joiner/joiner.sh" +``` + +## Usage + +You can run joiner executing it in a bash shell. It will prompt an interactive menu where you can run commands or just run them directly via command line (see below) + +Alternatively you can use it programmatically running internal functions in your scripts (see below). It's also needed to create a module compatible with Joiner dependency manager. + +## Sample + +This command will install js-lib-class modules and its dependencies + + joiner add-repo https://github.com/HW-Core/js-lib-class + +To install also development dependencies (test and documentation modules) you've to run: + + joiner add-repo --dev https://github.com/HW-Core/js-lib-class + +## Options + +-d|--dev: install development dependencies (see Joiner:with_dev) + +-e|--extras: install extras dependencies (see Joiner:with_extras) + +-z|--unzip: if adding a compressed file, this option will unzip it + +## Command line + +- **add-repo (a)**: download and install a module from git repository. + + Syntax: joiner.sh add-repo [-d] [-e] url name branch [basedir] + + If you set name/branch as empty string ("") the system will use default values + +- **upd-repo (u)**: update a module. + Syntax: joiner.sh upd-repo [-d] [-e] url name branch [basedir] + + If you set name/branch as empty string ("") the system will use default values + +- **add-git-submodule (s)**: download and install module from git repository as git submodule. + + Syntax: joiner.sh add-git-submodule [-d] [-e] url name branch [basedir] + + If you set name/branch as empty string ("") the system will use default values + + +- **add-file (f)**: download and install a file or zipped folder. + + Syntax: joiner.sh add-file [-d] [-e] [-z] source [destination] + +- **remove (r)**: uninstall and remove a module. + + Syntax: joiner.sh remove name [basedir] + +- **self-update (j)**: Update joiner version to the latest stable (master branch) + + Syntax: joiner.sh self-update + + + +## Programmatically usage + +### commands methods +Download and install a module from git repository. + + Joiner:add_repo [-d] [-e] url name branch [basedir] + +Update a module. + + Joiner:upd_repo [-d] [-e] url name branch [basedir] + +Download and install module from git repository as git submodule. + + Joiner:add_git_submodule [-d] [-e] url name branch [basedir] + +Download and install a file or zipped folder. + + Joiner:add_file [-d] [-e] [-z] source [destination] + +Uninstall and remove a module. + + Joiner:remove name [basedir] + +### conditional methods + +Check if Joiner has been run with --dev|-d option + + Joiner:with_dev + + return: true|false + +Check if Joiner has been run with --extras|-e option + + Joiner:with_extras + + return: true|false + +Update joiner version to the latest stable (master branch) + + Joiner:self_update + + +## How to create a Joiner module + +Creating a Joiner compatible module is extremely simple. +You just have to create following files in the root directory of your project: + +### install.sh + +``` +#!/usr/bin/env bash + +J_PATH_MODULES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/modules" +[ ! -d $J_PATH_MODULES/drassil/joiner ] && git clone https://github.com/drassil/joiner $J_PATH_MODULES/drassil/joiner -b master +source "$J_PATH_MODULES/drassil/joiner/joiner.sh" + +## You can do any kind of pre-install task here + +# ADD DEPENDENCIES + +Joiner:add_repo "dependency-repo-url" + +if Joiner:with_dev ; then + Joiner:add_repo "dev-dependency-repo-url" +fi + +## You can do any kind of post-install task here +``` + + +### uninstall.sh + + +``` +#!/usr/bin/env bash + +J_PATH_MODULES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/modules" +[ ! -d $J_PATH_MODULES/drassil/joiner ] && git clone https://github.com/drassil/joiner $J_PATH_MODULES/drassil/joiner -b master +source "$J_PATH_MODULES/drassil/joiner/joiner.sh" + +# +# REMOVE DEPENDENCIES +# + +Joiner:remove "dependency-folder-name" + +``` + +If other dependencies are Joiner modules then joiner will install dependencies recursively, otherwise will just download them. + + +## Contribute + +Please use github platform to report an issue or ask anything you like: + +https://github.com/Drassil/joiner + + + + + + + diff --git a/deps/acore/joiner/_config.yml b/deps/acore/joiner/_config.yml new file mode 100644 index 0000000000..b4fb3bcb93 --- /dev/null +++ b/deps/acore/joiner/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-architect diff --git a/deps/acore/joiner/joiner.sh b/deps/acore/joiner/joiner.sh new file mode 100755 index 0000000000..be95b673a1 --- /dev/null +++ b/deps/acore/joiner/joiner.sh @@ -0,0 +1,441 @@ +#!/usr/bin/env bash + +# +# bash >= 4.x required +# + +# +# DEFINES +# + +# boolean bash convention ( inverse ) +declare -A J_OPT; + +TRUE=0 +FALSE=1 + +J_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +unamestr=`uname` +if [ -z "$J_PATH_MODULES" ]; then + if [[ "$unamestr" == 'Darwin' ]]; then + J_PATH_MODULES=$(greadlink -f "$J_PATH/../../") + else + J_PATH_MODULES=$(readlink -f "$J_PATH/../../") + fi +fi + +for i in "$@" +do +case $i in + --parent=*) #internally used + J_OPT[parent]="${i#*=}" + shift + ;; + --child=*) #internally used + J_OPT[child]="${i#*=}" + shift + ;; + *) + # unknown option + ;; +esac +done + +J_PARAMS="$@" + +function Joiner:is_submodule() +{ + path=$1 + (cd "$path" && cd "$(git rev-parse --show-toplevel 2>&1)/.." + git rev-parse --is-inside-work-tree 2>&1) | grep -q true +} + + +function Joiner:_help() { + hasReq=$1 + firstParam=$2 + msg=$3 + + if [ $hasReq = false ]; then + echo "Argument missing: $msg" + exit 1 + fi + + if [[ "$firstParam" = "--help" || "$firstParam" = "-h" ]]; then + echo "Help: $msg" + exit 1 + fi +} + +function Joiner:_searchFirstValiPath() { + path="$1" + until $(cd -- "$path") + do + case "$path" in(*[!/]/*) + path="${path%/*}" + ;; + (*) + ! break + esac + done 2>/dev/null + echo "$path" +} + +# +# JOINER FUNCTIONS +# + +function Joiner:add_repo() ( + set -e + url="$1" + name=${2:-""} + branch=${3:-"master"} + basedir="${4:-""}" + + [[ -z $url ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh add-repo [-d] [-e] url name branch [basedir]" + + # retrieving info from url if not set + if [[ -z $name ]]; then + basename=$(basename $url) + name=${basename%%.*} + + if [[ -z "$basedir" ]]; then + dir=$(dirname "$url") + basedir=$(basename "$dir") + fi + + name="${name,,}" #to lowercase + basedir="${basedir,,}" #to lowercase + fi + + path="$J_PATH_MODULES/$basedir/$name" + changed="yes" + + if [ -e "$path/.git/" ]; then + # if exists , update + git --git-dir="$path/.git/" rev-parse && git --git-dir="$path/.git/" pull origin $branch | grep 'Already up-to-date.' && changed="no" || true + else + # otherwise clone + git clone $url -c advice.detachedHead=0 -b $branch "$path" + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + # parent/child to avoid redundancy + [[ -f $path/install.sh && "$changed" = "yes" + && "${J_OPT[parent]}" != "$path" && "${J_OPT[child]}" != "$path" ]] && bash "$path/install.sh" --child="${J_OPT[parent]}" --parent="$path" $J_PARAMS + + return $TRUE +) + +function Joiner:add_git_submodule() ( + set -e + url=$1 + name=${2:-""} + branch=${3:-"master"} + basedir=${4:-""} + + [[ -z $url ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh add-git-submodule [-d] [-e] url name branch [basedir]" + + # retrieving info from url if not set + if [[ -z $name ]]; then + basename=$(basename $url) + name=${basename%%.*} + + if [[ -z $basedir ]]; then + dir=$(dirname $url) + basedir=$(basename $dir) + fi + + name="${name,,}" #to lowercase + basedir="${basedir,,}" #to lowercase + fi + + path="$J_PATH_MODULES/$basedir/$name" + valid_path=`Joiner:_searchFirstValiPath "$path"` + rel_path=${path#$valid_path} + rel_path=${rel_path#/} + + if [ -e $path/ ]; then + # if exists , update + (cd "$path" && git pull origin $branch) + (cd "$valid_path" && git submodule update -f --init $rel_path) + else + # otherwise add + (cd "$valid_path" && git submodule add -f -b $branch $url $rel_path) + (cd "$valid_path" && git submodule update -f --init $rel_path) + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + # parent/child to avoid redundancy + [[ -f $path/install.sh && "$changed" = "yes" + && "${J_OPT[parent]}" != "$path" && "${J_OPT[child]}" != "$path" ]] && bash "$path/install.sh" --child="${J_OPT[parent]}" --parent="$path" $J_PARAMS + + return $TRUE +) + +function Joiner:add_file() ( + set -e + declare -A _OPT; + for i in "$@" + do + case $i in + --unzip|-z) + _OPT[unzip]=true + shift + ;; + *) + # unknown option + ;; + esac + done + + source=$1 + destination="$J_PATH_MODULES/$2" + + [[ -z $source ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh add-file [-d] [-e] [-z] source [destination]" + + if [[ "$destination" =~ '/'$ ]]; then + mkdir -p "$destination" + else + mkdir -p "$(dirname $destination)" + fi + + [ ! -e $J_PATH_MODULES/$2 ] && curl -o "$destination" "$source" + + if [ "${_OPT[unzip]}" = true ]; then + dir=$(dirname $destination) + unzip -d $dir $destination + rm $destination + + filename=$(basename -- "$destination") + newpath="$dir${filename%%.*}" + + # parent/child to avoid redundancy + [[ -f $newpath/install.sh && "$changed" = "yes" + && "${J_OPT[parent]}" != "$newpath" && "${J_OPT[child]}" != "$newpath" ]] && bash "$newpath/install.sh" --child="${J_OPT[parent]}" --parent="$newpath" $J_PARAMS + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + return $TRUE +) + +function Joiner:upd_repo() ( + set -e + url=$1 + name=${2:-""} + branch=${3:-"master"} + basedir=${4:-""} + + [[ -z $url ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh upd-repo [-d] [-e] url name branch [basedir]" + + # retrieving info from url if not set + if [[ -z $name ]]; then + basename=$(basename $url) + name=${basename%%.*} + + if [[ -z $basedir ]]; then + dir=$(dirname $url) + basedir=$(basename $dir) + fi + + name="${name,,}" #to lowercase + basedir="${basedir,,}" #to lowercase + fi + + path="$J_PATH_MODULES/$basedir/$name" + + if [[ -z $url ]]; then + url=`git --git-dir="$path/.git" remote get-url origin` + fi + + if [[ `Joiner:is_submodule "$path"` = true ]]; then + Joiner:add_git_submodule $@ + else + Joiner:add_repo $@ + fi + + if [ "$?" -ne "0" ]; then + return $FALSE + fi + + return $TRUE +) + +function Joiner:remove() ( + set -e + name=$1 + basedir=$2 + + [[ -z $name ]] && hasReq=false || hasReq=true + Joiner:_help $hasReq "$1" "Syntax: joiner.sh remove name [basedir]" + + path="$J_PATH_MODULES/$basedir/$name" + + if [ -d "$path" ]; then + rm -r --interactive=never "$path" + [[ -f $path/uninstall.sh ]] && bash "$path/uninstall.sh" $J_PARAMS + elif [ -f "$path" ]; then + rm --interactive=never "$path" + else + return $FALSE + fi + + return $TRUE +) + +function Joiner:with_dev() ( + set -e + if [ "${J_OPT[dev]}" = true ]; then + return $TRUE; + else + return $FALSE; + fi +) + +function Joiner:with_extras() ( + set -e + if [ "${J_OPT[extra]}" = true ]; then + return $TRUE; + else + return $FALSE; + fi +) + +# +# Parsing parameters +# +function Joiner:self_update() { + if [ -e "$J_PATH/.git/" ]; then + # self update + if [ ! -z "$J_VER_REQ" ]; then + # if J_VER_REQ is defined then update only if tag is different + _cur_branch=`git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse --abbrev-ref HEAD` + _cur_ver=`git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" name-rev --tags --name-only $_cur_branch` + if [ "$_cur_ver" != "$J_VER_REQ" ]; then + git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse && git --git-dir="$J_PATH/.git/" fetch --tags origin "$_cur_branch" --quiet + git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" checkout "tags/$J_VER_REQ" -b "$_cur_branch" + fi + else + # else always try to keep at latest available version (worst performances) + + git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" rev-parse && git --git-dir="$J_PATH/.git/" --work-tree="$J_PATH/" fetch origin "$_cur_branch" --quiet + fi + fi +} + +function Joiner:_checkOptions() { + for i in "$@" + do + case $i in + -e=*|--extras=*) + echo "Extras enabled" + J_OPT[extra]="${i#*=}" + shift + ;; + --dev|-d) + echo "Development enabled" + J_OPT[dev]=true + shift + ;; + *) + # unknown option + ;; + esac + done +} + +function Joiner:menu() { + PS3='[Please enter your choice]: ' + options=( + "add-repo (a): download and install a module from git repository." # 1 + "upd-repo (u): update a module." # 2 + "add-git-submodule (s): download and install module from git repository as git submodule." # 3 + "add-file (f): download and install a file or zipped folder." # 4 + "remove (r): uninstall and remove a module." # 5 + "self-update (j): Update joiner version to the latest stable (master branch)" + "quit: Exit from this menu" + ) + + function _switch() { + _reply="$1" + shift + + Joiner:_checkOptions + + _opt="$@" + + case $_reply in + ""|"a"|"add-repo"|"1") + Joiner:add_repo $_opt + ;; + ""|"u"|"upd-repo"|"2") + Joiner:upd_repo $_opt + ;; + ""|"s"|"add-git-submodule"|"3") + Joiner:add_git_submodule $_opt + ;; + ""|"f"|"add-file"|"4") + Joiner:add_file $_opt + ;; + ""|"r"|"remove"|"5") + Joiner:remove $_opt + ;; + ""|"j"|"self-update"|"6") + Joiner:self_update + ;; + ""|"quit"|"7") + echo "Goodbye!" + exit + ;; + ""|"--help") + echo "Available commands:" + printf '%s\n' "${options[@]}" + echo "Arguments:" + echo "-d, --dev: install also dev dependencies" + echo "-e, --extras: install extra dependencies (suggested by module)" + echo "-z, --unzip: extract a zipped file downloaded by add-file command" + ;; + *) 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 + + echo "" + echo "==== JOINER MENU ====" + select opt in "${options[@]}" + do + echo "" + _switch $REPLY + break + done + done +} + +# Call menu only when run from command line. +# if you wish to run joiner menu when sourced +# you must call the relative function +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + Joiner:menu $@ +else + Joiner:_checkOptions $@ +fi + diff --git a/deps/drassil/mysql-tools/.gitignore b/deps/acore/mysql-tools/.gitignore index fa1ea4671a..c6659cf0c1 100644 --- a/deps/drassil/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/.gitrepo b/deps/acore/mysql-tools/.gitrepo new file mode 100644 index 0000000000..f4d05ff4cc --- /dev/null +++ b/deps/acore/mysql-tools/.gitrepo @@ -0,0 +1,12 @@ +; DO NOT EDIT (unless you know what you are doing) +; +; This subdirectory is a git "subrepo", and this file is maintained by the +; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; +[subrepo] + remote = https://github.com/azerothcore/mysql-tools + branch = master + commit = 6e9f39989cf4769c8972fb575aecf2b0291f3e6e + parent = 2668a0e170fbfd776380bf2d5edc4d0c39e0630d + method = merge + cmdver = 0.4.3 diff --git a/deps/drassil/mysql-tools/README b/deps/acore/mysql-tools/README index 453829ce72..453829ce72 100644 --- a/deps/drassil/mysql-tools/README +++ b/deps/acore/mysql-tools/README diff --git a/deps/drassil/mysql-tools/bin/dump-parser b/deps/acore/mysql-tools/bin/dump-parser Binary files differindex 6d07b528f1..6d07b528f1 100755 --- a/deps/drassil/mysql-tools/bin/dump-parser +++ b/deps/acore/mysql-tools/bin/dump-parser diff --git a/deps/drassil/mysql-tools/bin/dump-parser-mac b/deps/acore/mysql-tools/bin/dump-parser-mac Binary files differindex a8f4a7bb53..a8f4a7bb53 100755 --- a/deps/drassil/mysql-tools/bin/dump-parser-mac +++ b/deps/acore/mysql-tools/bin/dump-parser-mac diff --git a/deps/drassil/mysql-tools/bin/mysql.exe b/deps/acore/mysql-tools/bin/mysql.exe Binary files differindex 66267a989a..66267a989a 100644 --- a/deps/drassil/mysql-tools/bin/mysql.exe +++ b/deps/acore/mysql-tools/bin/mysql.exe diff --git a/deps/drassil/mysql-tools/bin/mysqldump.exe b/deps/acore/mysql-tools/bin/mysqldump.exe Binary files differindex 24355c07c3..24355c07c3 100644 --- a/deps/drassil/mysql-tools/bin/mysqldump.exe +++ b/deps/acore/mysql-tools/bin/mysqldump.exe diff --git a/deps/drassil/mysql-tools/bin/mysqlimport.exe b/deps/acore/mysql-tools/bin/mysqlimport.exe Binary files differindex 8dc3613870..8dc3613870 100644 --- a/deps/drassil/mysql-tools/bin/mysqlimport.exe +++ b/deps/acore/mysql-tools/bin/mysqlimport.exe diff --git a/deps/drassil/mysql-tools/build-dump-parser.sh b/deps/acore/mysql-tools/build-dump-parser.sh index a38a195f81..a38a195f81 100644 --- a/deps/drassil/mysql-tools/build-dump-parser.sh +++ b/deps/acore/mysql-tools/build-dump-parser.sh diff --git a/deps/drassil/mysql-tools/dump-parser.c b/deps/acore/mysql-tools/dump-parser.c index a9262d4f92..a9262d4f92 100644 --- a/deps/drassil/mysql-tools/dump-parser.c +++ b/deps/acore/mysql-tools/dump-parser.c diff --git a/deps/drassil/mysql-tools/mysql-config.dist b/deps/acore/mysql-tools/mysql-config.dist index ca71fc41ea..2075c54c11 100644 --- a/deps/drassil/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/deps/drassil/mysql-tools/mysql-dump b/deps/acore/mysql-tools/mysql-dump index 33e5e35aca..33e5e35aca 100644 --- a/deps/drassil/mysql-tools/mysql-dump +++ b/deps/acore/mysql-tools/mysql-dump diff --git a/deps/drassil/mysql-tools/mysql-import b/deps/acore/mysql-tools/mysql-import index ad05e1bd05..ad05e1bd05 100644 --- a/deps/drassil/mysql-tools/mysql-import +++ b/deps/acore/mysql-tools/mysql-import diff --git a/deps/drassil/mysql-tools/mysql-tools b/deps/acore/mysql-tools/mysql-tools index 6f2fad77c6..6f2fad77c6 100644 --- a/deps/drassil/mysql-tools/mysql-tools +++ b/deps/acore/mysql-tools/mysql-tools diff --git a/deps/drassil/mysql-tools/shared-def b/deps/acore/mysql-tools/shared-def index 7404393d2b..7404393d2b 100644 --- a/deps/drassil/mysql-tools/shared-def +++ b/deps/acore/mysql-tools/shared-def diff --git a/deps/acore/mysql-tools/upt.json b/deps/acore/mysql-tools/upt.json new file mode 100644 index 0000000000..2956a94a2c --- /dev/null +++ b/deps/acore/mysql-tools/upt.json @@ -0,0 +1,11 @@ +{ + "name": "udw/mysql-tools", + "dependencies": { + }, + "devDependencies": { + }, + "_comment_keep": "ensure we keep the right git repository configurations", + "keep": [ + ".git/config" + ] +} diff --git a/deps/deno/bin/deno b/deps/deno/bin/deno Binary files differnew file mode 100755 index 0000000000..e9d44a6714 --- /dev/null +++ b/deps/deno/bin/deno diff --git a/deps/git-subrepo b/deps/git-subrepo new file mode 160000 +Subproject 2f6859642ae9104a9699021218bf607598f5a0e diff --git a/deps/hw-core/bash-lib-git/src/subtree.sh b/deps/hw-core/bash-lib-git/src/subtree.sh deleted file mode 100644 index 08820e6405..0000000000 --- a/deps/hw-core/bash-lib-git/src/subtree.sh +++ /dev/null @@ -1,3 +0,0 @@ -function hwc_git_subtree_list() { - git log | grep git-subtree-dir | tr -d ' ' | cut -d ":" -f2 | sort | uniq -} diff --git a/docker-compose.yml b/docker-compose.yml index a13d49ceb2..16ade324fd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,79 +1,147 @@ -version: '3.2' +version: '3.9' + +# extension field: https://docs.docker.com/compose/compose-file/compose-file-v3/#extension-fields +x-networks: &networks + networks: + - ac-network + +x-ac-shared-conf: &ac-shared-conf + <<: *networks + working_dir: /azerothcore + depends_on: + ac-database: + condition: service_healthy services: +#============================ +# +# Abstract services to extend +# +#============================ + + abstract-bind: + image: local/azerothcore/abstract-bind + volumes: + - .:/azerothcore/ + # env dir shared between 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 + # [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 + profiles: [abstract-service] # do not run this + + abstract-no-bind: + image: local/azerothcore/abstract-no-bind + volumes: + - ac-proj:/azerothcore/ + profiles: [abstract-service] # do not run this + +#======================= +# +# Applications +# +#======================= + ac-database: - image: azerothcore/database + <<: *networks + image: mysql:8.0 restart: unless-stopped - build: - context: . - dockerfile: ./docker/database/Dockerfile - networks: - - ac-network + cap_add: + - SYS_NICE # CAP_SYS_NICE ports: - - ${DB_EXTERNAL_PORT:-3306}:3306 + - ${DOCKER_DB_EXTERNAL_PORT:-3306}:3306 environment: - - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD:-password} + - MYSQL_ROOT_PASSWORD=${DOCKER_DB_ROOT_PASSWORD:-password} volumes: - type: volume source: ac-database target: /var/lib/mysql + healthcheck: + test: "/usr/bin/mysql --user=root --password=$$MYSQL_ROOT_PASSWORD --execute \"SHOW DATABASES;\"" + interval: 2s + timeout: 20s + retries: 10 + ac-worldserver: + <<: *ac-shared-conf + extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} stdin_open: true tty: true - image: azerothcore/worldserver + command: ./acore.sh run-worldserver + image: acore/worldserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally restart: unless-stopped + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} privileged: true build: - context: ./docker/worldserver - dockerfile: Dockerfile - networks: - - ac-network + context: . + target: ${DOCKER_BUILD_WORLD_TARGET:-dev} + dockerfile: ./apps/docker/Dockerfile ports: - - ${WORLD_EXTERNAL_PORT:-8085}:8085 - - ${SOAP_EXTERNAL_PORT:-7878}:7878 - volumes: - - type: bind - source: ./docker/worldserver/bin - target: /azeroth-server/bin - - 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 + - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 + - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 + profiles: [all, app, worldserver] ac-authserver: - image: azerothcore/authserver + <<: *ac-shared-conf + extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} + tty: true + command: ./acore.sh run-authserver + image: acore/authserver:${DOCKER_IMAGE_TAG:-master} # name of the generated image after built locally restart: unless-stopped + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} build: - context: ./docker/authserver - dockerfile: Dockerfile - networks: - - ac-network + context: . + target: ${DOCKER_BUILD_AUTH_TARGET:-dev} + dockerfile: ./apps/docker/Dockerfile + ports: + - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 + profiles: [all, app, authserver] + +#====================== +# +# Dev services +# +#====================== + + ac-dev-server: + <<: *ac-shared-conf + tty: true + image: acore/dev-server:${DOCKER_IMAGE_TAG:-master} + security_opt: + - seccomp:unconfined + build: + context: . + target: dev + dockerfile: ./apps/docker/Dockerfile + args: + USER_ID: ${DOCKER_USER_ID:-1000} + GROUP_ID: ${DOCKER_GROUP_ID:-1000} + extends: ${DOCKER_EXTENDS_BIND:-abstract-bind} + env_file: + ${DOCKER_AC_ENV_FILE:-conf/dist/env.ac} + environment: + DBLIST: AUTH,CHARACTERS,WORLD ports: - - ${AUTH_EXTERNAL_PORT:-3724}:3724 + - ${DOCKER_AUTH_EXTERNAL_PORT:-3724}:3724 + - ${DOCKER_WORLD_EXTERNAL_PORT:-8085}:8085 + - ${DOCKER_SOAP_EXTERNAL_PORT:-7878}:7878 volumes: - - type: bind - source: ./docker/authserver/bin - target: /azeroth-server/bin - - 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 + - ac-build:/azerothcore/var/build + profiles: [all, dev] volumes: ac-database: + ac-env: + ac-build: + ac-proj: networks: ac-network: diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index fd9f9ff7b5..0000000000 --- a/docker/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# Run AzerothCore with Docker - -*This readme it's a summary of the AzerothCore docker features.* - -Docker. is a software that performs operating-system-level virtualization, allowing to wrap and launch applications inside containers. - -Thanks to Docker, you can quickly setup and run AzerothCore in any operating system. - -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 - -To install and AzerothCore using Docker, you have two options - -#### Option A. Using Docker Compose (very easy - recommended) - -- Check the [Install with Docker](https://www.azerothcore.org/wiki/Install-with-Docker) guide. - -#### Option B. Build and start each container manually (longer - not recommended) - -You have to follow these steps (**respecting the order**): - -1) Create a Docker Network: `docker network create ac-network`. All your docker containers will use it to communicate to each other. - -2) Launch one instance of the [AzerothCore Dockerized Database](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/database) - -3) Build AzerothCore using [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 - -The total amount of RAM when running all AzerothCore docker containers is **less than 2 GB**. - - - - -### Docker containers vs Virtual machines - -Usind Docker will have the same benefits as using virtual machines, but with much less overhead: - - - diff --git a/docker/authserver/Dockerfile b/docker/authserver/Dockerfile deleted file mode 100644 index d7e6bc2e9a..0000000000 --- a/docker/authserver/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:20.04 - -# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - -# set timezone environment variable -ENV TZ=Etc/UTC - -# set noninteractive mode so tzdata doesn't ask to set timezone on install -ENV DEBIAN_FRONTEND=noninteractive - -# install the required dependencies to run the authserver -RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev net-tools tzdata; - -# change timezone in container -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata - -HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD netstat -lnpt | grep :3724 || exit 1 - -# run the authserver located in the directory "docker/authserver/bin" of the host machine -CMD ["/azeroth-server/bin/authserver"] diff --git a/docker/authserver/README.md b/docker/authserver/README.md deleted file mode 100644 index d4d3a7f180..0000000000 --- a/docker/authserver/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# AzerothCore Dockerized Authserver - -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](http://www.azerothcore.org/wiki/install-with-Docker). - -## Requirements - -- You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system. - -- You need to first build the [AzerothCore Build Image](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build). - -- If you haven't created a docker network yet, create it by simply using `docker network create ac-network`. - -- You have to copy the file `docker/authserver/etc/authserver.conf.dockerdist` and rename the copied file to `docker/authserver/etc/authserver.conf`. Then open it and change the values where needed (you may need to change the DB port). - -## Building the container image - -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 -``` - -*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).* - -## Run the container - -``` -docker run --name ac-authserver \ - --mount type=bind,source="$(pwd)"/docker/authserver/bin/,target=/azeroth-server/bin \ - --mount type=bind,source="$(pwd)"/docker/authserver/etc/,target=/azeroth-server/etc \ - --mount type=bind,source="$(pwd)"/docker/authserver/logs/,target=/azeroth-server/logs \ - -p 127.0.0.1:3724:3724 \ - --network ac-network \ - -it azerothcore/authserver -``` - -*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).* diff --git a/docker/authserver/logs/.gitkeep b/docker/authserver/logs/.gitkeep deleted file mode 100644 index 8b13789179..0000000000 --- a/docker/authserver/logs/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docker/build/Dockerfile b/docker/build/Dockerfile deleted file mode 100644 index db37eab909..0000000000 --- a/docker/build/Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -FROM ubuntu:20.04 - -# install the required dependencies to compile AzerothCore -ARG DEBIAN_FRONTEND=noninteractive -RUN apt update && apt install -y git cmake make gcc g++ clang libmysqlclient-dev libssl-dev libbz2-dev libreadline-dev libncurses-dev libace-6.4.5 libace-dev - -# copy the sources from the host machine to the Docker container -ADD .git /azerothcore/.git -ADD deps /azerothcore/deps -ADD conf/dist /azerothcore/conf/dist -ADD src /azerothcore/src -ADD modules /azerothcore/modules -ADD CMakeLists.txt /azerothcore/CMakeLists.txt - -ARG ENABLE_SCRIPTS=1 -ENV ENABLE_SCRIPTS=$ENABLE_SCRIPTS - -ENTRYPOINT cd azerothcore/build && \ - # run cmake - cmake ../ -DCMAKE_INSTALL_PREFIX=/azeroth-server -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=0 -DSCRIPTS=$ENABLE_SCRIPTS -DWITH_WARNINGS=1 -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror" && \ - # calculate the optimal number of threads - MTHREADS=`grep -c ^processor /proc/cpuinfo`; MTHREADS=$(($MTHREADS + 2)) && \ - # run compilation - make -j $MTHREADS && \ - make install -j $MTHREADS && \ - # copy the binary files "authserver" and "worldserver" files back to the host - # - the directories "/binworldserver" and "/binauthserver" are meant to be bound to the host directories - # - see docker/build/README.md to view the bindings - cp -f /azeroth-server/bin/worldserver /binworldserver && \ - cp -f /azeroth-server/bin/authserver /binauthserver diff --git a/docker/build/README.md b/docker/build/README.md deleted file mode 100644 index a47db99e9f..0000000000 --- a/docker/build/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# AzerothCore Dockerized Build - -The AzerothCore Build Dockerfile will create a container that will run the AC build. - -When this container runs, it will compile AC and generate: - -- the build cache in the `docker/build/cache` directory -- the `worldserver` executable file in `docker/worldserver/bin` -- the `authserver` executable file in `docker/authserver/bin` - -The executable files will be used by the [authserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/authserver) and the [worldserver](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/worldserver) docker containers. - -Note: every time you update your AzerothCore sources, you **must** run again the build container and restart your `worldserver` and `authserver` containers. - -## Usage - -To build the container image you have to be in the **main** folder of your local AzerothCore sources directory and run: - -``` -docker build -t acbuild -f docker/build/Dockerfile . -``` - -Then you can launch the container to rebuild AC using: - -``` -docker run \ - -v /$(pwd)/docker/build/cache:/azerothcore/build \ - -v /$(pwd)/docker/worldserver/bin:/binworldserver \ - -v /$(pwd)/docker/authserver/bin:/binauthserver \ - acbuild -``` - -### Clearing the cache - -To clear the build cache, delete all files contained under the `docker/build/cache` directory. diff --git a/docker/database/Dockerfile b/docker/database/Dockerfile deleted file mode 100644 index 5fd73237d7..0000000000 --- a/docker/database/Dockerfile +++ /dev/null @@ -1,33 +0,0 @@ -FROM alpine:3.9 as builder - -# install bash -RUN apk add --no-cache bash - -# 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 - -# run the AzerothCore database assembler -RUN ./azerothcore/bin/acore-db-asm 1 - -FROM mysql:5.7 - -# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - -# set timezone environment variable -ENV TZ=Etc/UTC - -ENV LANG C.UTF-8 - -# copy files from the previous build stage - see: https://docs.docker.com/develop/develop-images/multistage-build/ -COPY --from=builder /azerothcore/env/dist/sql /sql - -# adding the "generate-databases.sh" to the directory "/docker-entrypoint-initdb.d" -# because all scripts included in that directory will automatically be executed when the docker container starts -COPY docker/database/generate-databases.sh /docker-entrypoint-initdb.d - -HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD mysqladmin -uroot -p$MYSQL_ROOT_PASSWORD ping -h localhost diff --git a/docker/database/README.md b/docker/database/README.md deleted file mode 100644 index 77a7670614..0000000000 --- a/docker/database/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# AzerothCore Dockerized Database - -This provides a way to quickly launch one or more instances of a fully-ready AzerothCore database. It is particularly useful for testing/development purposes. - -For example, with this you can quickly create a new, clean instance of the AzerothCore DB. Or create **multiple** instances each one available on a different **port** (that can be handy to test & compare things). - -Instances (containers) can be easily set up and then destroyed, so you can always switch to a clean state after your experiments. Every instance will have the three `acore_auth`, `acore_characters` and `acore_world` mysql databases. - -**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](http://www.azerothcore.org/wiki/install-with-Docker). - - -# Setup & usage instructions - -### Requirements - -The only requirement is [Docker](https://docs.docker.com/install/). You can install it on any operating system. - - -## Building the container image - -To build the container image you have to be in the **main folder** of your local AzerothCore sources directory. - -If you don't have the AzerothCore sources, clone it using: - -`git clone https://github.com/azerothcore/azerothcore-wotlk.git` - -and cd into it `cd azerothcore-wotlk`. - -You can build the image using: - -``` -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. - -*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).* - - -## How to launch a container - -Run the following command to launch a container: - -``` -docker run --name ac-database \ - -p 127.0.0.1:3306:3306 \ - -e MYSQL_ROOT_PASSWORD=password \ - --network ac-network \ - azerothcore/database -``` - -Where: - -`--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`. - -- INTERNAL_PORT **must** always be 3306. -- EXTERNAL_PORT is the port that you will use to access the mysql-server from outside docker - -`--network` takes the name of the internal docker network. Containers must be on the same network to communicate to each other. - -**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-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. - -`azerothcore/database` will be the name of your docker image. - -When the container is ready, you will see a message similar to: - -> Version: '5.7.24' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) - -You can optionally pass option `-d` to detach the container run from your terminal. - -You can optionally pass option `-it` to run the container as an interactive process (so you can kill it with ctrl+c). - -*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).* - -## Launching more instances - -You can easily run more instances. You just have to specify a different **name** and **port** for each. - -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-database-1 -p 127.0.0.1:9001: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-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. - -*For more information about the `docker ps` command, check the [docker ps doc](https://docs.docker.com/engine/reference/commandline/ps/).* - -## Stopping / removing - -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-database-1`. diff --git a/docker/database/generate-databases.sh b/docker/database/generate-databases.sh deleted file mode 100755 index 5912af5464..0000000000 --- a/docker/database/generate-databases.sh +++ /dev/null @@ -1,40 +0,0 @@ -# TODO: remove this line after we squash our DB updates -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "SET GLOBAL max_allowed_packet=128*1024*1024;" - -echo "Creating DBs..." -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_auth" -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_characters" -mysql -u root -p$MYSQL_ROOT_PASSWORD -e "CREATE DATABASE acore_world" - - -echo "Importing auth base..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_base.sql - -echo "Importing characters base..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_base.sql - -echo "Importing world base..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_base.sql - - -echo "Importing auth updates..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_updates.sql - -echo "Importing characters updates..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_updates.sql - -echo "Importing world updates..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_updates.sql - - -echo "Importing auth custom (if any)..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_auth < /sql/auth_custom.sql - -echo "Importing characters custom (if any)..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_characters < /sql/characters_custom.sql - -echo "Importing world custom (if any)..." -mysql -u root -p$MYSQL_ROOT_PASSWORD acore_world < /sql/world_custom.sql - - -echo "Done!" diff --git a/docker/worldserver/Dockerfile b/docker/worldserver/Dockerfile deleted file mode 100644 index e208e48994..0000000000 --- a/docker/worldserver/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM ubuntu:20.04 - -# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - -# set timezone environment variable -ENV TZ=Etc/UTC - -# set noninteractive mode so tzdata doesn't ask to set timezone on install -ENV DEBIAN_FRONTEND=noninteractive - -# install the required dependencies to run the authserver -RUN apt update && apt install -y libmysqlclient-dev libssl-dev libace-6.4.5 libace-dev libreadline-dev net-tools tzdata; - -# change timezone in container -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata - -HEALTHCHECK --interval=5s --timeout=15s --start-period=30s --retries=3 CMD netstat -lnpt | grep :8085 || exit 1 - -# run the worldserver located in the directory "docker/worldserver/bin" of the host machine -CMD ["/azeroth-server/bin/worldserver"] diff --git a/docker/worldserver/README.md b/docker/worldserver/README.md deleted file mode 100644 index 3e8f577c52..0000000000 --- a/docker/worldserver/README.md +++ /dev/null @@ -1,42 +0,0 @@ -# AzerothCore Dockerized Worldserver - -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](http://www.azerothcore.org/wiki/install-with-Docker). - -## Requirements - -- You need to have [Docker](https://docs.docker.com/install/) installed in your system. You can install it on any operating system. - -- You need to first build AzerothCore using the [AzerothCore Dockerized Build](https://github.com/azerothcore/azerothcore-wotlk/tree/master/docker/build). - -- If you haven't created a docker network yet, create it by simply using `docker network create ac-network`. - -- You have to copy the file `docker/worldserver/worldserver.conf.dockerdist` and rename the copied file to `docker/worldserver/worldserver.conf`. Then open it and change the values where needed (you may need to change the DB port). - -- You need to have the **data files** somewhere in your system. If you don't have them yet, check the step ["Download the data files" from the installation guide](http://www.azerothcore.org/wiki/Installation#5-download-the-data-files). - -## Building the container image - -To build the container image you have to be in the **main** folder of your local AzerothCore sources directory. - -```docker build -t azerothcore/worldserver -f docker/worldserver/Dockerfile docker/worldserver``` - -*For more information about the `docker build` command, check the [docker build doc](https://docs.docker.com/engine/reference/commandline/build/).* - -## Run the container - -Replace `/path/to/your/data` with the path of where your data folder is. - -``` -docker run --name ac-worldserver \ - --mount type=bind,source=/path/to/your/data,target=/azeroth-server/data \ - --mount type=bind,source="$(pwd)"/docker/worldserver/bin/,target=/azeroth-server/bin \ - --mount type=bind,source="$(pwd)"/docker/worldserver/etc/,target=/azeroth-server/etc \ - --mount type=bind,source="$(pwd)"/docker/worldserver/logs/,target=/azeroth-server/logs \ - -p 127.0.0.1:8085:8085 \ - --network ac-network \ - -it azerothcore/worldserver -``` - -*For more information about the `docker run` command, check the [docker run doc](https://docs.docker.com/engine/reference/run/).* diff --git a/docker/worldserver/data/.gitkeep b/docker/worldserver/data/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/docker/worldserver/data/.gitkeep +++ /dev/null diff --git a/docker/worldserver/etc/.gitkeep b/docker/worldserver/etc/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/docker/worldserver/etc/.gitkeep +++ /dev/null diff --git a/docker/worldserver/logs/.gitkeep b/docker/worldserver/logs/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 --- a/docker/worldserver/logs/.gitkeep +++ /dev/null diff --git a/docker/authserver/etc/.gitkeep b/env/docker/data/.gitkeep index e69de29bb2..e69de29bb2 100644 --- a/docker/authserver/etc/.gitkeep +++ b/env/docker/data/.gitkeep diff --git a/docker/build/cache/.gitkeep b/env/docker/etc/.gitkeep index e69de29bb2..e69de29bb2 100644 --- a/docker/build/cache/.gitkeep +++ b/env/docker/etc/.gitkeep diff --git a/docker/authserver/etc/authserver.conf.dockerdist b/env/docker/etc/authserver.conf.dockerdist index fdfa1cc695..48a00fca22 100644 --- a/docker/authserver/etc/authserver.conf.dockerdist +++ b/env/docker/etc/authserver.conf.dockerdist @@ -5,7 +5,7 @@ # Do not change this # Files in LogsDir will reflect on your host directory: docker/authserver/logs -LogsDir = "/azeroth-server/logs" +LogsDir = "/azerothcore/env/dist/logs" # Change this configuration accordingly with your docker setup # The format is "hostname;port;username;password;database": diff --git a/docker/worldserver/etc/worldserver.conf.dockerdist b/env/docker/etc/worldserver.conf.dockerdist index 854cbb3c3e..d59ffa2e1b 100644 --- a/docker/worldserver/etc/worldserver.conf.dockerdist +++ b/env/docker/etc/worldserver.conf.dockerdist @@ -5,8 +5,8 @@ # Do NOT change those Dir configs # Files in LogsDir will reflect on your host directory: docker/worldserver/logs -LogsDir = "/azeroth-server/logs" -DataDir = "/azeroth-server/data" +LogsDir = "/azerothcore/env/dist/logs" +DataDir = "/azerothcore/env/dist/data" # Change this configuration accordingly with your docker setup # The format is "hostname;port;username;password;database": diff --git a/docker/worldserver/bin/.gitkeep b/env/docker/logs/.gitkeep index e69de29bb2..e69de29bb2 100644 --- a/docker/worldserver/bin/.gitkeep +++ b/env/docker/logs/.gitkeep diff --git a/modules/create_module.sh b/modules/create_module.sh index 3f2f638105..51e9de479a 100644 --- a/modules/create_module.sh +++ b/modules/create_module.sh @@ -31,7 +31,7 @@ then git init && git add -A && git commit -m "Initial commit - $MODULE_NAME" echo "--- Configure git for nice commit messages" - source $GIT_COMMIT_MSG_SETUP || bash $GIT_COMMIT_MSG_SETUP + source "$GIT_COMMIT_MSG_SETUP" || bash "$GIT_COMMIT_MSG_SETUP" echo "--- Ready to code" fi diff --git a/src/server/authserver/authserver.conf.dist b/src/server/authserver/authserver.conf.dist index 971a371a02..cfb5833c9b 100644 --- a/src/server/authserver/authserver.conf.dist +++ b/src/server/authserver/authserver.conf.dist @@ -34,7 +34,7 @@ # Description: Logs directory setting. # Important: LogsDir needs to be quoted, as the string might contain space characters. # Logs directory must exists, or log file creation will be disabled. -# Example: "/home/youruser/azeroth-server/logs" +# Example: "/home/youruser/azerothcore/logs" # Default: "" - (Log files will be stored in the current path) LogsDir = "" diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 038ad9962d..bf74feac16 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -61,7 +61,7 @@ RealmID = 1 # DataDir # Description: Data directory setting. # Important: DataDir needs to be quoted, as the string might contain space characters. -# Example: "/home/youruser/azeroth-server/data" +# Example: "/home/youruser/azerothcore/data" # Default: "." DataDir = "." @@ -71,7 +71,7 @@ DataDir = "." # Description: Logs directory setting. # Important: LogsDir needs to be quoted, as the string might contain space characters. # Logs directory must exists, or log file creation will be disabled. -# Example: "/home/youruser/azeroth-server/logs" +# Example: "/home/youruser/azerothcore/logs" # Default: "" - (Log files will be stored in the current path) LogsDir = "" |