refactor: reorganize scripts under bash/python

This commit is contained in:
uprightbass360
2025-11-09 02:48:49 -05:00
parent 23456e0ab9
commit a18e315f1f
40 changed files with 265 additions and 194 deletions

View File

@@ -1,6 +1,6 @@
# Copy this file to .env and adjust values for your environment.
# Docker Compose will auto-load .env in the same folder as docker-compose.yml.
# Template for AzerothCore-RealmMaster profiles-based compose
# Template for AzerothCore Realm profiles-based compose
# =====================
# Compose overrides (set to 1 to include matching file under compose-overrides/)
@@ -13,7 +13,8 @@ COMPOSE_OVERRIDE_WORLDSERVER_DEBUG_LOGGING_ENABLED=0
# =====================
# Project name
# =====================
COMPOSE_PROJECT_NAME=azerothcore-realmmaster
# Customize this to match your deployment slug (used for container names/tags)
COMPOSE_PROJECT_NAME=azerothcore-stack
# =====================
# Storage & Timezone
@@ -157,7 +158,8 @@ MODULES_REQUIRES_PLAYERBOT_SOURCE=0
# =====================
# Client Data Settings
# =====================
CLIENT_DATA_VERSION=v18
# This is automatically applied, fyi version must match tag exactly
#CLIENT_DATA_VERSION=v18.0
# =====================
# Server Configuration

View File

