new version commit

This commit is contained in:
mikx
2025-09-29 02:27:58 -04:00
commit 3e8d31e686
9244 changed files with 7357899 additions and 0 deletions

261
apps/docker/Dockerfile Normal file
View File

@@ -0,0 +1,261 @@
ARG UBUNTU_VERSION=22.04 # lts
# This target lays out the general directory skeleton for AzerothCore,
# This target isn't intended to be directly used
FROM ubuntu:$UBUNTU_VERSION AS skeleton
# Note: ARG instructions defined after FROM are available in this build stage.
# Placing ARG TZ here (after FROM) ensures it is accessible for configuring the timezone below.
ARG TZ=Etc/UTC
ARG DOCKER=1
ARG DEBIAN_FRONTEND=noninteractive
ENV AC_FORCE_CREATE_DB=1
RUN mkdir -pv \
/azerothcore/bin \
/azerothcore/data \
/azerothcore/deps \
/azerothcore/env/dist/bin \
/azerothcore/env/dist/data/Cameras \
/azerothcore/env/dist/data/dbc \
/azerothcore/env/dist/data/maps \
/azerothcore/env/dist/data/mmaps \
/azerothcore/env/dist/data/vmaps \
/azerothcore/env/dist/logs \
/azerothcore/env/dist/temp \
/azerothcore/env/dist/etc \
/azerothcore/modules \
/azerothcore/src \
/azerothcore/build
# Configure Timezone
RUN apt-get update \
&& apt-get install -y --no-install-recommends tzdata ca-certificates \
&& ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime \
&& echo "$TZ" > /etc/timezone \
&& dpkg-reconfigure --frontend noninteractive tzdata \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /azerothcore
# This target builds the docker image
# This target can be useful to inspect the explicit outputs from the build,
FROM skeleton AS build
ARG CTOOLS_BUILD="all"
ARG CTYPE="RelWithDebInfo"
ARG CCACHE_CPP2="true"
ARG CSCRIPTPCH="OFF"
ARG CSCRIPTS="static"
ARG CMODULES="static"
ARG CSCRIPTS_DEFAULT_LINKAGE="static"
ARG CWITH_WARNINGS="ON"
ARG CMAKE_EXTRA_OPTIONS=""
ARG GIT_DISCOVERY_ACROSS_FILESYSTEM=1
ARG CCACHE_DIR="/ccache"
ARG CCACHE_MAXSIZE="1000MB"
ARG CCACHE_SLOPPINESS="pch_defines,time_macros,include_file_mtime"
ARG CCACHE_COMPRESS=""
ARG CCACHE_COMPRESSLEVEL="9"
ARG CCACHE_COMPILERCHECK="content"
ARG CCACHE_LOGFILE=""
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential ccache libtool cmake-data make cmake clang \
git lsb-base curl unzip default-mysql-client openssl \
default-libmysqlclient-dev libboost-all-dev libssl-dev libmysql++-dev \
libreadline-dev zlib1g-dev libbz2-dev libncurses5-dev \
&& rm -rf /var/lib/apt/lists/*
COPY CMakeLists.txt /azerothcore/CMakeLists.txt
COPY conf /azerothcore/conf
COPY deps /azerothcore/deps
COPY src /azerothcore/src
COPY modules /azerothcore/modules
ARG CACHEBUST=1
WORKDIR /azerothcore/build
RUN --mount=type=cache,target=/ccache,sharing=locked \
# This may seem silly (and it is), but AzerothCore wants the git repo at
# build time. The git repo is _huge_ and it's not something that really
# makes sense to mount into the container, but this way we can let the build
# have the information it needs without including the hundreds of megabytes
# of git repo into the container.
--mount=type=bind,target=/azerothcore/.git,source=.git \
git config --global --add safe.directory /azerothcore \
&& cmake /azerothcore \
-DCMAKE_INSTALL_PREFIX="/azerothcore/env/dist" \
-DAPPS_BUILD="all" \
-DTOOLS_BUILD="$CTOOLS_BUILD" \
-DSCRIPTS="$CSCRIPTS" \
-DMODULES="$CMODULES" \
-DWITH_WARNINGS="$CWITH_WARNINGS" \
-DCMAKE_BUILD_TYPE="$CTYPE" \
-DCMAKE_CXX_COMPILER="clang++" \
-DCMAKE_C_COMPILER="clang" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DBoost_USE_STATIC_LIBS="ON" \
&& cmake --build . --config "$CTYPE" -j $(($(nproc) + 1)) \
&& cmake --install . --config "$CTYPE"
#############################
# Base runtime for services #
#############################
FROM skeleton AS runtime
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG DOCKER_USER=acore
ENV ACORE_COMPONENT=undefined
# Install base dependencies for azerothcore
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libmysqlclient21 libreadline8 \
gettext-base default-mysql-client && \
rm -rf /var/lib/apt/lists/*
COPY --from=build /azerothcore/env/dist/etc/ /azerothcore/env/ref/etc
VOLUME /azerothcore/env/dist/etc
ENV PATH="/azerothcore/env/dist/bin:$PATH"
RUN groupadd --gid "$GROUP_ID" "$DOCKER_USER" && \
useradd -d /azerothcore --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
passwd -d "$DOCKER_USER" && \
chown -R "$DOCKER_USER:$DOCKER_USER" /azerothcore
COPY --chown=$USER_ID:$GROUP_ID \
--chmod=755 \
apps/docker/entrypoint.sh /azerothcore/entrypoint.sh
USER $DOCKER_USER
ENTRYPOINT ["/usr/bin/env", "bash", "/azerothcore/entrypoint.sh"]
###############
# Auth Server #
###############
FROM runtime AS authserver
LABEL description="AzerothCore Auth Server"
ENV ACORE_COMPONENT=authserver
# Don't run database migrations. We can leave that up to the db-import container
ENV AC_UPDATES_ENABLE_DATABASES=0
# This disables user prompts. The console is still active, however
ENV AC_DISABLE_INTERACTIVE=1
ENV AC_CLOSE_IDLE_CONNECTIONS=0
COPY --chown=$DOCKER_USER:$DOCKER_USER \
--from=build \
/azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver
CMD ["authserver"]
################
# World Server #
################
FROM runtime AS worldserver
LABEL description="AzerothCore World Server"
ENV ACORE_COMPONENT=worldserver
# Don't run database migrations. We can leave that up to the db-import container
ENV AC_UPDATES_ENABLE_DATABASES=0
# This disables user prompts. The console is still active, however
ENV AC_DISABLE_INTERACTIVE=1
ENV AC_CLOSE_IDLE_CONNECTIONS=0
COPY --chown=$DOCKER_USER:$DOCKER_USER \
--from=build \
/azerothcore/env/dist/bin/worldserver /azerothcore/env/dist/bin/worldserver
VOLUME /azerothcore/env/dist/etc
CMD ["worldserver"]
#############
# DB Import #
#############
FROM runtime AS db-import
LABEL description="AzerothCore Database Import tool"
USER $DOCKER_USER
ENV ACORE_COMPONENT=dbimport
COPY --chown=$DOCKER_USER:$DOCKER_USER \
data data
COPY --chown=$DOCKER_USER:$DOCKER_USER \
modules modules
COPY --chown=$DOCKER_USER:$DOCKER_USER\
--from=build \
/azerothcore/env/dist/bin/dbimport /azerothcore/env/dist/bin/dbimport
CMD [ "/azerothcore/env/dist/bin/dbimport" ]
###############
# Client Data #
###############
FROM skeleton AS client-data
LABEL description="AzerothCore client-data"
ENV DATAPATH=/azerothcore/env/dist/data
RUN apt-get update && \
apt-get install -y curl unzip && \
rm -rf /var/lib/apt/lists/*
COPY --chown=$DOCKER_USER:$DOCKER_USER apps apps
VOLUME /azerothcore/env/dist/data
USER $DOCKER_USER
CMD ["bash", "-c", "source /azerothcore/apps/installer/includes/functions.sh && inst_download_client_data" ]
##################
# Map Extractors #
##################
FROM runtime AS tools
LABEL description="AzerothCore Tools"
WORKDIR /azerothcore/env/dist/
RUN mkdir -pv /azerothcore/env/dist/Cameras \
/azerothcore/env/dist/dbc \
/azerothcore/env/dist/maps \
/azerothcore/env/dist/mmaps \
/azerothcore/env/dist/vmaps
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
/azerothcore/env/dist/bin/map_extractor /azerothcore/env/dist/bin/map_extractor
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
/azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/dist/bin/mmaps_generator
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
/azerothcore/env/dist/bin/vmap4_assembler /azerothcore/env/dist/bin/vmap4_assembler
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
/azerothcore/env/dist/bin/vmap4_extractor /azerothcore/env/dist/bin/vmap4_extractor

View File

@@ -0,0 +1,108 @@
#syntax=docker/dockerfile:1.2
#================================================================
#
# DEV: Stage used for the development environment
# and the locally built services
#
#=================================================================
FROM ubuntu:24.04 as dev
ARG USER_ID=1000
ARG GROUP_ID=1000
ARG DOCKER_USER=acore
ARG TZ=Etc/UTC
LABEL description="AC base image for dev containers"
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
ENV DOCKER=1
# Ensure ac-dev-server can properly pull versions
ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
# set timezone environment variable
ENV TZ=$TZ
# set noninteractive mode so tzdata doesn't ask to set timezone on install
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# Classic install
git \
clang lldb lld clang-format clang-tidy \
make cmake \
gcc g++ \
libmysqlclient-dev \
libssl-dev \
libbz2-dev \
libreadline-dev \
libncurses-dev \
mysql-server \
libboost-all-dev \
# Other
curl \
unzip \
sudo \
gdb gdbserver \
libtool \
build-essential \
cmake-data \
openssl \
google-perftools libgoogle-perftools-dev \
libmysql++-dev \
ccache \
tzdata \
# Utility for column command used by dashboard
util-linux \
# Certificates for downloading client data
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Ensure git will work with the AzerothCore source directory
RUN git config --global --add safe.directory /azerothcore
# change timezone in container
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
# Create a non-root user
RUN userdel --remove ubuntu \
&& addgroup --gid "$GROUP_ID" "$DOCKER_USER" \
&& adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" \
&& passwd -d "$DOCKER_USER" \
&& echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
# must be created to set the correct permissions on them
RUN mkdir -p \
/azerothcore/env/dist/bin \
/azerothcore/env/dist/data/Cameras \
/azerothcore/env/dist/data/dbc \
/azerothcore/env/dist/data/maps \
/azerothcore/env/dist/data/mmaps \
/azerothcore/env/dist/data/vmaps \
/azerothcore/env/dist/logs \
/azerothcore/env/dist/temp \
/azerothcore/env/dist/etc \
/azerothcore/var/build/obj
# Correct permissions for non-root operations
RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore /run /opt /azerothcore
USER $DOCKER_USER
# copy only necessary files for the acore dashboard
COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps
COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin
COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf
COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data
COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps
COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json
COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh
# Download deno and make sure the dashboard works
RUN bash /azerothcore/acore.sh quit
WORKDIR /azerothcore

41
apps/docker/README.md Normal file
View File

@@ -0,0 +1,41 @@
# Docker
Full documentation is [on our wiki](https://www.azerothcore.org/wiki/install-with-docker#installation)
## Building
### Prerequisites
Ensure that you have docker, docker compose (v2), and the docker buildx command
installed.
It's all bundled with [Docker Desktop](https://docs.docker.com/get-docker/),
though if you're using Linux you can install them through your distribution's
package manage or by using the [documentation from docker](https://docs.docker.com/engine/install/)
### Running the Build
1. Build containers with command
```console
$ docker compose build
```
1. Note that the initial build will take a long time, though subsequent builds should be faster
2. Start containers with command
```console
$ docker compose up -d
# Skip the build step
$ docker compose up -d --build
```
1. Note that this command may take a while the first time, for the database import
3. (on first install) You'll need to attach to the worldserver and create an Admin account
```console
$ docker compose attach ac-worldserver
AC> account create admin password 3 -1
```

216
apps/docker/docker-cmd.sh Normal file
View File

@@ -0,0 +1,216 @@
#!/bin/bash
# TODO(michaeldelago) decide if we need a wrapper like this around docker
# commands.
#
# Running the docker commands should be simple and familiar.
# Introducting extra steps through the dashboard can cause issues with people
# getting started, especially if they already know docker.
#
# If a new user knows docker, they will feel (pretty close) to right at home.
# If a new user doesn't know docker, it's easy to learn and the knowledge
# applies to much more than azerothcore
set -euo pipefail
COMPOSE_DOCKER_CLI_BUILD="1"
DOCKER_BUILDKIT="1"
# BUILDKIT_INLINE_CACHE="1"
function usage () {
cat <<EOF
Wrapper for shell scripts around docker
usage: $(basename $0) ACTION [ ACTION... ] [ ACTION_ARG... ]
actions:
EOF
# the `-s` will remove the "#" and properly space the action and description
cat <<EOF | column -t -l2 -s'#'
> start:app # Start the development worldserver and authserver
> start:app:d # Start the development worldserver and authserver in detached mode
> build # build the development worldserver and authserver
> pull # pull the development worldserver and authserver
> build:nocache # build the development worldserver and authserver without cache
> clean:build # clean build artifacts from the dev server
> client-data # download client data in the dev server
> dev:up start # the dev server
> dev:build # compile azerothcore using the dev server
> dev:dash # execute the dashboard in the dev server container
> dev:shell [ ARGS... ] # open a bash shell in the dev server
> prod:build # Build the service containers used by acore-docker
> prod:pull # Pull the containers used by acore-docker
> prod:up # Start the services used by acore-docker
> prod:up:d # start the services used by acore-docker in the background
> attach SERVICE # attach to a service currently running in docker compose
EOF
}
# If no args, just spit usage and exit
[[ $# -eq 0 ]] && usage && exit
# loop through commands passed
while [[ $# -gt 0 ]]; do
case "$1" in
start:app)
set -x
docker compose up
set +x
# pop the head off of the queue of args
# After this, the value of $1 is the value of $2
shift
;;
start:app:d)
set -x
docker compose up -d
set +x
shift
;;
build)
set -x
docker compose build
set +x
shift
;;
pull)
set -x
docker compose pull
set +x
shift
;;
build:nocache)
set -x
docker compose build --no-cache
set +x
shift
;;
clean:build)
set -x
# Don't run 'docker buildx prune' since it may "escape" our bubble
# and affect other projects on the user's workstation/server
cat <<EOF
This command has been deprecated, and at the moment does not do anything.
If you'd like to build without cache, use the command './acore.sh docker build:nocache' or look into the 'docker buildx prune command'
> https://docs.docker.com/engine/reference/commandline/buildx_prune/
EOF
set +x
shift
;;
client-data)
set -x
docker compose up ac-client-data-init
set +x
shift
;;
dev:up)
set -x
docker compose --profile dev up ac-dev-server -d
set +x
shift
;;
dev:build)
set -x
docker compose --profile dev run --rm ac-dev-server bash /azerothcore/acore.sh compiler build
set +x
shift
;;
dev:dash)
set -x
docker compose --profile dev run --rm ac-dev-server bash /azerothcore/acore.sh ${@:2}
set +x
shift
;;
dev:shell)
set -x
docker compose --profile dev up -d ac-dev-server
docker compose --profile dev exec ac-dev-server bash ${@:2}
set +x
shift
;;
build:prod|prod:build)
cat <<EOF
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
./acore.sh docker build
The build will continue in 3 seconds
EOF
sleep 3
set -x
docker compose build
set +x
shift
;;
pull:prod|prod:pull)
cat <<EOF
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
./acore.sh docker pull
The image pull will continue in 3 seconds
EOF
sleep 3
set -x
docker compose pull
set +x
shift
;;
prod:up|start:prod)
cat <<EOF
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
./acore.sh docker start:app
The containers will start in 3 seconds
EOF
sleep 3
set -x
docker compose up
set +x
shift
;;
prod:up:d|start:prod:d)
cat <<EOF
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
./acore.sh docker start:app:d
The containers will start in 3 seconds
EOF
sleep 3
set -x
docker compose up -d
set +x
shift
;;
attach)
SERVICE="$2"
set -x
docker compose attach "$SERVICE"
set +x
shift
shift # Second to pass the argument
;;
*)
echo "Unknown or empty arg"
usage
exit 1
esac
done

54
apps/docker/entrypoint.sh Normal file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
CONF_DIR="${CONF_DIR:-/azerothcore/env/dist/etc}"
LOGS_DIR="${LOGS_DIR:-/azerothcore/env/dist/logs}"
if ! touch "$CONF_DIR/.write-test" || ! touch "$LOGS_DIR/.write-test"; then
cat <<EOF
===== WARNING =====
The current user doesn't have write permissions for
the configuration dir ($CONF_DIR) or logs dir ($LOGS_DIR).
It's likely that services will fail due to this.
This is usually caused by cloning the repository as root,
so the files are owned by root (uid 0).
To resolve this, you can set the ownership of the
configuration directory with the command on the host machine.
Note that if the files are owned as root, the ownership must
be changed as root (hence sudo).
$ sudo chown -R $(id -u):$(id -g) /path/to$CONF_DIR /path/to$LOGS_DIR
Alternatively, you can set the DOCKER_USER environment
variable (on the host machine) to "root", though this
isn't recommended.
$ DOCKER_USER=root docker-compose up -d
====================
EOF
fi
[[ -f "$CONF_DIR/.write-test" ]] && rm -f "$CONF_DIR/.write-test"
[[ -f "$LOGS_DIR/.write-test" ]] && rm -f "$LOGS_DIR/.write-test"
# Copy all default config files to env/dist/etc if they don't already exist
# -r == recursive
# -n == no clobber (don't overwrite)
# -v == be verbose
cp -rnv /azerothcore/env/ref/etc/* "$CONF_DIR"
CONF="$CONF_DIR/$ACORE_COMPONENT.conf"
CONF_DIST="$CONF_DIR/$ACORE_COMPONENT.conf.dist"
# Copy the "dist" file to the "conf" if the conf doesn't already exist
if [[ -f "$CONF_DIST" ]]; then
cp -vn "$CONF_DIST" "$CONF"
else
touch "$CONF"
fi
echo "Starting $ACORE_COMPONENT..."
exec "$@"