cleanup: Update paths and builds

This commit is contained in:
uprightbass360
2025-10-24 22:49:44 -04:00
parent f42ab00a31
commit d8696d2ab4
13 changed files with 261 additions and 86 deletions

View File

@@ -1,5 +1,5 @@
# Copy this file to .env and adjust values for your environment. # Copy this file to .env and adjust values for your environment.
# Docker Compose will auto-load .env in the same folder as compose.yml. # Docker Compose will auto-load .env in the same folder as docker-compose.yml.
# Template for acore-compose profiles-based compose # Template for acore-compose profiles-based compose
# Project name # Project name
@@ -9,6 +9,7 @@ COMPOSE_PROJECT_NAME=acore-compose
# Storage & Timezone # Storage & Timezone
# ===================== # =====================
STORAGE_PATH=./storage STORAGE_PATH=./storage
STORAGE_PATH_LOCAL=./local-storage
HOST_ZONEINFO_PATH=/usr/share/zoneinfo HOST_ZONEINFO_PATH=/usr/share/zoneinfo
TZ=UTC TZ=UTC
@@ -57,7 +58,7 @@ AC_WORLDSERVER_IMAGE_PLAYERBOTS=uprightbass360/azerothcore-wotlk-playerbots:worl
AC_CLIENT_DATA_IMAGE=acore/ac-wotlk-client-data:14.0.0-dev AC_CLIENT_DATA_IMAGE=acore/ac-wotlk-client-data:14.0.0-dev
AC_CLIENT_DATA_IMAGE_PLAYERBOTS=uprightbass360/azerothcore-wotlk-playerbots:client-data-Playerbot AC_CLIENT_DATA_IMAGE_PLAYERBOTS=uprightbass360/azerothcore-wotlk-playerbots:client-data-Playerbot
CLIENT_DATA_VERSION=v17 CLIENT_DATA_VERSION=v17
CLIENT_DATA_CACHE_PATH=./client-data-cache CLIENT_DATA_CACHE_PATH=${STORAGE_PATH_LOCAL:-./local-storage}/client-data-cache
CLIENT_DATA_VOLUME=ac-client-data CLIENT_DATA_VOLUME=ac-client-data
# ===================== # =====================
@@ -81,14 +82,8 @@ REALM_PORT=8215
# ===================== # =====================
PLAYERBOT_ENABLED=0 PLAYERBOT_ENABLED=0
PLAYERBOT_MAX_BOTS=40 PLAYERBOT_MAX_BOTS=40
# =====================
# Git for ac-modules (optional)
# =====================
# Playerbot runtime flags
PLAYERBOT_ENABLED=0 PLAYERBOT_ENABLED=0
PLAYERBOT_MAX_BOTS=40 PLAYERBOT_MAX_BOTS=1000
# ===================== # =====================
# Module toggles (0/1) # Module toggles (0/1)
@@ -153,7 +148,7 @@ MODULE_BLACK_MARKET_AUCTION_HOUSE=0
# ===================== # =====================
AUTO_REBUILD_ON_DEPLOY=0 AUTO_REBUILD_ON_DEPLOY=0
# Default AzerothCore source checkout used for module rebuilds # Default AzerothCore source checkout used for module rebuilds
MODULES_REBUILD_SOURCE_PATH=./source/azerothcore MODULES_REBUILD_SOURCE_PATH=${STORAGE_PATH_LOCAL:-./local-storage}/source/azerothcore
# ===================== # =====================
# Eluna runtime (worldserver.conf overrides) # Eluna runtime (worldserver.conf overrides)

2
.gitignore vendored
View File