@@ -8,6 +8,11 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ENV_PATH="$ROOT_DIR/.env"
TEMPLATE_PATH="$ROOT_DIR/.env.template"
source "$ROOT_DIR/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_PATH" "$TEMPLATE_PATH")"
ASSUME_YES=0
FORCE_REBUILD=0
SKIP_SOURCE_SETUP=0
@@ -95,7 +100,7 @@ update_env_value(){
fi
}
MODULE_HELPER="$ROOT_DIR/scripts/modules.py"
MODULE_HELPER="$ROOT_DIR/scripts/python/modules.py"
MODULE_STATE_INITIALIZED=0
declare -a MODULES_COMPILE_LIST=()
@@ -185,7 +190,7 @@ ensure_source_repo(){
fi
warn "AzerothCore source not found at $src_path; running setup-source.sh" >&2
if ! (cd "$ROOT_DIR" && ./scripts/setup-source.sh) >&2; then
if ! (cd "$ROOT_DIR" && ./scripts/bash/setup-source.sh) >&2; then
err "Failed to setup source repository" >&2
exit 1
fi
@@ -201,7 +206,7 @@ ensure_source_repo(){
show_client_data_requirement(){
local repo_path="$1"
local detector="$ROOT_DIR/scripts/detect-client-data-version.sh"
local detector="$ROOT_DIR/scripts/bash/detect-client-data-version.sh"
if [ ! -x "$detector" ]; then
return
fi
@@ -369,17 +374,8 @@ sync_modules(){
}
resolve_project_name(){
local raw_name="$(read_env COMPOSE_PROJECT_NAME "azerothcore-realmmaster")"
local sanitized
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
local raw_name="$(read_env COMPOSE_PROJECT_NAME "$DEFAULT_PROJECT_NAME")"
project_name::sanitize "$raw_name"
}
ensure_modules_dir_writable(){
@@ -484,7 +480,7 @@ stage_modules(){
rm -f "$staging_modules_dir/.modules_state" "$staging_modules_dir/.requires_rebuild" 2>/dev/null || true
fi
if ! (cd "$local_modules_dir" && bash "$ROOT_DIR/scripts/manage-modules.sh"); then
if ! (cd "$local_modules_dir" && bash "$ROOT_DIR/scripts/bash/manage-modules.sh"); then
err "Module staging failed; aborting build"
return 1
fi
@@ -543,7 +539,7 @@ execute_build(){
info "Building AzerothCore with modules (this may take a while)"
docker compose -f "$compose_file" down --remove-orphans >/dev/null 2>&1 || true
if (cd "$ROOT_DIR" && ./scripts/rebuild-with-modules.sh --yes --source "$src_path"); then
if (cd "$ROOT_DIR" && ./scripts/bash/rebuild-with-modules.sh --yes --source "$src_path"); then
ok "Source build completed"
else
err "Source build failed"

View File

@@ -1,10 +1,10 @@
#!/bin/bash
# ==============================================
# ac-compose Cleanup Script (project-scoped)
# AzerothCore RealmMaster Cleanup Script (project-scoped)
# ==============================================
# Usage: ./cleanup.sh [--soft] [--hard] [--nuclear] [--dry-run] [--force] [--preserve-backups]
# Project: ac-compose
# Project: azerothcore-rm
set -e
@@ -13,7 +13,12 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="${SCRIPT_DIR}"
DEFAULT_COMPOSE_FILE="${PROJECT_DIR}/docker-compose.yml"
ENV_FILE="${PROJECT_DIR}/.env"
source "${PROJECT_DIR}/scripts/lib/compose_overrides.sh"
TEMPLATE_FILE="${PROJECT_DIR}/.env.template"
source "${PROJECT_DIR}/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
source "${PROJECT_DIR}/scripts/bash/compose_overrides.sh"
declare -a COMPOSE_FILE_ARGS=()
# Colors
@@ -135,23 +140,13 @@ done
COMPOSE_BASE="docker compose${COMPOSE_FILE_ARGS_STR}"
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:-$DEFAULT_PROJECT_NAME}"
sanitize_project_name(){
local raw="$1"
local sanitized
sanitized="$(echo "$raw" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
project_name::sanitize "$1"
}
PROJECT_IMAGE_PREFIX="$(sanitize_project_name "${COMPOSE_PROJECT_NAME:-azerothcore-realmmaster}")"
PROJECT_IMAGE_PREFIX="$(sanitize_project_name "${COMPOSE_PROJECT_NAME:-$DEFAULT_PROJECT_NAME}")"
remove_storage_dir(){
local path="$1"
@@ -269,7 +264,7 @@ show_summary() {
}
main(){
print_status HEADER "ac-compose CLEANUP"
print_status HEADER "${PROJECT_NAME^^} CLEANUP"
if ! command -v docker >/dev/null 2>&1; then
print_status ERROR "Docker not found"

View File

@@ -429,6 +429,8 @@
"name": "StatBooster",
"repo": "https://github.com/AnchyDev/StatBooster.git",
"type": "cpp",
"status": "blocked",
"block_reason": "Override signature mismatch on OnLootItem",
"post_install_hooks": [
"fix-statbooster-api"
],

View File

@@ -23,7 +23,6 @@
"MODULE_ASSISTANT",
"MODULE_REAGENT_BANK",
"MODULE_BLACK_MARKET_AUCTION_HOUSE",
"MODULE_STATBOOSTER",
"MODULE_ELUNA_TS",
"MODULE_AIO",
"MODULE_ELUNA_SCRIPTS",

View File

@@ -76,7 +76,6 @@
"MODULE_SERVER_AUTO_SHUTDOWN",
"MODULE_SOLOCRAFT",
"MODULE_SOLO_LFG",
"MODULE_STATBOOSTER",
"MODULE_SYSTEM_VIP",
"MODULE_TEMP_ANNOUNCEMENTS",
"MODULE_TIC_TAC_TOE",

View File

@@ -11,7 +11,12 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DEFAULT_COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
ENV_PATH="$ROOT_DIR/.env"
source "$ROOT_DIR/scripts/lib/compose_overrides.sh"
TEMPLATE_PATH="$ROOT_DIR/.env.template"
source "$ROOT_DIR/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_PATH" "$TEMPLATE_PATH")"
source "$ROOT_DIR/scripts/bash/compose_overrides.sh"
TARGET_PROFILE=""
WATCH_LOGS=1
KEEP_RUNNING=0
@@ -28,7 +33,7 @@ REMOTE_PROJECT_DIR=""
REMOTE_SKIP_STORAGE=0
REMOTE_ARGS_PROVIDED=0
MODULE_HELPER="$ROOT_DIR/scripts/modules.py"
MODULE_HELPER="$ROOT_DIR/scripts/python/modules.py"
MODULE_STATE_INITIALIZED=0
declare -a MODULES_COMPILE_LIST=()
declare -a COMPOSE_FILE_ARGS=()
@@ -59,7 +64,7 @@ show_realm_ready(){
show_remote_plan(){
local plan_host="${REMOTE_HOST:-<host>}"
local plan_user="${REMOTE_USER:-<user>}"
local plan_dir="${REMOTE_PROJECT_DIR:-~/AzerothCore-RealmMaster}"
local plan_dir="${REMOTE_PROJECT_DIR:-$(get_default_remote_dir)}"
printf '\n%b\n' "${BLUE}🧭 Remote Deployment Plan${NC}"
printf '%b\n' "${YELLOW}├─ Validate build status locally${NC}"
@@ -139,7 +144,7 @@ collect_remote_details(){
fi
if [ -z "$REMOTE_PROJECT_DIR" ]; then
REMOTE_PROJECT_DIR="~/AzerothCore-RealmMaster"
REMOTE_PROJECT_DIR="$(get_default_remote_dir)"
fi
if [ "$interactive" -eq 1 ]; then
local dir_input
@@ -183,10 +188,10 @@ validate_remote_configuration(){
fi
fi
if [ -z "$REMOTE_PROJECT_DIR" ]; then
REMOTE_PROJECT_DIR="~/AzerothCore-RealmMaster"
REMOTE_PROJECT_DIR="$(get_default_remote_dir)"
fi
if [ ! -f "$ROOT_DIR/scripts/migrate-stack.sh" ]; then
err "Migration script not found: $ROOT_DIR/scripts/migrate-stack.sh"
if [ ! -f "$ROOT_DIR/scripts/bash/migrate-stack.sh" ]; then
err "Migration script not found: $ROOT_DIR/scripts/bash/migrate-stack.sh"
exit 1
fi
}
@@ -208,7 +213,7 @@ Options:
--remote-user USER SSH username for remote migration
--remote-port PORT SSH port for remote migration (default: 22)
--remote-identity PATH SSH private key for remote migration
--remote-project-dir DIR Remote project directory (default: ~/AzerothCore-RealmMaster)
--remote-project-dir DIR Remote project directory (default: ~/<project-name>)
--remote-skip-storage Skip syncing the storage directory during migration
--skip-config Skip applying server configuration preset
-h, --help Show this help
@@ -265,8 +270,8 @@ if [ "$REMOTE_MODE" -eq 1 ]; then
exit 1
fi
fi
if [ ! -f "$ROOT_DIR/scripts/migrate-stack.sh" ]; then
err "Migration script not found: $ROOT_DIR/scripts/migrate-stack.sh"
if [ ! -f "$ROOT_DIR/scripts/bash/migrate-stack.sh" ]; then
err "Migration script not found: $ROOT_DIR/scripts/bash/migrate-stack.sh"
exit 1
fi
fi
@@ -350,17 +355,12 @@ ensure_module_state(){
}
resolve_project_name(){
local raw_name="$(read_env COMPOSE_PROJECT_NAME "azerothcore-realmmaster")"
local sanitized
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
local raw_name="$(read_env COMPOSE_PROJECT_NAME "$DEFAULT_PROJECT_NAME")"
project_name::sanitize "$raw_name"
}
get_default_remote_dir(){
echo "~/$(resolve_project_name)"
}
resolve_project_image(){
@@ -605,7 +605,7 @@ run_remote_migration(){
args+=(--yes)
fi
(cd "$ROOT_DIR" && ./scripts/migrate-stack.sh "${args[@]}")
(cd "$ROOT_DIR" && ./scripts/bash/migrate-stack.sh "${args[@]}")
}
@@ -615,7 +615,7 @@ stage_runtime(){
args+=("$TARGET_PROFILE")
fi
info "Staging runtime environment via stage-modules.sh ${args[*]}"
(cd "$ROOT_DIR" && ./scripts/stage-modules.sh "${args[@]}")
(cd "$ROOT_DIR" && ./scripts/bash/stage-modules.sh "${args[@]}")
}
tail_world_logs(){
@@ -687,7 +687,7 @@ apply_server_config(){
info "Applying server configuration preset: $server_config_preset"
local config_script="$ROOT_DIR/scripts/apply-config.py"
local config_script="$ROOT_DIR/scripts/python/apply-config.py"
if [ ! -x "$config_script" ]; then
warn "Configuration script not found or not executable: $config_script"
warn "Server will use default settings"
@@ -758,7 +758,7 @@ main(){
show_step 2 "$remote_steps" "Migrating deployment to $REMOTE_HOST"
if run_remote_migration; then
ok "Remote deployment package prepared for $REMOTE_USER@$REMOTE_HOST."
local remote_dir="${REMOTE_PROJECT_DIR:-~/AzerothCore-RealmMaster}"
local remote_dir="${REMOTE_PROJECT_DIR:-$(get_default_remote_dir)}"
info "Run the following on the remote host to complete deployment:"
printf ' %bcd %s && ./deploy.sh --yes --no-watch%b\n' "$YELLOW" "$remote_dir" "$NC"
exit 0
@@ -781,7 +781,7 @@ main(){
show_step 3 5 "Importing user database files"
info "Checking for database files in ./database-import/"
bash "$ROOT_DIR/scripts/import-database-files.sh"
bash "$ROOT_DIR/scripts/bash/import-database-files.sh"
show_step 4 6 "Bringing your realm online"
info "Pulling images and waiting for containers to become healthy; this may take a few minutes on first deploy."

View File

@@ -21,7 +21,7 @@ services:
entrypoint:
- /usr/local/bin/mysql-entrypoint.sh
volumes:
- ./scripts/mysql-entrypoint.sh:/usr/local/bin/mysql-entrypoint.sh:ro
- ./scripts/bash/mysql-entrypoint.sh:/usr/local/bin/mysql-entrypoint.sh:ro
- ${STORAGE_PATH_LOCAL}/mysql-data:/var/lib/mysql-persistent
- ${BACKUP_PATH}:/backups
- ${HOST_ZONEINFO_PATH}:/usr/share/zoneinfo:ro
@@ -65,7 +65,7 @@ services:
- ${STORAGE_PATH}/config:/azerothcore/env/dist/etc
- ${STORAGE_PATH}/logs:/azerothcore/logs
- ${STORAGE_PATH_LOCAL}/mysql-data:/var/lib/mysql-persistent
- ./scripts/db-import-conditional.sh:/tmp/db-import-conditional.sh:ro
- ./scripts/bash/db-import-conditional.sh:/tmp/db-import-conditional.sh:ro
environment:
AC_DATA_DIR: "/azerothcore/data"
AC_LOGS_DIR: "/azerothcore/logs"
@@ -171,9 +171,9 @@ services:
- |
microdnf install -y curl || yum install -y curl || (apt-get update && apt-get install -y curl)
echo "📥 Downloading backup scheduler script (local copy preferred if mounted)..."
if [ -f /tmp/scripts/backup-scheduler.sh ]; then
chmod +x /tmp/scripts/backup-scheduler.sh 2>/dev/null || true
bash /tmp/scripts/backup-scheduler.sh
if [ -f /tmp/scripts/bash/backup-scheduler.sh ]; then
chmod +x /tmp/scripts/bash/backup-scheduler.sh 2>/dev/null || true
bash /tmp/scripts/bash/backup-scheduler.sh
else
echo "No local scheduler provided"
fi
@@ -269,9 +269,9 @@ services:
- -c
- |
mkdir -p /cache
if [ -f /tmp/scripts/download-client-data.sh ]; then
chmod +x /tmp/scripts/download-client-data.sh 2>/dev/null || true
bash /tmp/scripts/download-client-data.sh
if [ -f /tmp/scripts/bash/download-client-data.sh ]; then
chmod +x /tmp/scripts/bash/download-client-data.sh 2>/dev/null || true
bash /tmp/scripts/bash/download-client-data.sh
else
echo "No local client-data script"
fi
@@ -302,9 +302,9 @@ services:
echo "📦 Installing 7z for faster extraction..."
apt-get update -qq && apt-get install -y p7zip-full
mkdir -p /cache
if [ -f /tmp/scripts/download-client-data.sh ]; then
chmod +x /tmp/scripts/download-client-data.sh 2>/dev/null || true
bash /tmp/scripts/download-client-data.sh
if [ -f /tmp/scripts/bash/download-client-data.sh ]; then
chmod +x /tmp/scripts/bash/download-client-data.sh 2>/dev/null || true
bash /tmp/scripts/bash/download-client-data.sh
echo "🔧 Fixing ownership of extracted files..."
chown -R ${CONTAINER_USER} /azerothcore/data
echo "✅ Client data extraction and ownership setup complete"
@@ -607,7 +607,7 @@ services:
- -c
- |
apk add --no-cache curl bash git python3
(chmod +x /tmp/scripts/manage-modules.sh /tmp/scripts/manage-modules-sql.sh 2>/dev/null || true) && /tmp/scripts/manage-modules.sh
(chmod +x /tmp/scripts/bash/manage-modules.sh /tmp/scripts/bash/manage-modules-sql.sh 2>/dev/null || true) && /tmp/scripts/bash/manage-modules.sh
# Fix permissions after module operations
chown -R ${CONTAINER_USER} /modules /azerothcore/env/dist/etc 2>/dev/null || true
chmod -R 755 /modules /azerothcore/env/dist/etc 2>/dev/null || true
@@ -659,7 +659,7 @@ services:
chown -R ${CONTAINER_USER} /azerothcore/config /install-markers 2>/dev/null || true
chmod -R 755 /azerothcore/config /install-markers 2>/dev/null || true
echo "📥 Running local auto-post-install script..."
(chmod +x /tmp/scripts/auto-post-install.sh 2>/dev/null || true) && bash /tmp/scripts/auto-post-install.sh
(chmod +x /tmp/scripts/bash/auto-post-install.sh 2>/dev/null || true) && bash /tmp/scripts/bash/auto-post-install.sh
# Fix permissions for all files created during post-install
chown -R ${CONTAINER_USER} /azerothcore/config /install-markers 2>/dev/null || true
chmod -R 755 /azerothcore/config /install-markers 2>/dev/null || true

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# ac-compose
# azerothcore-rm
set -e
GREEN='\033[0;32m'; BLUE='\033[0;34m'; NC='\033[0m'

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# ac-compose
# azerothcore-rm
set -e
BACKUP_DIR_BASE="/backups"

View File

@@ -49,7 +49,7 @@ edit_config() {
# Create a minimal template if it doesn't exist
cat > "$config_file" << 'EOF'
# AzerothCore Server Configuration Overrides
# Edit this file and run './scripts/configure-server.sh apply' to update settings
# Edit this file and run './scripts/bash/configure-server.sh apply' to update settings
[worldserver.conf]
# Example settings - uncomment and modify as needed

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# ac-compose
# azerothcore-rm
set -e
print_help() {

View File

@@ -1,13 +1,18 @@
#!/bin/bash
# ac-compose helper to deploy phpMyAdmin and Keira3 tooling.
# azerothcore-rm helper to deploy phpMyAdmin and Keira3 tooling.
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
DEFAULT_COMPOSE_FILE="$ROOT_DIR/docker-compose.yml"
ENV_FILE="$ROOT_DIR/.env"
source "$ROOT_DIR/scripts/lib/compose_overrides.sh"
TEMPLATE_FILE="$ROOT_DIR/.env.template"
source "$ROOT_DIR/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
source "$ROOT_DIR/scripts/bash/compose_overrides.sh"
declare -a COMPOSE_FILE_ARGS=()
BLUE='\033[0;34m'
@@ -34,16 +39,8 @@ read_env(){
resolve_project_name(){
local raw_name sanitized
raw_name="$(read_env COMPOSE_PROJECT_NAME "azerothcore-realmmaster")"
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
raw_name="$(read_env COMPOSE_PROJECT_NAME "$DEFAULT_PROJECT_NAME")"
project_name::sanitize "$raw_name"
}
init_compose_files(){

View File

@@ -9,10 +9,10 @@ set -euo pipefail
print_usage() {
cat <<'EOF'
Usage: scripts/detect-client-data-version.sh [--no-header] <repo-path> [...]
Usage: scripts/bash/detect-client-data-version.sh [--no-header] <repo-path> [...]
Outputs a tab-separated list of repository path, raw version token found in the
source tree, and a normalized CLIENT_DATA_VERSION (e.g., v18).
source tree, and a normalized CLIENT_DATA_VERSION (e.g., v18.0).
EOF
}

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# ac-compose
# azerothcore-rm
set -e
echo '🚀 Starting AzerothCore game data setup...'

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# ac-compose
# azerothcore-rm
set -e
trap 'echo " ❌ SQL helper error (line ${LINENO}): ${BASH_COMMAND}" >&2' ERR
@@ -117,8 +117,8 @@ ensure_module_metadata(){
local -a module_py_candidates=(
"${MODULE_HELPER:-}"
"${HELPER_DIR%/*}/modules.py"
"/tmp/scripts/modules.py"
"/scripts/modules.py"
"/tmp/scripts/python/modules.py"
"/scripts/python/modules.py"
)
local module_py=""

View File

@@ -10,6 +10,11 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
MODULE_HELPER="$SCRIPT_DIR/modules.py"
DEFAULT_ENV_PATH="$PROJECT_ROOT/.env"
ENV_PATH="${MODULES_ENV_PATH:-$DEFAULT_ENV_PATH}"
TEMPLATE_FILE="$PROJECT_ROOT/.env.template"
source "$PROJECT_ROOT/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_PATH" "$TEMPLATE_FILE")"
BLUE='\033[0;34m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; RED='\033[0;31m'; NC='\033[0m'
PLAYERBOTS_DB_UPDATE_LOGGED=0
@@ -75,7 +80,7 @@ resolve_manifest_path(){
setup_git_config(){
info "Configuring git identity"
git config --global user.name "${GIT_USERNAME:-ac-compose}" >/dev/null 2>&1 || true
git config --global user.name "${GIT_USERNAME:-$DEFAULT_PROJECT_NAME}" >/dev/null 2>&1 || true
git config --global user.email "${GIT_EMAIL:-noreply@azerothcore.org}" >/dev/null 2>&1 || true
}
@@ -456,8 +461,8 @@ manage_configuration_files(){
load_sql_helper(){
local helper_paths=(
"/scripts/manage-modules-sql.sh"
"/tmp/scripts/manage-modules-sql.sh"
"/scripts/bash/manage-modules-sql.sh"
"/tmp/scripts/bash/manage-modules-sql.sh"
)
if [ "${MODULES_LOCAL_RUN:-0}" = "1" ]; then
@@ -556,7 +561,7 @@ track_module_state(){
if [ -n "$host_rebuild_sentinel" ]; then
printf '%s\n' "${MODULES_COMPILE_LIST[@]}" > "$host_rebuild_sentinel" 2>/dev/null || true
fi
echo "🚨 Module changes detected; run ./scripts/rebuild-with-modules.sh to rebuild source images."
echo "🚨 Module changes detected; run ./scripts/bash/rebuild-with-modules.sh to rebuild source images."
else
rm -f "$rebuild_sentinel" 2>/dev/null || true
if [ -n "$host_rebuild_sentinel" ]; then

View File

@@ -8,6 +8,11 @@ set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
ENV_FILE="$PROJECT_ROOT/.env"
TEMPLATE_FILE="$PROJECT_ROOT/.env.template"
source "$PROJECT_ROOT/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
read_env_value(){
local key="$1" default="$2" value=""
@@ -25,17 +30,8 @@ read_env_value(){
resolve_project_name(){
local raw_name
raw_name="$(read_env_value COMPOSE_PROJECT_NAME "azerothcore-realmmaster")"
local sanitized
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
raw_name="$(read_env_value COMPOSE_PROJECT_NAME "$DEFAULT_PROJECT_NAME")"
project_name::sanitize "$raw_name"
}
resolve_project_image(){
@@ -79,7 +75,7 @@ Options:
--user USER SSH username on remote host (required)
--port PORT SSH port (default: 22)
--identity PATH SSH private key (passed to scp/ssh)
--project-dir DIR Remote project directory (default: ~/AzerothCore-RealmMaster)
--project-dir DIR Remote project directory (default: ~/<project-name>)
--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)
--skip-storage Do not sync the storage directory
@@ -129,7 +125,7 @@ expand_remote_path(){
esac
}
PROJECT_DIR="${PROJECT_DIR:-/home/${USER}/AzerothCore-RealmMaster}"
PROJECT_DIR="${PROJECT_DIR:-/home/${USER}/$(resolve_project_name)}"
PROJECT_DIR="$(expand_remote_path "$PROJECT_DIR")"
REMOTE_STORAGE="${REMOTE_STORAGE:-${PROJECT_DIR}/storage}"
REMOTE_STORAGE="$(expand_remote_path "$REMOTE_STORAGE")"

View File

@@ -0,0 +1,49 @@
#!/bin/bash
project_name::extract(){
local file="$1"
if [ -n "$file" ] && [ -f "$file" ]; then
local line value
line="$(grep -E '^COMPOSE_PROJECT_NAME=' "$file" 2>/dev/null | tail -n1)"
if [ -n "$line" ]; then
value="${line#*=}"
value="${value%$'\r'}"
value="$(printf '%s\n' "$value" | awk -F'#' '{print $1}' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
value="${value%\"}"; value="${value#\"}"
value="${value%\'}"; value="${value#\'}"
printf '%s\n' "$value"
fi
fi
}
project_name::resolve(){
local env_file="$1" template_file="$2" value=""
value="$(project_name::extract "$env_file")"
if [ -z "$value" ] && [ -n "$template_file" ]; then
value="$(project_name::extract "$template_file")"
fi
if [ -z "$value" ] && [ -n "${COMPOSE_PROJECT_NAME:-}" ]; then
value="${COMPOSE_PROJECT_NAME}"
fi
if [ -z "$value" ]; then
echo "Error: COMPOSE_PROJECT_NAME not defined in $env_file, $template_file, or environment." >&2
exit 1
fi
printf '%s\n' "$value"
}
project_name::sanitize(){
local raw="$1"
local sanitized
sanitized="$(echo "$raw" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
echo "Error: COMPOSE_PROJECT_NAME '$raw' is invalid after sanitization." >&2
exit 1
fi
if [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
printf '%s\n' "$sanitized"
}

View File

@@ -1,12 +1,17 @@
#!/bin/bash
# ac-compose helper to rebuild AzerothCore from source with enabled modules.
# azerothcore-rm helper to rebuild AzerothCore from source with enabled modules.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
ENV_FILE="$PROJECT_DIR/.env"
TEMPLATE_FILE="$PROJECT_DIR/.env.template"
source "$PROJECT_DIR/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
BLUE='\033[0;34m'
GREEN='\033[0;32m'
@@ -98,17 +103,8 @@ ensure_project_image_tag(){
resolve_project_name(){
local raw_name
raw_name="$(read_env COMPOSE_PROJECT_NAME "azerothcore-realmmaster")"
local sanitized
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
raw_name="$(read_env COMPOSE_PROJECT_NAME "$DEFAULT_PROJECT_NAME")"
project_name::sanitize "$raw_name"
}
resolve_project_image(){
@@ -158,7 +154,7 @@ ASSUME_YES=0
SOURCE_OVERRIDE=""
SKIP_STOP=0
MODULE_HELPER="$PROJECT_DIR/scripts/modules.py"
MODULE_HELPER="$PROJECT_DIR/scripts/python/modules.py"
MODULE_STATE_DIR=""
declare -a MODULES_COMPILE_LIST=()

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# ac-compose source repository setup
# azerothcore-rm source repository setup
set -euo pipefail
echo '🔧 Setting up AzerothCore source repository...'
@@ -35,7 +35,7 @@ SOURCE_PATH="${MODULES_REBUILD_SOURCE_PATH:-$SOURCE_PATH_DEFAULT}"
show_client_data_requirement(){
local repo_path="$1"
local detector="$PROJECT_ROOT/scripts/detect-client-data-version.sh"
local detector="$PROJECT_ROOT/scripts/bash/detect-client-data-version.sh"
if [ ! -x "$detector" ]; then
return
fi

View File

@@ -1,6 +1,6 @@
#!/bin/bash
# ac-compose helper to automatically stage modules and trigger source builds when needed.
# azerothcore-rm helper to automatically stage modules and trigger source builds when needed.
set -e
@@ -64,8 +64,13 @@ sync_local_staging(){
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
ENV_FILE="$PROJECT_DIR/.env"
TEMPLATE_FILE="$PROJECT_DIR/.env.template"
source "$PROJECT_DIR/scripts/bash/project_name.sh"
# Default project name (read from .env or template)
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
DEFAULT_COMPOSE_FILE="$PROJECT_DIR/docker-compose.yml"
source "$PROJECT_DIR/scripts/lib/compose_overrides.sh"
source "$PROJECT_DIR/scripts/bash/compose_overrides.sh"
usage(){
cat <<EOF
@@ -101,17 +106,8 @@ read_env(){
resolve_project_name(){
local raw_name
raw_name="$(read_env COMPOSE_PROJECT_NAME "azerothcore-realmmaster")"
local sanitized
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
raw_name="$(read_env COMPOSE_PROJECT_NAME "$DEFAULT_PROJECT_NAME")"
project_name::sanitize "$raw_name"
}
if [ -z "${COMPOSE_FILE:-}" ]; then

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# Project: ac-compose
# Project: azerothcore-rm
set -e
# Simple profile-aware deploy + health check for profiles-verify/docker-compose.yml
@@ -13,7 +13,9 @@ err(){ echo -e "${RED}❌ $*${NC}"; }
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
COMPOSE_FILE="$PROJECT_DIR/docker-compose.yml"
ENV_FILE=""
source "$PROJECT_DIR/scripts/lib/compose_overrides.sh"
TEMPLATE_FILE="$PROJECT_DIR/.env.template"
source "$PROJECT_DIR/scripts/bash/project_name.sh"
source "$PROJECT_DIR/scripts/bash/compose_overrides.sh"
PROFILES=(db services-standard client-data modules tools)
SKIP_DEPLOY=false
QUICK=false
@@ -46,20 +48,17 @@ resolve_project_name(){
else
env_path="$(dirname "$COMPOSE_FILE")/.env"
fi
local raw_name=""
if [ -f "$env_path" ]; then
raw_name="$(grep -E '^COMPOSE_PROJECT_NAME=' "$env_path" | tail -n1 | cut -d'=' -f2-)"
fi
if [ -z "$raw_name" ]; then
raw_name="azerothcore-realmmaster"
fi
local raw_name
raw_name="$(project_name::resolve "$env_path" "$TEMPLATE_FILE")"
local sanitized
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
echo "Error: COMPOSE_PROJECT_NAME is invalid" >&2
exit 1
fi
if [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
@@ -120,21 +119,21 @@ handle_auto_rebuild(){
local auto_rebuild
auto_rebuild="$(read_env_value AUTO_REBUILD_ON_DEPLOY "0")"
if [ "$auto_rebuild" != "1" ]; then
warn "Run ./scripts/rebuild-with-modules.sh after preparing your source tree."
warn "Run ./scripts/bash/rebuild-with-modules.sh after preparing your source tree."
return 0
fi
local rebuild_source
rebuild_source="$(read_env_value MODULES_REBUILD_SOURCE_PATH "")"
info "AUTO_REBUILD_ON_DEPLOY=1; invoking ./scripts/rebuild-with-modules.sh."
local cmd=(./scripts/rebuild-with-modules.sh --yes)
info "AUTO_REBUILD_ON_DEPLOY=1; invoking ./scripts/bash/rebuild-with-modules.sh."
local cmd=(./scripts/bash/rebuild-with-modules.sh --yes)
if [ -n "$rebuild_source" ]; then
cmd+=(--source "$rebuild_source")
fi
if "${cmd[@]}"; then
info "Module rebuild completed."
else
warn "Automatic rebuild failed; run ./scripts/rebuild-with-modules.sh manually."
warn "Automatic rebuild failed; run ./scripts/bash/rebuild-with-modules.sh manually."
fi
}

View File

@@ -260,7 +260,7 @@ def write_outputs(state: ModuleCollectionState, output_dir: Path) -> None:
output_dir.mkdir(parents=True, exist_ok=True)
env_lines: List[str] = [
"# Autogenerated by scripts/modules.py",
"# Autogenerated by scripts/python/modules.py",
f"# Generated at {state.generated_at.isoformat()}",
f'export MODULES_MANIFEST="{state.manifest_path}"',
f'export MODULES_ENV_PATH="{state.env_path}"',

View File

@@ -3,13 +3,19 @@ set -e
clear
# ==============================================
# ac-compose - Interactive .env generator
# azerothcore-rm - Interactive .env generator
# ==============================================
# Mirrors options from scripts/setup-server.sh but targets ac-compose/.env
# Mirrors options from scripts/setup-server.sh but targets azerothcore-rm/.env
# Get script directory for template reading
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Default project name (can be overridden by COMPOSE_PROJECT_NAME in .env)
ENV_FILE="$SCRIPT_DIR/.env"
TEMPLATE_FILE="$SCRIPT_DIR/.env.template"
source "$SCRIPT_DIR/scripts/bash/project_name.sh"
DEFAULT_PROJECT_NAME="$(project_name::resolve "$ENV_FILE" "$TEMPLATE_FILE")"
# ==============================================
# Constants (auto-loaded from .env.template)
# ==============================================
@@ -44,17 +50,7 @@ get_template_value() {
}
sanitize_project_name(){
local raw="$1"
local sanitized
sanitized="$(echo "$raw" | tr '[:upper:]' '[:lower:]')"
sanitized="${sanitized// /-}"
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
if [[ -z "$sanitized" ]]; then
sanitized="azerothcore-realmmaster"
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
sanitized="ac${sanitized}"
fi
echo "$sanitized"
project_name::sanitize "$1"
}
resolve_project_image_tag(){
@@ -353,8 +349,8 @@ EOF
# ==============================
MODULE_MANIFEST_PATH="$SCRIPT_DIR/config/module-manifest.json"
MODULE_MANIFEST_HELPER="$SCRIPT_DIR/scripts/setup_manifest.py"
MODULE_PROFILES_HELPER="$SCRIPT_DIR/scripts/setup_profiles.py"
MODULE_MANIFEST_HELPER="$SCRIPT_DIR/scripts/python/setup_manifest.py"
MODULE_PROFILES_HELPER="$SCRIPT_DIR/scripts/python/setup_profiles.py"
ENV_TEMPLATE_FILE="$SCRIPT_DIR/.env.template"
declare -a MODULE_KEYS=()
@@ -554,7 +550,7 @@ main(){
Usage: ./setup.sh [options]
Description:
Interactive wizard that generates ac-compose/.env for the
Interactive wizard that generates azerothcore-rm/.env for the
profiles-based compose. Prompts for deployment type, ports, storage,
MySQL credentials, backup retention, and module presets or manual
toggles.
@@ -790,7 +786,7 @@ EOF
fi
show_wow_header
say INFO "This will create ac-compose/.env for compose profiles."
say INFO "This will create azerothcore-rm/.env for compose profiles."
# Deployment type
say HEADER "DEPLOYMENT TYPE"
@@ -915,7 +911,11 @@ fi
if [ -n "$CLI_STORAGE_PATH" ]; then
STORAGE_PATH="$CLI_STORAGE_PATH"
elif [ "$NON_INTERACTIVE" = "1" ]; then
if [ "$DEPLOYMENT_TYPE" = "local" ]; then
STORAGE_PATH=$DEFAULT_LOCAL_STORAGE
else
STORAGE_PATH=$DEFAULT_MOUNT_STORAGE
fi
else
echo "1) 💾 ./storage (local)"
echo "2) 🌐 /nfs/azerothcore (NFS)"
@@ -930,6 +930,7 @@ fi
esac
done
fi
say INFO "Storage path set to ${STORAGE_PATH}"
# Backup
say HEADER "BACKUP CONFIGURATION"
@@ -954,7 +955,7 @@ fi
echo "Choose a server configuration preset:"
if [ -x "$SCRIPT_DIR/scripts/parse-config-presets.py" ] && [ -d "$config_dir" ]; then
if [ -x "$SCRIPT_DIR/scripts/python/parse-config-presets.py" ] && [ -d "$config_dir" ]; then
while IFS=$'\t' read -r preset_key preset_name preset_desc; do
[ -n "$preset_key" ] || continue
CONFIG_PRESET_NAMES["$preset_key"]="$preset_name"
@@ -963,7 +964,7 @@ fi
echo "$menu_index) $preset_name"
echo " $preset_desc"
menu_index=$((menu_index + 1))
done < <(python3 "$SCRIPT_DIR/scripts/parse-config-presets.py" list --presets-dir "$config_dir")
done < <(python3 "$SCRIPT_DIR/scripts/python/parse-config-presets.py" list --presets-dir "$config_dir")
else
# Fallback if parser script not available
CONFIG_MENU_INDEX[1]="none"
@@ -1565,7 +1566,7 @@ fi
{
cat <<EOF
# Generated by ac-compose/setup.sh
# Generated by azerothcore-rm/setup.sh
# Compose overrides (set to 1 to include matching file under compose-overrides/)
# mysql-expose.yml -> exposes MySQL externally via COMPOSE_OVERRIDE_MYSQL_EXPOSE_ENABLED

View File

@@ -175,23 +175,21 @@ print_service(){
module_summary_list(){
if [ ! -f "$ENV_FILE" ]; then
echo "MODULES: (env not found)"
echo "(env not found)"
return
fi
local module_vars
module_vars="$(grep -E '^MODULE_[A-Z_]+=1' "$ENV_FILE" 2>/dev/null | cut -d'=' -f1)"
if [ -n "$module_vars" ]; then
echo "MODULES:"
while IFS= read -r mod; do
[ -z "$mod" ] && continue
local pretty="${mod#MODULE_}"
pretty="$(echo "$pretty" | tr '[:upper:]' '[:lower:]' | tr '_' ' ' | sed 's/\b\w/\U&/g')"
printf "%s\n" "$pretty"
printf "%s\n" "$pretty"
done <<< "$module_vars"
else
echo "MODULES: none"
echo "none"
fi
echo ""
if container_running "ac-worldserver"; then
local playerbot="disabled"
local module_playerbots
@@ -208,6 +206,47 @@ module_summary_list(){
fi
}
render_module_ports(){
local modules_raw="$1" ports_raw="$2" net_line="$3"
mapfile -t modules <<< "$modules_raw"
mapfile -t ports_lines <<< "$ports_raw"
local ports=()
for idx in "${!ports_lines[@]}"; do
local line="${ports_lines[$idx]}"
if [ "$idx" -eq 0 ]; then
continue
fi
line="$(echo "$line" | sed 's/^[[:space:]]*//')"
[ -z "$line" ] && continue
ports+=("$line")
done
if [ -n "$net_line" ]; then
ports+=("DOCKER NET: ${net_line##*: }")
fi
local rows="${#modules[@]}"
if [ "${#ports[@]}" -gt "$rows" ]; then
rows="${#ports[@]}"
fi
printf " %-52s %s\n" "MODULES:" "PORTS:"
for ((i=0; i<rows; i++)); do
local left="${modules[i]:-}"
local right="${ports[i]:-}"
if [ -n "$left" ]; then
left="$left"
fi
local port_column=""
if [[ "$right" == DOCKER\ NET:* ]]; then
port_column=" $right"
elif [ -n "$right" ]; then
port_column=" $right"
fi
printf " %-50s %s\n" "$left" "$port_column"
done
}
user_stats(){
if ! container_running "ac-mysql"; then
echo -e "USERS: ${RED}Database offline${NC}"
@@ -310,11 +349,11 @@ render_snapshot(){
print_service ac-phpmyadmin "phpMyAdmin"
print_service ac-keira3 "Keira3"
echo ""
module_summary_list
echo ""
echo "$(ports_summary)"
echo ""
echo "$(network_summary)"
local module_block ports_block net_line
module_block="$(module_summary_list)"
ports_block="$(ports_summary)"
net_line="$(network_summary)"
render_module_ports "$module_block" "$ports_block" "$net_line"
}
display_snapshot(){