@@ -7,6 +7,7 @@ source/*
local-data-tools/ local-data-tools/
storage/ storage/
source/ source/
local-storage/
.claude/ .claude/
images/ images/
node_modules/ node_modules/
@@ -14,4 +15,3 @@ node_modules/
.env .env
package-lock.json package-lock.json
package.json package.json

View File

@@ -237,7 +237,7 @@ Use this workflow to build locally, then push the same stack to a remote host:
--user sam \ --user sam \
--project-dir /home/sam/src/acore-compose --project-dir /home/sam/src/acore-compose
``` ```
(Exports rebuilt images to `images/acore-modules-images.tar`, including both `acore/...:modules-latest` and `uprightbass360/...:Playerbot` tags, then syncs `storage/` unless `--skip-storage` is provided.) (Exports rebuilt images to `local-storage/images/acore-modules-images.tar`, including both `acore/...:modules-latest` and `uprightbass360/...:Playerbot` tags, then syncs `storage/` unless `--skip-storage` is provided.)
3. **Deploy on Remote Host** 3. **Deploy on Remote Host**
```bash ```bash
ssh docker-server ' ssh docker-server '
@@ -328,7 +328,7 @@ storage/
└── backups/ # Automated database backups └── backups/ # Automated database backups
``` ```
`ac-client-data` keeps unpacked game assets in the `${CLIENT_DATA_VOLUME:-ac-client-data}` Docker volume so reads stay on the local host, while download archives are cached under `${CLIENT_DATA_CACHE_PATH:-./client-data-cache}` on fast local storage even when `${STORAGE_PATH}` points to remote or NFS storage. `ac-client-data` keeps unpacked game assets in the `${CLIENT_DATA_VOLUME:-ac-client-data}` Docker volume so reads stay on the local host, while download archives are cached under `${CLIENT_DATA_CACHE_PATH}` on fast local storage even when `${STORAGE_PATH}` points to remote or NFS storage.
--- ---
@@ -712,7 +712,7 @@ docker logs ac-db-import
docker logs ac-modules | grep -A20 -B5 "rebuild" docker logs ac-modules | grep -A20 -B5 "rebuild"
# Verify source path exists # Verify source path exists
ls -la ./source/azerothcore/ ls -la "${STORAGE_PATH_LOCAL:-./local-storage}/source/azerothcore/"
# Force source setup # Force source setup
./scripts/setup-source.sh ./scripts/setup-source.sh

View File

@@ -11,7 +11,7 @@ set -e
# Resolve project dir and compose # Resolve project dir and compose
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="${SCRIPT_DIR}" PROJECT_DIR="${SCRIPT_DIR}"
COMPOSE_FILE="${PROJECT_DIR}/compose.yml" COMPOSE_FILE="${PROJECT_DIR}/docker-compose.yml"
ENV_FILE="${PROJECT_DIR}/.env" ENV_FILE="${PROJECT_DIR}/.env"
# Colors # Colors
@@ -120,10 +120,12 @@ show_resources() {
# Load env for STORAGE_PATH etc. # Load env for STORAGE_PATH etc.
STORAGE_PATH_DEFAULT="${PROJECT_DIR}/storage" STORAGE_PATH_DEFAULT="${PROJECT_DIR}/storage"
STORAGE_PATH_LOCAL_DEFAULT="${PROJECT_DIR}/local-storage"
if [ -f "$ENV_FILE" ]; then if [ -f "$ENV_FILE" ]; then
set -a; source "$ENV_FILE"; set +a set -a; source "$ENV_FILE"; set +a
fi fi
STORAGE_PATH="${STORAGE_PATH:-$STORAGE_PATH_DEFAULT}" STORAGE_PATH="${STORAGE_PATH:-$STORAGE_PATH_DEFAULT}"
STORAGE_PATH_LOCAL="${STORAGE_PATH_LOCAL:-$STORAGE_PATH_LOCAL_DEFAULT}"
PROJECT_NAME="${COMPOSE_PROJECT_NAME:-ac-compose}" PROJECT_NAME="${COMPOSE_PROJECT_NAME:-ac-compose}"
remove_storage_dir(){ remove_storage_dir(){
@@ -211,13 +213,15 @@ nuclear_cleanup() {
if [ -d "${STORAGE_PATH}/backups" ]; then if [ -d "${STORAGE_PATH}/backups" ]; then
execute_command "Staging backups" "mkdir -p '${TMP_PRESERVE}' && cp -a '${STORAGE_PATH}/backups' '${TMP_PRESERVE}/'" execute_command "Staging backups" "mkdir -p '${TMP_PRESERVE}' && cp -a '${STORAGE_PATH}/backups' '${TMP_PRESERVE}/'"
fi fi
execute_command "Removing storage" "remove_storage_dir '${STORAGE_PATH}'" execute_command "Removing main storage" "remove_storage_dir '${STORAGE_PATH}'"
execute_command "Removing local storage" "remove_storage_dir '${STORAGE_PATH_LOCAL}'"
if [ -d "${TMP_PRESERVE}/backups" ]; then if [ -d "${TMP_PRESERVE}/backups" ]; then
execute_command "Restoring backups" "mkdir -p '${STORAGE_PATH}' && mv '${TMP_PRESERVE}/backups' '${STORAGE_PATH}/backups' && rm -rf '${TMP_PRESERVE}'" execute_command "Restoring backups" "mkdir -p '${STORAGE_PATH}' && mv '${TMP_PRESERVE}/backups' '${STORAGE_PATH}/backups' && rm -rf '${TMP_PRESERVE}'"
print_status SUCCESS "Backups preserved at ${STORAGE_PATH}/backups" print_status SUCCESS "Backups preserved at ${STORAGE_PATH}/backups"
fi fi
else else
execute_command "Removing storage and local backups" "remove_storage_dir '${STORAGE_PATH}'; remove_storage_dir '${PROJECT_DIR}/backups'" execute_command "Removing main storage and backups" "remove_storage_dir '${STORAGE_PATH}'; remove_storage_dir '${PROJECT_DIR}/backups'"
execute_command "Removing local storage" "remove_storage_dir '${STORAGE_PATH_LOCAL}'"
fi fi
# Optional system prune for project context # Optional system prune for project context

View File

@@ -9,7 +9,7 @@
set -euo pipefail set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
COMPOSE_FILE="$ROOT_DIR/compose.yml" COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
ENV_PATH="$ROOT_DIR/.env" ENV_PATH="$ROOT_DIR/.env"
TARGET_PROFILE="" TARGET_PROFILE=""
WATCH_LOGS=1 WATCH_LOGS=1
@@ -111,9 +111,13 @@ compose(){
ensure_source_repo(){ ensure_source_repo(){
local module_playerbots local module_playerbots
module_playerbots="$(read_env MODULE_PLAYERBOTS "0")" module_playerbots="$(read_env MODULE_PLAYERBOTS "0")"
local default_source="./source/azerothcore" local local_root
local_root="$(read_env STORAGE_PATH_LOCAL "./local-storage")"
local_root="${local_root%/}"
[ -z "$local_root" ] && local_root="."
local default_source="${local_root}/source/azerothcore"
if [ "$module_playerbots" = "1" ]; then if [ "$module_playerbots" = "1" ]; then
default_source="./source/azerothcore-playerbots" default_source="${local_root}/source/azerothcore-playerbots"
fi fi
local src_path local src_path

View File

@@ -183,7 +183,7 @@ services:
user: "0:0" user: "0:0"
volumes: volumes:
- ac-client-data:/azerothcore/data - ac-client-data:/azerothcore/data
- ${CLIENT_DATA_CACHE_PATH:-./client-data-cache}:/cache - ${CLIENT_DATA_CACHE_PATH:-${STORAGE_PATH_LOCAL:-./local-storage}/client-data-cache}:/cache
- ./scripts:/tmp/scripts:ro - ./scripts:/tmp/scripts:ro
working_dir: /tmp working_dir: /tmp
environment: environment:
@@ -218,7 +218,7 @@ services:
user: "0:0" user: "0:0"
volumes: volumes:
- ac-client-data:/azerothcore/data - ac-client-data:/azerothcore/data
- ${CLIENT_DATA_CACHE_PATH:-./client-data-cache}:/cache - ${CLIENT_DATA_CACHE_PATH:-${STORAGE_PATH_LOCAL:-./local-storage}/client-data-cache}:/cache
- ./scripts:/tmp/scripts:ro - ./scripts:/tmp/scripts:ro
working_dir: /tmp working_dir: /tmp
environment: environment:

View File

@@ -5,7 +5,7 @@
set -euo pipefail set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.." ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
COMPOSE_FILE="$ROOT_DIR/compose.yml" COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
ENV_FILE="$ROOT_DIR/.env" ENV_FILE="$ROOT_DIR/.env"
BLUE='\033[0;34m' BLUE='\033[0;34m'

View File

@@ -8,15 +8,13 @@ git config --global user.email "${GIT_EMAIL:-noreply@azerothcore.org}"
# PAT not needed for public repositories # PAT not needed for public repositories
echo 'Initializing module management...' echo 'Initializing module management...'
if [ "$MODULES_LOCAL_RUN" != "1" ]; then
cd /modules cd /modules
fi
echo 'Cleaning up disabled modules...' echo 'Cleaning up disabled modules...'
# Remove modules if disabled # Playerbots are integrated into the source - no separate module to remove
if [ "$MODULE_PLAYERBOTS" != "1" ] && [ -d "mod-playerbots" ]; then
echo 'Removing mod-playerbots (disabled)...'
rm -rf mod-playerbots
fi
if [ "$MODULE_AOE_LOOT" != "1" ] && [ -d "mod-aoe-loot" ]; then if [ "$MODULE_AOE_LOOT" != "1" ] && [ -d "mod-aoe-loot" ]; then
echo 'Removing mod-aoe-loot (disabled)...' echo 'Removing mod-aoe-loot (disabled)...'
@@ -227,15 +225,14 @@ fi
echo 'Installing enabled modules...' echo 'Installing enabled modules...'
# Install Playerbots if enabled # Playerbots handling - integrated into custom AzerothCore branch
if [ "$MODULE_PLAYERBOTS" = "1" ] && [ ! -d "mod-playerbots" ]; then if [ "$MODULE_PLAYERBOTS" = "1" ]; then
echo '🤖 Installing mod-playerbots...' echo '🤖 Playerbots module enabled...'
echo ' 📖 Project: https://github.com/uprightbass360/mod-playerbots' echo ' 📖 Playerbots are integrated into the uprightbass360/azerothcore-wotlk-playerbots source'
echo ' 🚨 CRITICAL: REQUIRES Custom AzerothCore branch (uprightbass360/azerothcore-wotlk-playerbots/tree/Playerbot)' echo ' No separate module repository needed - functionality built into core'
echo ' 🚨 INCOMPATIBLE with standard AzerothCore - module will not function properly' echo ' 🔧 REBUILD REQUIRED: Container must be rebuilt with playerbots source'
echo ' 🔧 REBUILD REQUIRED: Container must be rebuilt with source-based compilation'
echo ' 📋 POST-INSTALL: Requires manual account/character configuration' echo ' 📋 POST-INSTALL: Requires manual account/character configuration'
git clone https://github.com/uprightbass360/mod-playerbots.git mod-playerbots # No git clone needed - playerbots are integrated into the source tree
fi fi
# Install AOE Loot if enabled # Install AOE Loot if enabled
@@ -707,7 +704,11 @@ fi
# Module state tracking and rebuild logic # Module state tracking and rebuild logic
echo 'Checking for module changes that require rebuild...' echo 'Checking for module changes that require rebuild...'
if [ "$MODULES_LOCAL_RUN" = "1" ]; then
MODULES_STATE_FILE="./.modules_state"
else
MODULES_STATE_FILE="/modules/.modules_state" MODULES_STATE_FILE="/modules/.modules_state"
fi
CURRENT_STATE="" CURRENT_STATE=""
REBUILD_REQUIRED=0 REBUILD_REQUIRED=0
@@ -804,7 +805,11 @@ fi
echo 'Module management complete.' echo 'Module management complete.'
if [ "$MODULES_LOCAL_RUN" = "1" ]; then
REBUILD_SENTINEL="./.requires_rebuild"
else
REBUILD_SENTINEL="/modules/.requires_rebuild" REBUILD_SENTINEL="/modules/.requires_rebuild"
fi
if [ "$SQL_EXECUTION_FAILED" = "1" ]; then if [ "$SQL_EXECUTION_FAILED" = "1" ]; then
echo "⚠️ SQL execution encountered issues; review logs above." echo "⚠️ SQL execution encountered issues; review logs above."
fi fi

View File

@@ -15,7 +15,7 @@ Options:
--port PORT SSH port (default: 22) --port PORT SSH port (default: 22)
--identity PATH SSH private key (passed to scp/ssh) --identity PATH SSH private key (passed to scp/ssh)
--project-dir DIR Remote project directory (default: ~/acore-compose) --project-dir DIR Remote project directory (default: ~/acore-compose)
--tarball PATH Output path for the image tar (default: ./images/acore-modules-images.tar) --tarball PATH Output path for the image tar (default: ./local-storage/images/acore-modules-images.tar)
--storage PATH Remote storage directory (default: <project-dir>/storage) --storage PATH Remote storage directory (default: <project-dir>/storage)
--skip-storage Do not sync the storage directory --skip-storage Do not sync the storage directory
--help Show this help --help Show this help
@@ -54,7 +54,10 @@ fi
PROJECT_DIR="${PROJECT_DIR:-/home/${USER}/acore-compose}" PROJECT_DIR="${PROJECT_DIR:-/home/${USER}/acore-compose}"
REMOTE_STORAGE="${REMOTE_STORAGE:-${PROJECT_DIR}/storage}" REMOTE_STORAGE="${REMOTE_STORAGE:-${PROJECT_DIR}/storage}"
TARBALL="${TARBALL:-$(pwd)/images/acore-modules-images.tar}" LOCAL_STORAGE_ROOT="${STORAGE_PATH_LOCAL:-./local-storage}"
LOCAL_STORAGE_ROOT="${LOCAL_STORAGE_ROOT%/}"
[ -z "$LOCAL_STORAGE_ROOT" ] && LOCAL_STORAGE_ROOT="."
TARBALL="${TARBALL:-${LOCAL_STORAGE_ROOT}/images/acore-modules-images.tar}"
SCP_OPTS=(-P "$PORT") SCP_OPTS=(-P "$PORT")
SSH_OPTS=(-p "$PORT") SSH_OPTS=(-p "$PORT")

View File

@@ -35,6 +35,9 @@ read_env(){
if [ -f "$env_path" ]; then if [ -f "$env_path" ]; then
value="$(grep -E "^${key}=" "$env_path" | tail -n1 | cut -d'=' -f2- | tr -d '\r')" value="$(grep -E "^${key}=" "$env_path" | tail -n1 | cut -d'=' -f2- | tr -d '\r')"
fi fi
if [ -z "$value" ]; then
value="${!key:-}"
fi
if [ -z "$value" ]; then if [ -z "$value" ]; then
value="$default" value="$default"
fi fi
@@ -44,10 +47,16 @@ read_env(){
default_source_path(){ default_source_path(){
local module_playerbots local module_playerbots
module_playerbots="$(read_env MODULE_PLAYERBOTS "0")" module_playerbots="$(read_env MODULE_PLAYERBOTS "0")"
local local_root
local_root="$(read_env STORAGE_PATH_LOCAL "./local-storage")"
local_root="${local_root%/}"
if [[ -z "$local_root" ]]; then
local_root="."
fi
if [ "$module_playerbots" = "1" ]; then if [ "$module_playerbots" = "1" ]; then
echo "./source/azerothcore-playerbots" echo "${local_root}/source/azerothcore-playerbots"
else else
echo "./source/azerothcore" echo "${local_root}/source/azerothcore"
fi fi
} }
@@ -125,6 +134,20 @@ fi
REBUILD_SOURCE_PATH="$(realpath "$REBUILD_SOURCE_PATH" 2>/dev/null || echo "$REBUILD_SOURCE_PATH")" REBUILD_SOURCE_PATH="$(realpath "$REBUILD_SOURCE_PATH" 2>/dev/null || echo "$REBUILD_SOURCE_PATH")"
# Check for modules in source directory first, then fall back to shared storage
LOCAL_MODULES_DIR="$REBUILD_SOURCE_PATH/modules"
SHARED_MODULES_DIR="$STORAGE_PATH/modules"
if [ -d "$LOCAL_MODULES_DIR" ]; then
echo "🔧 Using modules from source directory: $LOCAL_MODULES_DIR"
MODULES_DIR="$LOCAL_MODULES_DIR"
SENTINEL_FILE="$LOCAL_MODULES_DIR/.requires_rebuild"
else
echo "🔧 Using modules from shared storage: $SHARED_MODULES_DIR"
MODULES_DIR="$SHARED_MODULES_DIR"
SENTINEL_FILE="$SHARED_MODULES_DIR/.requires_rebuild"
fi
SOURCE_COMPOSE="$REBUILD_SOURCE_PATH/docker-compose.yml" SOURCE_COMPOSE="$REBUILD_SOURCE_PATH/docker-compose.yml"
if [ ! -f "$SOURCE_COMPOSE" ]; then if [ ! -f "$SOURCE_COMPOSE" ]; then
echo "❌ Source docker-compose.yml not found at $SOURCE_COMPOSE" echo "❌ Source docker-compose.yml not found at $SOURCE_COMPOSE"

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# ac-compose source repository setup # ac-compose source repository setup
set -e set -euo pipefail
echo '🔧 Setting up AzerothCore source repository...' echo '🔧 Setting up AzerothCore source repository...'
@@ -14,8 +14,9 @@ PROJECT_ROOT="$(pwd)"
# Default values # Default values
MODULE_PLAYERBOTS="${MODULE_PLAYERBOTS:-0}" MODULE_PLAYERBOTS="${MODULE_PLAYERBOTS:-0}"
DEFAULT_STANDARD_PATH="./source/azerothcore" LOCAL_STORAGE_ROOT="${STORAGE_PATH_LOCAL:-./local-storage}"
DEFAULT_PLAYERBOTS_PATH="./source/azerothcore-playerbots" DEFAULT_STANDARD_PATH="${LOCAL_STORAGE_ROOT%/}/source/azerothcore"
DEFAULT_PLAYERBOTS_PATH="${LOCAL_STORAGE_ROOT%/}/source/azerothcore-playerbots"
SOURCE_PATH_DEFAULT="$DEFAULT_STANDARD_PATH" SOURCE_PATH_DEFAULT="$DEFAULT_STANDARD_PATH"
if [ "$MODULE_PLAYERBOTS" = "1" ]; then if [ "$MODULE_PLAYERBOTS" = "1" ]; then
@@ -30,7 +31,11 @@ else
STORAGE_PATH_ABS="$STORAGE_PATH_VALUE" STORAGE_PATH_ABS="$STORAGE_PATH_VALUE"
fi fi
if [[ "$SOURCE_PATH_DEFAULT" != /* ]]; then
DEFAULT_SOURCE_ABS="$PROJECT_ROOT/${SOURCE_PATH_DEFAULT#./}" DEFAULT_SOURCE_ABS="$PROJECT_ROOT/${SOURCE_PATH_DEFAULT#./}"
else
DEFAULT_SOURCE_ABS="$SOURCE_PATH_DEFAULT"
fi
# Convert to absolute path if relative and ensure we stay local # Convert to absolute path if relative and ensure we stay local
if [[ "$SOURCE_PATH" != /* ]]; then if [[ "$SOURCE_PATH" != /* ]]; then
@@ -62,7 +67,8 @@ echo "📍 Repository: $REPO_URL"
echo "🌿 Branch: $BRANCH" echo "🌿 Branch: $BRANCH"
echo "📂 Source path: $SOURCE_PATH" echo "📂 Source path: $SOURCE_PATH"
# Create source directory if it doesn't exist # Ensure destination directories exist
echo "📂 Preparing local workspace at $(dirname "$SOURCE_PATH")"
mkdir -p "$(dirname "$SOURCE_PATH")" mkdir -p "$(dirname "$SOURCE_PATH")"
# Clone or update repository # Clone or update repository
@@ -76,20 +82,21 @@ if [ -d "$SOURCE_PATH/.git" ]; then
echo "🔄 Repository URL changed, re-cloning..." echo "🔄 Repository URL changed, re-cloning..."
cd .. cd ..
rm -rf "$(basename "$SOURCE_PATH")" rm -rf "$(basename "$SOURCE_PATH")"
git clone "$REPO_URL" "$(basename "$SOURCE_PATH")" echo "⏳ Cloning $REPO_URL (branch $BRANCH) into $(basename "$SOURCE_PATH")"
git clone -b "$BRANCH" "$REPO_URL" "$(basename "$SOURCE_PATH")"
cd "$(basename "$SOURCE_PATH")" cd "$(basename "$SOURCE_PATH")"
fi else
echo "🔄 Fetching latest changes from origin..."
# Fetch latest changes git fetch origin --progress
git fetch origin echo "🔀 Switching to branch $BRANCH..."
# Switch to target branch
git checkout "$BRANCH" git checkout "$BRANCH"
git pull origin "$BRANCH" echo "⬇️ Pulling latest commits..."
git pull --ff-only origin "$BRANCH"
echo "✅ Repository updated to latest $BRANCH" echo "✅ Repository updated to latest $BRANCH"
fi
else else
echo "📥 Cloning repository..." echo "📥 Cloning repository..."
echo "⏳ Cloning $REPO_URL (branch $BRANCH) into $SOURCE_PATH"
git clone -b "$BRANCH" "$REPO_URL" "$SOURCE_PATH" git clone -b "$BRANCH" "$REPO_URL" "$SOURCE_PATH"
echo "✅ Repository cloned successfully" echo "✅ Repository cloned successfully"
fi fi

160
setup.sh
View File

@@ -92,6 +92,62 @@ normalize_module_name(){
declare -A MODULE_ENABLE_SET=() declare -A MODULE_ENABLE_SET=()
declare -a COMPOSE_CMD=()
resolve_compose_command(){
if [ ${#COMPOSE_CMD[@]} -gt 0 ]; then
return 0
fi
if command -v docker >/dev/null 2>&1; then
if docker compose version >/dev/null 2>&1; then
COMPOSE_CMD=(docker compose)
return 0
fi
fi
if command -v docker-compose >/dev/null 2>&1; then
COMPOSE_CMD=(docker-compose)
return 0
fi
COMPOSE_CMD=()
return 1
}
modules_directory_has_content(){
local dir="$1"
[ -d "$dir" ] || return 1
local first_entry
first_entry="$(find "$dir" -mindepth 1 -maxdepth 1 -type d -print -quit 2>/dev/null)"
[ -n "$first_entry" ]
}
ensure_modules_staged(){
local storage_abs="$1" needs_cxx="$2" run_now="$3"
if [ "$needs_cxx" != "1" ] || [ "$run_now" != "1" ]; then
return 0
fi
local modules_dir="${storage_abs}/modules"
local config_dir="${storage_abs}/config"
mkdir -p "$modules_dir" "$config_dir"
if modules_directory_has_content "$modules_dir"; then
return 0
fi
if ! resolve_compose_command; then
say WARNING "Docker Compose not detected; skipping automatic module staging."
return 1
fi
say INFO "Staging module repositories via ${COMPOSE_CMD[*]} run --rm --no-deps ac-modules"
if ! "${COMPOSE_CMD[@]}" --profile modules run --rm --no-deps ac-modules; then
say WARNING "Module staging failed; repositories may be incomplete."
return 1
fi
return 0
}
KNOWN_MODULE_VARS=( KNOWN_MODULE_VARS=(
MODULE_PLAYERBOTS MODULE_PLAYERBOTS
MODULE_AOE_LOOT MODULE_AOE_LOOT
@@ -169,11 +225,36 @@ DEFAULT_PRESET_SUGGESTED="suggested-modules"
DEFAULT_PRESET_PLAYERBOTS="playerbots-suggested-modules" DEFAULT_PRESET_PLAYERBOTS="playerbots-suggested-modules"
show_wow_header() { show_wow_header() {
echo -e "\n${BLUE} ⚔️ AZEROTHCORE DEPLOYMENT SYSTEM ⚔️${NC}" clear
echo -e "${BLUE} ═══════════════════════════════════════${NC}" echo -e "${RED}"
echo -e "${BLUE} 🏰 Build Your Own WoW Server 🏰${NC}\n" cat <<'EOF'
db 888888888888 88888888888 88888888ba ,ad8888ba, 888888888888 88 88 ,ad8888ba, ,ad8888ba, 88888888ba 88888888888
d88b ,88 88 88 "8b d8"' `"8b 88 88 88 d8"' `"8b d8"' `"8b 88 "8b 88
d8'`8b ,88" 88 88 ,8P d8' `8b 88 88 88 d8' d8' `8b 88 ,8P 88
d8' `8b ,88" 88aaaaa 88aaaaaa8P' 88 88 88 88aaaaaaaa88 88 88 88 88aaaaaa8P' 88aaaaa
d8YaaaaY8b ,88" 88""""" 88""""88' 88 88 88 88""""""""88 88 88 88 88""""88' 88"""""
d8""""""""8b ,88" 88 88 `8b Y8, ,8P 88 88 88 Y8, Y8, ,8P 88 `8b 88
d8' `8b 88" 88 88 `8b Y8a. .a8P 88 88 88 Y8a. .a8P Y8a. .a8P 88 `8b 88
d8' `8b 888888888888 88888888888 88 `8b `"Y8888Y"' 88 88 88 `"Y8888Y"' `"Y8888Y"' 88 `8b 88888888888
___ ___ ___ ___ ___ ___ ___ ___ ___ ___
.'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``. .'`~ ``.
)`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ ( )`_ ._ (
|(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)| |(_/^\_)|
`-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-' `-.`''.-'
""" """ """ """ """ """ """ """ """ """
.')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`. .')'=.'_`.='(`.
:| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |: :| -.._H_,.- |:
|: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :| |: -.__H__.- :|
<' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `> <' `--V--' `>
art: littlebitspace@https://littlebitspace.com/
EOF
echo -e "${NC}"
} }
show_realm_configured(){ show_realm_configured(){
echo -e "\n${GREEN}⚔️ Your realm configuration has been forged! ⚔️${NC}" echo -e "\n${GREEN}⚔️ Your realm configuration has been forged! ⚔️${NC}"
echo -e "${GREEN}🏰 Ready to deploy your World of Warcraft server${NC}" echo -e "${GREEN}🏰 Ready to deploy your World of Warcraft server${NC}"
@@ -437,9 +518,9 @@ EOF
# Deployment type # Deployment type
say HEADER "DEPLOYMENT TYPE" say HEADER "DEPLOYMENT TYPE"
echo "1) 🏠 Local Development (127.0.0.1, local storage)" echo "1) 🏠 Local Development (127.0.0.1)"
echo "2) 🌐 LAN Server (local network IP)" echo "2) 🌐 LAN Server (local network IP) (autodetect)"
echo "3) ☁️ Public Server (domain or public IP)" echo "3) ☁️ Public Server (domain or public IP) (manual)"
local DEPLOYMENT_TYPE_INPUT="${CLI_DEPLOYMENT_TYPE}" local DEPLOYMENT_TYPE_INPUT="${CLI_DEPLOYMENT_TYPE}"
local DEPLOYMENT_TYPE="" local DEPLOYMENT_TYPE=""
if [ "$NON_INTERACTIVE" = "1" ] && [ -z "$DEPLOYMENT_TYPE_INPUT" ]; then if [ "$NON_INTERACTIVE" = "1" ] && [ -z "$DEPLOYMENT_TYPE_INPUT" ]; then
@@ -498,8 +579,8 @@ fi
# Permission scheme # Permission scheme
say HEADER "PERMISSION SCHEME" say HEADER "PERMISSION SCHEME"
echo "1) 🏠 Local Dev (0:0)" echo "1) 🏠 Local Root (0:0)"
echo "2) 🗂️ NFS Server (1001:1000)" echo "2) 🗂️ User (1001:1000)"
echo "3) ⚙️ Custom" echo "3) ⚙️ Custom"
local PERMISSION_SCHEME_INPUT="${CLI_PERMISSION_SCHEME}" local PERMISSION_SCHEME_INPUT="${CLI_PERMISSION_SCHEME}"
local PERMISSION_SCHEME_NAME="" local PERMISSION_SCHEME_NAME=""
@@ -889,6 +970,17 @@ fi
printf " %-18s detected (source rebuild required)\n" "C++ modules:" printf " %-18s detected (source rebuild required)\n" "C++ modules:"
fi fi
local LOCAL_STORAGE_ROOT="${STORAGE_PATH_LOCAL:-./local-storage}"
LOCAL_STORAGE_ROOT="${LOCAL_STORAGE_ROOT%/}"
[ -z "$LOCAL_STORAGE_ROOT" ] && LOCAL_STORAGE_ROOT="."
STORAGE_PATH_LOCAL="$LOCAL_STORAGE_ROOT"
export STORAGE_PATH STORAGE_PATH_LOCAL
local module_export_var
for module_export_var in "${KNOWN_MODULE_VARS[@]}"; do
export "$module_export_var"
done
if [ "$NEEDS_CXX_REBUILD" = "1" ]; then if [ "$NEEDS_CXX_REBUILD" = "1" ]; then
echo "" echo ""
say WARNING "These modules require compiling AzerothCore from source." say WARNING "These modules require compiling AzerothCore from source."
@@ -905,18 +997,18 @@ fi
if [ "$RUN_REBUILD_NOW" = "1" ] || [ "$AUTO_REBUILD_ON_DEPLOY" = "1" ]; then if [ "$RUN_REBUILD_NOW" = "1" ] || [ "$AUTO_REBUILD_ON_DEPLOY" = "1" ]; then
if [ -z "$MODULES_REBUILD_SOURCE_PATH_VALUE" ]; then if [ -z "$MODULES_REBUILD_SOURCE_PATH_VALUE" ]; then
if [ "$MODULE_PLAYERBOTS" = "1" ]; then if [ "$MODULE_PLAYERBOTS" = "1" ]; then
MODULES_REBUILD_SOURCE_PATH_VALUE="./source/azerothcore-playerbots" MODULES_REBUILD_SOURCE_PATH_VALUE="${LOCAL_STORAGE_ROOT}/source/azerothcore-playerbots"
else else
MODULES_REBUILD_SOURCE_PATH_VALUE="./source/azerothcore" MODULES_REBUILD_SOURCE_PATH_VALUE="${LOCAL_STORAGE_ROOT}/source/azerothcore"
fi fi
say INFO "Using default source path: ${MODULES_REBUILD_SOURCE_PATH_VALUE}" say INFO "Using default source path: ${MODULES_REBUILD_SOURCE_PATH_VALUE}"
fi fi
fi fi
fi fi
local default_source_rel="./source/azerothcore" local default_source_rel="${LOCAL_STORAGE_ROOT}/source/azerothcore"
if [ "$MODULE_PLAYERBOTS" = "1" ]; then if [ "$MODULE_PLAYERBOTS" = "1" ]; then
default_source_rel="./source/azerothcore-playerbots" default_source_rel="${LOCAL_STORAGE_ROOT}/source/azerothcore-playerbots"
fi fi
if [ -n "$MODULES_REBUILD_SOURCE_PATH_VALUE" ]; then if [ -n "$MODULES_REBUILD_SOURCE_PATH_VALUE" ]; then
@@ -934,11 +1026,15 @@ fi
fi fi
fi fi
# Module staging will be handled directly in the rebuild section below
if [ "$RUN_REBUILD_NOW" = "1" ]; then if [ "$RUN_REBUILD_NOW" = "1" ]; then
local default_source_path="$default_source_rel" local default_source_path="$default_source_rel"
local rebuild_source_path="${MODULES_REBUILD_SOURCE_PATH_VALUE:-$default_source_path}" local rebuild_source_path="${MODULES_REBUILD_SOURCE_PATH_VALUE:-$default_source_path}"
MODULES_REBUILD_SOURCE_PATH_VALUE="$rebuild_source_path"
export MODULES_REBUILD_SOURCE_PATH="$MODULES_REBUILD_SOURCE_PATH_VALUE"
if [ ! -f "$rebuild_source_path/docker-compose.yml" ]; then if [ ! -f "$rebuild_source_path/docker-compose.yml" ]; then
say INFO "Preparing source repository via scripts/setup-source.sh" say INFO "Preparing source repository via scripts/setup-source.sh (git clone/fetch can take a few minutes)"
if ! ./scripts/setup-source.sh >/dev/null 2>&1; then if ! ./scripts/setup-source.sh >/dev/null 2>&1; then
say WARNING "Source setup encountered issues; running interactively." say WARNING "Source setup encountered issues; running interactively."
if ! ./scripts/setup-source.sh; then if ! ./scripts/setup-source.sh; then
@@ -947,6 +1043,33 @@ fi
fi fi
fi fi
fi fi
# Stage modules to local source directory before compilation
if [ "$NEEDS_CXX_REBUILD" = "1" ]; then
say INFO "Staging module repositories to local source directory..."
local local_modules_dir="${rebuild_source_path}/modules"
mkdir -p "$local_modules_dir"
# Export module variables for the script
local module_export_var
for module_export_var in "${KNOWN_MODULE_VARS[@]}"; do
export "$module_export_var"
done
# Set git config for module script
git config --global user.name "${GIT_USERNAME:-ac-compose}" 2>/dev/null || true
git config --global user.email "${GIT_EMAIL:-noreply@azerothcore.org}" 2>/dev/null || true
# Run module staging script in local modules directory
# Set environment variable to indicate we're running locally
export MODULES_LOCAL_RUN=1
if (cd "$local_modules_dir" && bash "$SCRIPT_DIR/scripts/manage-modules.sh"); then
say SUCCESS "Module repositories staged to $local_modules_dir"
else
say WARNING "Module staging encountered issues, but continuing with rebuild"
fi
unset MODULES_LOCAL_RUN
fi
fi fi
if [ "$RUN_REBUILD_NOW" = "1" ]; then if [ "$RUN_REBUILD_NOW" = "1" ]; then
@@ -974,6 +1097,11 @@ fi
fi fi
DB_PLAYERBOTS_NAME=${DB_PLAYERBOTS_NAME:-acore_playerbots} DB_PLAYERBOTS_NAME=${DB_PLAYERBOTS_NAME:-acore_playerbots}
local CLIENT_DATA_CACHE_PATH_VALUE="${LOCAL_STORAGE_ROOT}/client-data-cache"
HOST_ZONEINFO_PATH=${HOST_ZONEINFO_PATH:-/usr/share/zoneinfo}
MYSQL_INNODB_REDO_LOG_CAPACITY=${MYSQL_INNODB_REDO_LOG_CAPACITY:-512M}
MYSQL_RUNTIME_TMPFS_SIZE=${MYSQL_RUNTIME_TMPFS_SIZE:-8G}
CLIENT_DATA_VOLUME=${CLIENT_DATA_VOLUME:-ac-client-data}
cat > "$ENV_OUT" <<EOF cat > "$ENV_OUT" <<EOF
# Generated by ac-compose/setup.sh # Generated by ac-compose/setup.sh
@@ -981,6 +1109,8 @@ fi
COMPOSE_PROJECT_NAME=ac-compose COMPOSE_PROJECT_NAME=ac-compose
STORAGE_PATH=$STORAGE_PATH STORAGE_PATH=$STORAGE_PATH
STORAGE_PATH_LOCAL=$LOCAL_STORAGE_ROOT
HOST_ZONEINFO_PATH=$HOST_ZONEINFO_PATH
TZ=UTC TZ=UTC
# Database # Database
@@ -996,6 +1126,8 @@ MYSQL_COLLATION=utf8mb4_unicode_ci
MYSQL_MAX_CONNECTIONS=1000 MYSQL_MAX_CONNECTIONS=1000
MYSQL_INNODB_BUFFER_POOL_SIZE=256M MYSQL_INNODB_BUFFER_POOL_SIZE=256M
MYSQL_INNODB_LOG_FILE_SIZE=64M MYSQL_INNODB_LOG_FILE_SIZE=64M
MYSQL_INNODB_REDO_LOG_CAPACITY=$MYSQL_INNODB_REDO_LOG_CAPACITY
MYSQL_RUNTIME_TMPFS_SIZE=$MYSQL_RUNTIME_TMPFS_SIZE
DB_AUTH_NAME=acore_auth DB_AUTH_NAME=acore_auth
DB_WORLD_NAME=acore_world DB_WORLD_NAME=acore_world
DB_CHARACTERS_NAME=acore_characters DB_CHARACTERS_NAME=acore_characters
@@ -1011,6 +1143,8 @@ AC_WORLDSERVER_IMAGE_PLAYERBOTS=${AC_WORLDSERVER_IMAGE_PLAYERBOTS_VALUE}
# Client data images # Client data images
AC_CLIENT_DATA_IMAGE=acore/ac-wotlk-client-data:14.0.0-dev AC_CLIENT_DATA_IMAGE=acore/ac-wotlk-client-data:14.0.0-dev
AC_CLIENT_DATA_IMAGE_PLAYERBOTS=uprightbass360/azerothcore-wotlk-playerbots:client-data-Playerbot AC_CLIENT_DATA_IMAGE_PLAYERBOTS=uprightbass360/azerothcore-wotlk-playerbots:client-data-Playerbot
CLIENT_DATA_CACHE_PATH=$CLIENT_DATA_CACHE_PATH_VALUE
CLIENT_DATA_VOLUME=$CLIENT_DATA_VOLUME
# Ports # Ports
AUTH_EXTERNAL_PORT=$AUTH_EXTERNAL_PORT AUTH_EXTERNAL_PORT=$AUTH_EXTERNAL_PORT

View File

@@ -2,7 +2,7 @@
# Project: ac-compose # Project: ac-compose
set -e set -e
# Simple profile-aware deploy + health check for profiles-verify/compose.yml # Simple profile-aware deploy + health check for profiles-verify/docker-compose.yml
BLUE='\033[0;34m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m' BLUE='\033[0;34m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
info(){ echo -e "${BLUE} $*${NC}"; } info(){ echo -e "${BLUE} $*${NC}"; }
@@ -10,7 +10,7 @@ ok(){ echo -e "${GREEN}✅ $*${NC}"; }
warn(){ echo -e "${YELLOW}⚠️ $*${NC}"; } warn(){ echo -e "${YELLOW}⚠️ $*${NC}"; }
err(){ echo -e "${RED}$*${NC}"; } err(){ echo -e "${RED}$*${NC}"; }
COMPOSE_FILE="$(dirname "$0")/compose.yml" COMPOSE_FILE="$(dirname "$0")/docker-compose.yml"
ENV_FILE="" ENV_FILE=""
PROFILES=(db services-standard client-data modules tools) PROFILES=(db services-standard client-data modules tools)
SKIP_DEPLOY=false SKIP_DEPLOY=false