mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 09:07:20 +00:00
updates to use hosted scripts
This commit is contained in:
@@ -391,6 +391,9 @@ Run the configuration analysis tool for specific guidance:
|
|||||||
- **[Module Configuration Requirements](docs/module-configuration-requirements.md)** - Detailed manual setup steps
|
- **[Module Configuration Requirements](docs/module-configuration-requirements.md)** - Detailed manual setup steps
|
||||||
- **[Lua Scripting Guide](storage/azerothcore/lua_scripts/README.md)** - Eluna development
|
- **[Lua Scripting Guide](storage/azerothcore/lua_scripts/README.md)** - Eluna development
|
||||||
- **[Deployment Scripts](scripts/README.md)** - Automation tools reference
|
- **[Deployment Scripts](scripts/README.md)** - Automation tools reference
|
||||||
|
- **[GitHub-Hosted Scripts](scripts/GITHUB-HOSTED-SCRIPTS.md)** - Service script documentation
|
||||||
|
- **[Deployment Guide](scripts/DEPLOYMENT.md)** - Complete deployment procedures
|
||||||
|
- **[Cleanup Guide](scripts/CLEANUP.md)** - Resource management procedures
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
# ==============================================
|
# ==============================================
|
||||||
# AZEROTHCORE DATABASE LAYER - PORTAINER VERSION (CLEAN)
|
# AZEROTHCORE DATABASE LAYER
|
||||||
# ==============================================
|
# ==============================================
|
||||||
# Modified for better Portainer compatibility
|
|
||||||
# Removed redundant ac-mysql-persist service
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# Step 1: MySQL database
|
# Step 1: MySQL database
|
||||||
@@ -15,6 +13,12 @@ services:
|
|||||||
MYSQL_ROOT_HOST: '${MYSQL_ROOT_HOST}'
|
MYSQL_ROOT_HOST: '${MYSQL_ROOT_HOST}'
|
||||||
MYSQL_ALLOW_EMPTY_PASSWORD: no
|
MYSQL_ALLOW_EMPTY_PASSWORD: no
|
||||||
MYSQL_DATADIR: /var/lib/mysql-runtime
|
MYSQL_DATADIR: /var/lib/mysql-runtime
|
||||||
|
# MySQL configuration variables for startup script
|
||||||
|
MYSQL_CHARACTER_SET: ${MYSQL_CHARACTER_SET}
|
||||||
|
MYSQL_COLLATION: ${MYSQL_COLLATION}
|
||||||
|
MYSQL_MAX_CONNECTIONS: ${MYSQL_MAX_CONNECTIONS}
|
||||||
|
MYSQL_INNODB_BUFFER_POOL_SIZE: ${MYSQL_INNODB_BUFFER_POOL_SIZE}
|
||||||
|
MYSQL_INNODB_LOG_FILE_SIZE: ${MYSQL_INNODB_LOG_FILE_SIZE}
|
||||||
ports:
|
ports:
|
||||||
- "${MYSQL_EXTERNAL_PORT}:${MYSQL_PORT}"
|
- "${MYSQL_EXTERNAL_PORT}:${MYSQL_PORT}"
|
||||||
volumes:
|
volumes:
|
||||||
@@ -24,110 +28,15 @@ services:
|
|||||||
target: /var/lib/mysql-runtime
|
target: /var/lib/mysql-runtime
|
||||||
tmpfs:
|
tmpfs:
|
||||||
size: 2G
|
size: 2G
|
||||||
entrypoint: ["/bin/bash", "-c"]
|
|
||||||
command:
|
command:
|
||||||
- |
|
- mysqld
|
||||||
echo "🔧 Starting MySQL with NFS-compatible setup and auto-restore..."
|
- --datadir=/var/lib/mysql-runtime
|
||||||
mkdir -p /var/lib/mysql-runtime
|
- --default-authentication-plugin=mysql_native_password
|
||||||
chown -R mysql:mysql /var/lib/mysql-runtime
|
- --character-set-server=utf8mb4
|
||||||
chmod 755 /var/lib/mysql-runtime
|
- --collation-server=utf8mb4_unicode_ci
|
||||||
|
- --max_connections=1000
|
||||||
# Check if MySQL data directory is empty (fresh start)
|
- --innodb-buffer-pool-size=256M
|
||||||
if [ ! -d "/var/lib/mysql-runtime/mysql" ]; then
|
- --innodb-log-file-size=64M
|
||||||
echo "🆕 Fresh MySQL installation detected..."
|
|
||||||
|
|
||||||
# Check for available backups (prefer daily, fallback to hourly, then legacy)
|
|
||||||
if [ -d "/backups" ] && [ "$(ls -A /backups)" ]; then
|
|
||||||
# Try daily backups first
|
|
||||||
if [ -d "/backups/daily" ] && [ "$(ls -A /backups/daily)" ]; then
|
|
||||||
LATEST_BACKUP=$(ls -1t /backups/daily | head -n 1)
|
|
||||||
if [ -n "$LATEST_BACKUP" ] && [ -d "/backups/daily/$LATEST_BACKUP" ]; then
|
|
||||||
echo "📦 Latest daily backup found: $LATEST_BACKUP"
|
|
||||||
echo "🔄 Will restore after MySQL initializes..."
|
|
||||||
export RESTORE_BACKUP="/backups/daily/$LATEST_BACKUP"
|
|
||||||
fi
|
|
||||||
# Try hourly backups second
|
|
||||||
elif [ -d "/backups/hourly" ] && [ "$(ls -A /backups/hourly)" ]; then
|
|
||||||
LATEST_BACKUP=$(ls -1t /backups/hourly | head -n 1)
|
|
||||||
if [ -n "$LATEST_BACKUP" ] && [ -d "/backups/hourly/$LATEST_BACKUP" ]; then
|
|
||||||
echo "📦 Latest hourly backup found: $LATEST_BACKUP"
|
|
||||||
echo "🔄 Will restore after MySQL initializes..."
|
|
||||||
export RESTORE_BACKUP="/backups/hourly/$LATEST_BACKUP"
|
|
||||||
fi
|
|
||||||
# Try legacy backup structure last
|
|
||||||
else
|
|
||||||
LATEST_BACKUP=$(ls -1t /backups | head -n 1)
|
|
||||||
if [ -n "$LATEST_BACKUP" ] && [ -d "/backups/$LATEST_BACKUP" ]; then
|
|
||||||
echo "📦 Latest legacy backup found: $LATEST_BACKUP"
|
|
||||||
echo "🔄 Will restore after MySQL initializes..."
|
|
||||||
export RESTORE_BACKUP="/backups/$LATEST_BACKUP"
|
|
||||||
else
|
|
||||||
echo "🆕 No valid backups found, will initialize fresh..."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "🆕 No backup directory found, will initialize fresh..."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "📁 Existing MySQL data found, skipping restore..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "🚀 Starting MySQL server with custom datadir..."
|
|
||||||
|
|
||||||
# Start MySQL in background for potential restore
|
|
||||||
if [ -n "$RESTORE_BACKUP" ]; then
|
|
||||||
echo "⚡ Starting MySQL in background for restore operation..."
|
|
||||||
docker-entrypoint.sh mysqld \
|
|
||||||
--datadir=/var/lib/mysql-runtime \
|
|
||||||
--default-authentication-plugin=mysql_native_password \
|
|
||||||
--character-set-server=${MYSQL_CHARACTER_SET} \
|
|
||||||
--collation-server=${MYSQL_COLLATION} \
|
|
||||||
--max_connections=${MYSQL_MAX_CONNECTIONS} \
|
|
||||||
--innodb-buffer-pool-size=${MYSQL_INNODB_BUFFER_POOL_SIZE} \
|
|
||||||
--innodb-log-file-size=${MYSQL_INNODB_LOG_FILE_SIZE} &
|
|
||||||
|
|
||||||
MYSQL_PID=$!
|
|
||||||
|
|
||||||
# Wait for MySQL to be ready
|
|
||||||
echo "⏳ Waiting for MySQL to become ready for restore..."
|
|
||||||
while ! mysqladmin ping -h localhost -u root --silent; do
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "🔄 MySQL ready, starting restore from $RESTORE_BACKUP..."
|
|
||||||
|
|
||||||
# Install curl for downloading restore script
|
|
||||||
apt-get update && apt-get install -y curl
|
|
||||||
|
|
||||||
# Download restore script from GitHub
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/restore.sh -o /tmp/restore.sh
|
|
||||||
chmod +x /tmp/restore.sh
|
|
||||||
|
|
||||||
# Modify restore script to skip confirmation and use correct backup path
|
|
||||||
sed -i 's/sleep 10/echo "Auto-restore mode, skipping confirmation..."/' /tmp/restore.sh
|
|
||||||
sed -i 's/BACKUP_DIR=\${BACKUP_DIR:-\/backups}/BACKUP_DIR=\/backups/' /tmp/restore.sh
|
|
||||||
sed -i 's/MYSQL_PASSWORD=\${MYSQL_PASSWORD:-password}/MYSQL_PASSWORD=${MYSQL_ROOT_PASSWORD}/' /tmp/restore.sh
|
|
||||||
|
|
||||||
# Extract timestamp from backup path and run restore
|
|
||||||
BACKUP_TIMESTAMP=$(basename "$RESTORE_BACKUP")
|
|
||||||
echo "🗄️ Restoring databases from backup: $BACKUP_TIMESTAMP"
|
|
||||||
/tmp/restore.sh "$BACKUP_TIMESTAMP"
|
|
||||||
|
|
||||||
echo "✅ Database restore completed successfully!"
|
|
||||||
|
|
||||||
# Keep MySQL running in foreground
|
|
||||||
wait $MYSQL_PID
|
|
||||||
else
|
|
||||||
# Normal startup without restore
|
|
||||||
exec docker-entrypoint.sh mysqld \
|
|
||||||
--datadir=/var/lib/mysql-runtime \
|
|
||||||
--default-authentication-plugin=mysql_native_password \
|
|
||||||
--character-set-server=${MYSQL_CHARACTER_SET} \
|
|
||||||
--collation-server=${MYSQL_COLLATION} \
|
|
||||||
--max_connections=${MYSQL_MAX_CONNECTIONS} \
|
|
||||||
--innodb-buffer-pool-size=${MYSQL_INNODB_BUFFER_POOL_SIZE} \
|
|
||||||
--innodb-log-file-size=${MYSQL_INNODB_LOG_FILE_SIZE}
|
|
||||||
fi
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "sh", "-c", "mysqladmin ping -h localhost -u ${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} --silent || exit 1"]
|
test: ["CMD", "sh", "-c", "mysqladmin ping -h localhost -u ${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} --silent || exit 1"]
|
||||||
@@ -162,59 +71,14 @@ services:
|
|||||||
- /bin/bash
|
- /bin/bash
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
echo "🔧 Starting enhanced backup service with hourly and daily schedules..."
|
# Install curl for downloading backup scheduler script (handle different package managers)
|
||||||
|
microdnf install -y curl || yum install -y curl || (apt-get update && apt-get install -y curl)
|
||||||
|
|
||||||
# Install curl if not available
|
# Download backup scheduler script from GitHub
|
||||||
apt-get update && apt-get install -y curl
|
echo "📥 Downloading backup scheduler script from GitHub..."
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/backup-scheduler.sh -o /tmp/backup-scheduler.sh
|
||||||
# Download backup scripts from GitHub
|
chmod +x /tmp/backup-scheduler.sh
|
||||||
echo "📥 Downloading backup scripts from GitHub..."
|
/tmp/backup-scheduler.sh
|
||||||
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/backup.sh -o /tmp/backup.sh
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/backup-hourly.sh -o /tmp/backup-hourly.sh
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/backup-daily.sh -o /tmp/backup-daily.sh
|
|
||||||
chmod +x /tmp/backup.sh /tmp/backup-hourly.sh /tmp/backup-daily.sh
|
|
||||||
|
|
||||||
# Wait for MySQL to be ready before starting backup service
|
|
||||||
echo "⏳ Waiting for MySQL to be ready..."
|
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Run initial daily backup
|
|
||||||
echo "🚀 Running initial daily backup..."
|
|
||||||
/tmp/backup-daily.sh
|
|
||||||
|
|
||||||
# Enhanced scheduler with hourly and daily backups
|
|
||||||
echo "⏰ Starting enhanced backup scheduler:"
|
|
||||||
echo " 📅 Daily backups: ${BACKUP_DAILY_TIME}:00 UTC (retention: ${BACKUP_RETENTION_DAYS} days)"
|
|
||||||
echo " ⏰ Hourly backups: every hour (retention: ${BACKUP_RETENTION_HOURS} hours)"
|
|
||||||
|
|
||||||
# Track last backup times to avoid duplicates
|
|
||||||
last_daily_hour=""
|
|
||||||
last_hourly_minute=""
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
current_hour=$(date +%H)
|
|
||||||
current_minute=$(date +%M)
|
|
||||||
current_time="$current_hour:$current_minute"
|
|
||||||
|
|
||||||
# Daily backup check (configurable time)
|
|
||||||
if [ "$$current_hour" = "${BACKUP_DAILY_TIME}" ] && [ "$$current_minute" = "00" ] && [ "$$last_daily_hour" != "$$current_hour" ]; then
|
|
||||||
echo "📅 [$(date)] Daily backup time reached, running daily backup..."
|
|
||||||
/tmp/backup-daily.sh
|
|
||||||
last_daily_hour="$$current_hour"
|
|
||||||
# Sleep for 2 minutes to avoid running multiple times
|
|
||||||
sleep 120
|
|
||||||
# Hourly backup check (every hour at minute 0, except during daily backup)
|
|
||||||
elif [ "$$current_minute" = "00" ] && [ "$$current_hour" != "${BACKUP_DAILY_TIME}" ] && [ "$$last_hourly_minute" != "$$current_minute" ]; then
|
|
||||||
echo "⏰ [$(date)] Hourly backup time reached, running hourly backup..."
|
|
||||||
/tmp/backup-hourly.sh
|
|
||||||
last_hourly_minute="$$current_minute"
|
|
||||||
# Sleep for 2 minutes to avoid running multiple times
|
|
||||||
sleep 120
|
|
||||||
else
|
|
||||||
# Sleep for 1 minute before checking again
|
|
||||||
sleep 60
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- azerothcore
|
- azerothcore
|
||||||
@@ -230,41 +94,28 @@ services:
|
|||||||
- azerothcore
|
- azerothcore
|
||||||
environment:
|
environment:
|
||||||
MYSQL_PWD: ${MYSQL_ROOT_PASSWORD}
|
MYSQL_PWD: ${MYSQL_ROOT_PASSWORD}
|
||||||
|
MYSQL_HOST: ${CONTAINER_MYSQL}
|
||||||
|
MYSQL_USER: ${MYSQL_USER}
|
||||||
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||||
|
DB_WAIT_RETRIES: ${DB_WAIT_RETRIES}
|
||||||
|
DB_WAIT_SLEEP: ${DB_WAIT_SLEEP}
|
||||||
|
DB_AUTH_NAME: ${DB_AUTH_NAME}
|
||||||
|
DB_WORLD_NAME: ${DB_WORLD_NAME}
|
||||||
|
DB_CHARACTERS_NAME: ${DB_CHARACTERS_NAME}
|
||||||
|
MYSQL_CHARACTER_SET: ${MYSQL_CHARACTER_SET}
|
||||||
|
MYSQL_COLLATION: ${MYSQL_COLLATION}
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
echo "🔧 Waiting for MySQL to be ready..."
|
# Install curl for downloading db init script (handle different package managers)
|
||||||
|
microdnf install -y curl || yum install -y curl || (apt-get update && apt-get install -y curl)
|
||||||
|
|
||||||
# Wait for MySQL to be responsive with longer timeout
|
# Download db init script from GitHub
|
||||||
for i in $(seq 1 ${DB_WAIT_RETRIES}); do
|
echo "📥 Downloading database initialization script from GitHub..."
|
||||||
if mysql -h ${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -e "SELECT 1;" >/dev/null 2>&1; then
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/db-init.sh -o /tmp/db-init.sh
|
||||||
echo "✅ MySQL is responsive"
|
chmod +x /tmp/db-init.sh
|
||||||
break
|
/tmp/db-init.sh
|
||||||
fi
|
|
||||||
echo "⏳ Waiting for MySQL... attempt $$i/${DB_WAIT_RETRIES}"
|
|
||||||
sleep ${DB_WAIT_SLEEP}
|
|
||||||
done
|
|
||||||
|
|
||||||
# Check if we should restore from backup
|
|
||||||
if [ -f "/var/lib/mysql-persistent/backup.sql" ]; then
|
|
||||||
echo "🔄 Restoring databases from backup..."
|
|
||||||
mysql -h ${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} < /var/lib/mysql-persistent/backup.sql || {
|
|
||||||
echo "⚠️ Backup restore failed, will create fresh databases"
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "🗄️ Creating/verifying AzerothCore databases..."
|
|
||||||
mysql -h ${MYSQL_HOST} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -e "
|
|
||||||
CREATE DATABASE IF NOT EXISTS ${DB_AUTH_NAME} DEFAULT CHARACTER SET ${MYSQL_CHARACTER_SET} COLLATE ${MYSQL_COLLATION};
|
|
||||||
CREATE DATABASE IF NOT EXISTS ${DB_WORLD_NAME} DEFAULT CHARACTER SET ${MYSQL_CHARACTER_SET} COLLATE ${MYSQL_COLLATION};
|
|
||||||
CREATE DATABASE IF NOT EXISTS ${DB_CHARACTERS_NAME} DEFAULT CHARACTER SET ${MYSQL_CHARACTER_SET} COLLATE ${MYSQL_COLLATION};
|
|
||||||
SHOW DATABASES;
|
|
||||||
" || {
|
|
||||||
echo "❌ Failed to create databases"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
echo "✅ Databases ready!"
|
|
||||||
restart: "no"
|
restart: "no"
|
||||||
|
|
||||||
# Step 4: Database import (one-time setup - run after db-init)
|
# Step 4: Database import (one-time setup - run after db-init)
|
||||||
@@ -290,36 +141,7 @@ services:
|
|||||||
AC_LOGGER_ROOT_CONFIG: "1,Console"
|
AC_LOGGER_ROOT_CONFIG: "1,Console"
|
||||||
AC_LOGGER_SERVER_CONFIG: "1,Console"
|
AC_LOGGER_SERVER_CONFIG: "1,Console"
|
||||||
AC_APPENDER_CONSOLE_CONFIG: "1,2,0"
|
AC_APPENDER_CONSOLE_CONFIG: "1,2,0"
|
||||||
entrypoint: ["/bin/bash", "-c"]
|
# Use the default AzerothCore dbimport entrypoint
|
||||||
command:
|
|
||||||
- |
|
|
||||||
echo 'Waiting for databases to be ready...'
|
|
||||||
|
|
||||||
# Wait for databases to exist with longer timeout
|
|
||||||
for i in $(seq 1 120); do
|
|
||||||
if mysql -h ${CONTAINER_MYSQL} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -e "USE ${DB_AUTH_NAME}; USE ${DB_WORLD_NAME}; USE ${DB_CHARACTERS_NAME};" >/dev/null 2>&1; then
|
|
||||||
echo "✅ All databases accessible"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
echo "⏳ Waiting for databases... attempt $$i/120"
|
|
||||||
sleep 5
|
|
||||||
done
|
|
||||||
|
|
||||||
echo 'Creating config file for dbimport...'
|
|
||||||
mkdir -p /azerothcore/env/dist/etc
|
|
||||||
cat > /azerothcore/env/dist/etc/dbimport.conf <<EOF
|
|
||||||
LoginDatabaseInfo = "${CONTAINER_MYSQL};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_AUTH_NAME}"
|
|
||||||
WorldDatabaseInfo = "${CONTAINER_MYSQL};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_WORLD_NAME}"
|
|
||||||
CharacterDatabaseInfo = "${CONTAINER_MYSQL};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_CHARACTERS_NAME}"
|
|
||||||
Updates.EnableDatabases = 7
|
|
||||||
Updates.AutoSetup = 1
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo 'Running database import...'
|
|
||||||
cd /azerothcore/env/dist/bin
|
|
||||||
./dbimport
|
|
||||||
|
|
||||||
echo 'Database import complete!'
|
|
||||||
restart: "no"
|
restart: "no"
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
361
scripts/GITHUB-HOSTED-SCRIPTS.md
Normal file
361
scripts/GITHUB-HOSTED-SCRIPTS.md
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
# GitHub-Hosted Service Scripts Documentation
|
||||||
|
|
||||||
|
This document describes the GitHub-hosted scripts that are automatically downloaded and executed by Docker containers during AzerothCore deployment.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
The AzerothCore Docker deployment uses a hybrid script management approach:
|
||||||
|
- **Local Scripts**: Run from your environment for setup and management
|
||||||
|
- **GitHub-Hosted Scripts**: Downloaded at runtime by containers for service operations
|
||||||
|
|
||||||
|
This pattern ensures Portainer compatibility while maintaining flexibility and maintainability.
|
||||||
|
|
||||||
|
## GitHub-Hosted Scripts
|
||||||
|
|
||||||
|
### 🗂️ `download-client-data.sh`
|
||||||
|
**Purpose**: Downloads and extracts WoW 3.3.5a client data files (~15GB)
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- Intelligent caching system to avoid re-downloads
|
||||||
|
- Progress monitoring during extraction
|
||||||
|
- Integrity verification of downloaded files
|
||||||
|
- Fallback URLs for reliability
|
||||||
|
- Automatic directory structure validation
|
||||||
|
|
||||||
|
**Container Usage**: `ac-client-data` service
|
||||||
|
**Volumes Required**:
|
||||||
|
- `/cache` - For caching downloaded files
|
||||||
|
- `/azerothcore/data` - For extracted game data
|
||||||
|
|
||||||
|
**Environment Variables**:
|
||||||
|
```bash
|
||||||
|
# Automatically set by container, no manual configuration needed
|
||||||
|
```
|
||||||
|
|
||||||
|
**Process Flow**:
|
||||||
|
1. Fetches latest release info from wowgaming/client-data
|
||||||
|
2. Checks cache for existing files
|
||||||
|
3. Downloads if not cached or corrupted
|
||||||
|
4. Extracts with progress monitoring
|
||||||
|
5. Validates directory structure (maps, vmaps, mmaps, dbc)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔧 `manage-modules.sh`
|
||||||
|
**Purpose**: Comprehensive AzerothCore module management and configuration
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- Dynamic module installation based on environment variables
|
||||||
|
- Automatic removal of disabled modules
|
||||||
|
- Configuration file management (.conf.dist → .conf)
|
||||||
|
- SQL script execution for module databases
|
||||||
|
- Module state tracking for rebuild detection
|
||||||
|
- Integration with external SQL script library
|
||||||
|
|
||||||
|
**Container Usage**: `ac-modules` service
|
||||||
|
**Volumes Required**:
|
||||||
|
- `/modules` - Module installation directory
|
||||||
|
- `/azerothcore/env/dist/etc` - Configuration files
|
||||||
|
|
||||||
|
**Environment Variables**:
|
||||||
|
```bash
|
||||||
|
# Git Configuration
|
||||||
|
GIT_EMAIL=your-email@example.com
|
||||||
|
GIT_PAT=your-github-token
|
||||||
|
GIT_USERNAME=your-username
|
||||||
|
|
||||||
|
# Module Toggle Variables (1=enabled, 0=disabled)
|
||||||
|
MODULE_PLAYERBOTS=1
|
||||||
|
MODULE_AOE_LOOT=1
|
||||||
|
MODULE_LEARN_SPELLS=1
|
||||||
|
MODULE_FIREWORKS=1
|
||||||
|
MODULE_INDIVIDUAL_PROGRESSION=1
|
||||||
|
MODULE_AHBOT=1
|
||||||
|
MODULE_AUTOBALANCE=1
|
||||||
|
MODULE_TRANSMOG=1
|
||||||
|
MODULE_NPC_BUFFER=1
|
||||||
|
MODULE_DYNAMIC_XP=1
|
||||||
|
MODULE_SOLO_LFG=1
|
||||||
|
MODULE_1V1_ARENA=1
|
||||||
|
MODULE_PHASED_DUELS=1
|
||||||
|
MODULE_BREAKING_NEWS=1
|
||||||
|
MODULE_BOSS_ANNOUNCER=1
|
||||||
|
MODULE_ACCOUNT_ACHIEVEMENTS=1
|
||||||
|
MODULE_AUTO_REVIVE=1
|
||||||
|
MODULE_GAIN_HONOR_GUARD=1
|
||||||
|
MODULE_ELUNA=1
|
||||||
|
MODULE_TIME_IS_TIME=1
|
||||||
|
MODULE_POCKET_PORTAL=1
|
||||||
|
MODULE_RANDOM_ENCHANTS=1
|
||||||
|
MODULE_SOLOCRAFT=1
|
||||||
|
MODULE_PVP_TITLES=1
|
||||||
|
MODULE_NPC_BEASTMASTER=1
|
||||||
|
MODULE_NPC_ENCHANTER=1
|
||||||
|
MODULE_INSTANCE_RESET=1
|
||||||
|
MODULE_LEVEL_GRANT=1
|
||||||
|
MODULE_ARAC=1
|
||||||
|
MODULE_ASSISTANT=1
|
||||||
|
MODULE_REAGENT_BANK=1
|
||||||
|
MODULE_BLACK_MARKET_AUCTION_HOUSE=1
|
||||||
|
|
||||||
|
# Database Configuration
|
||||||
|
CONTAINER_MYSQL=ac-mysql
|
||||||
|
MYSQL_ROOT_PASSWORD=your-password
|
||||||
|
DB_AUTH_NAME=acore_auth
|
||||||
|
DB_WORLD_NAME=acore_world
|
||||||
|
DB_CHARACTERS_NAME=acore_characters
|
||||||
|
```
|
||||||
|
|
||||||
|
**Process Flow**:
|
||||||
|
1. Sets up Git configuration for module downloads
|
||||||
|
2. Removes disabled modules from `/modules` directory
|
||||||
|
3. Clones enabled modules from GitHub repositories
|
||||||
|
4. Installs module configuration files
|
||||||
|
5. Executes module SQL scripts via `manage-modules-sql.sh`
|
||||||
|
6. Tracks module state changes for rebuild detection
|
||||||
|
7. Downloads rebuild script for user convenience
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🗄️ `manage-modules-sql.sh`
|
||||||
|
**Purpose**: SQL script execution functions for module database setup
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- Systematic SQL file discovery and execution
|
||||||
|
- Support for multiple database targets (auth, world, characters)
|
||||||
|
- Error handling and logging
|
||||||
|
- MariaDB client installation if needed
|
||||||
|
|
||||||
|
**Container Usage**: Sourced by `manage-modules.sh`
|
||||||
|
**Dependencies**: Requires MariaDB/MySQL client tools
|
||||||
|
|
||||||
|
**Function**: `execute_module_sql_scripts()`
|
||||||
|
- Executes SQL for all enabled modules
|
||||||
|
- Searches common SQL directories (`data/sql/`, `sql/`)
|
||||||
|
- Handles auth, world, and character database scripts
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🚀 `mysql-startup.sh`
|
||||||
|
**Purpose**: MySQL initialization with backup restoration support
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- NFS-compatible permission handling
|
||||||
|
- Automatic backup detection and restoration
|
||||||
|
- Support for multiple backup formats (daily, hourly, legacy)
|
||||||
|
- Configurable MySQL parameters
|
||||||
|
- Background restore operations
|
||||||
|
|
||||||
|
**Container Usage**: `ac-mysql` service
|
||||||
|
**Volumes Required**:
|
||||||
|
- `/var/lib/mysql-runtime` - Runtime MySQL data (tmpfs)
|
||||||
|
- `/backups` - Backup storage directory
|
||||||
|
|
||||||
|
**Environment Variables**:
|
||||||
|
```bash
|
||||||
|
MYSQL_CHARACTER_SET=utf8mb4
|
||||||
|
MYSQL_COLLATION=utf8mb4_unicode_ci
|
||||||
|
MYSQL_MAX_CONNECTIONS=500
|
||||||
|
MYSQL_INNODB_BUFFER_POOL_SIZE=1G
|
||||||
|
MYSQL_INNODB_LOG_FILE_SIZE=256M
|
||||||
|
MYSQL_ROOT_PASSWORD=your-password
|
||||||
|
```
|
||||||
|
|
||||||
|
**Process Flow**:
|
||||||
|
1. Creates and configures runtime MySQL directory
|
||||||
|
2. Scans for available backups (daily → hourly → legacy)
|
||||||
|
3. Starts MySQL in background if restore needed
|
||||||
|
4. Downloads and executes restore script from GitHub
|
||||||
|
5. Runs MySQL normally if no restore required
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ⏰ `backup-scheduler.sh`
|
||||||
|
**Purpose**: Enhanced backup scheduler with hourly and daily schedules
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- Configurable backup timing
|
||||||
|
- Separate hourly and daily backup retention
|
||||||
|
- Automatic backup script downloading
|
||||||
|
- Collision avoidance between backup types
|
||||||
|
- Initial backup execution
|
||||||
|
|
||||||
|
**Container Usage**: `ac-backup` service
|
||||||
|
**Volumes Required**:
|
||||||
|
- `/backups` - Backup storage directory
|
||||||
|
|
||||||
|
**Environment Variables**:
|
||||||
|
```bash
|
||||||
|
BACKUP_DAILY_TIME=03 # Hour for daily backups (UTC)
|
||||||
|
BACKUP_RETENTION_DAYS=7 # Daily backup retention
|
||||||
|
BACKUP_RETENTION_HOURS=48 # Hourly backup retention
|
||||||
|
MYSQL_HOST=ac-mysql
|
||||||
|
MYSQL_ROOT_PASSWORD=your-password
|
||||||
|
```
|
||||||
|
|
||||||
|
**Process Flow**:
|
||||||
|
1. Downloads backup scripts from GitHub
|
||||||
|
2. Waits for MySQL to be available
|
||||||
|
3. Executes initial daily backup
|
||||||
|
4. Runs continuous scheduler loop
|
||||||
|
5. Executes hourly/daily backups based on time
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🏗️ `db-init.sh`
|
||||||
|
**Purpose**: Database creation and initialization
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- MySQL readiness validation
|
||||||
|
- Legacy backup restoration support
|
||||||
|
- AzerothCore database creation
|
||||||
|
- Character set and collation configuration
|
||||||
|
|
||||||
|
**Container Usage**: `ac-db-init` service
|
||||||
|
|
||||||
|
**Environment Variables**:
|
||||||
|
```bash
|
||||||
|
MYSQL_HOST=ac-mysql
|
||||||
|
MYSQL_USER=root
|
||||||
|
MYSQL_ROOT_PASSWORD=your-password
|
||||||
|
DB_AUTH_NAME=acore_auth
|
||||||
|
DB_WORLD_NAME=acore_world
|
||||||
|
DB_CHARACTERS_NAME=acore_characters
|
||||||
|
MYSQL_CHARACTER_SET=utf8mb4
|
||||||
|
MYSQL_COLLATION=utf8mb4_unicode_ci
|
||||||
|
DB_WAIT_RETRIES=60
|
||||||
|
DB_WAIT_SLEEP=5
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 📥 `db-import.sh`
|
||||||
|
**Purpose**: Database schema import operations
|
||||||
|
|
||||||
|
**Features**:
|
||||||
|
- Database availability verification
|
||||||
|
- Dynamic configuration file generation
|
||||||
|
- AzerothCore dbimport execution
|
||||||
|
- Extended timeout handling
|
||||||
|
|
||||||
|
**Container Usage**: `ac-db-import` service
|
||||||
|
|
||||||
|
**Environment Variables**:
|
||||||
|
```bash
|
||||||
|
CONTAINER_MYSQL=ac-mysql
|
||||||
|
MYSQL_PORT=3306
|
||||||
|
MYSQL_USER=root
|
||||||
|
MYSQL_ROOT_PASSWORD=your-password
|
||||||
|
DB_AUTH_NAME=acore_auth
|
||||||
|
DB_WORLD_NAME=acore_world
|
||||||
|
DB_CHARACTERS_NAME=acore_characters
|
||||||
|
```
|
||||||
|
|
||||||
|
## Script Deployment Pattern
|
||||||
|
|
||||||
|
### Download Pattern
|
||||||
|
All GitHub-hosted scripts use this consistent pattern:
|
||||||
|
```bash
|
||||||
|
# Install curl if needed
|
||||||
|
apk add --no-cache curl # Alpine
|
||||||
|
# OR
|
||||||
|
apt-get update && apt-get install -y curl # Debian/Ubuntu
|
||||||
|
|
||||||
|
# Download script
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/SCRIPT_NAME.sh -o /tmp/SCRIPT_NAME.sh
|
||||||
|
|
||||||
|
# Make executable and run
|
||||||
|
chmod +x /tmp/SCRIPT_NAME.sh
|
||||||
|
/tmp/SCRIPT_NAME.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
- All scripts use `set -e` for immediate exit on errors
|
||||||
|
- Network failures trigger retries or fallback mechanisms
|
||||||
|
- Missing dependencies are automatically installed
|
||||||
|
- Detailed logging with emoji indicators for easy monitoring
|
||||||
|
|
||||||
|
### Security Considerations
|
||||||
|
- Scripts are downloaded from the official repository
|
||||||
|
- HTTPS is used for all downloads
|
||||||
|
- File integrity is verified where applicable
|
||||||
|
- Minimal privilege escalation (only when necessary)
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### Common Issues
|
||||||
|
|
||||||
|
**Script Download Failures**:
|
||||||
|
```bash
|
||||||
|
# Check network connectivity
|
||||||
|
ping raw.githubusercontent.com
|
||||||
|
|
||||||
|
# Manual download test
|
||||||
|
curl -v https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/download-client-data.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
**Module Installation Issues**:
|
||||||
|
```bash
|
||||||
|
# Check module environment variables
|
||||||
|
docker exec ac-modules env | grep MODULE_
|
||||||
|
|
||||||
|
# Verify Git authentication
|
||||||
|
docker exec ac-modules git config --list
|
||||||
|
```
|
||||||
|
|
||||||
|
**Database Connection Issues**:
|
||||||
|
```bash
|
||||||
|
# Test MySQL connectivity
|
||||||
|
docker exec ac-db-init mysql -h ac-mysql -u root -p[password] -e "SELECT 1;"
|
||||||
|
|
||||||
|
# Check database container status
|
||||||
|
docker logs ac-mysql
|
||||||
|
```
|
||||||
|
|
||||||
|
### Manual Script Testing
|
||||||
|
|
||||||
|
You can download and test any GitHub-hosted script manually:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create test environment
|
||||||
|
mkdir -p /tmp/script-test
|
||||||
|
cd /tmp/script-test
|
||||||
|
|
||||||
|
# Download script
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/SCRIPT_NAME.sh -o test-script.sh
|
||||||
|
|
||||||
|
# Review script content
|
||||||
|
cat test-script.sh
|
||||||
|
|
||||||
|
# Set required environment variables
|
||||||
|
export MYSQL_ROOT_PASSWORD=testpass
|
||||||
|
# ... other variables as needed
|
||||||
|
|
||||||
|
# Execute (with caution - some scripts modify filesystem)
|
||||||
|
chmod +x test-script.sh
|
||||||
|
./test-script.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## Benefits of GitHub-Hosted Pattern
|
||||||
|
|
||||||
|
### ✅ Portainer Compatibility
|
||||||
|
- Only requires `docker-compose.yml` and `.env` files
|
||||||
|
- No additional file dependencies
|
||||||
|
- Works with any Docker Compose deployment method
|
||||||
|
|
||||||
|
### ✅ Maintainability
|
||||||
|
- Scripts can be updated without rebuilding containers
|
||||||
|
- Version control for all service logic
|
||||||
|
- Easy rollback to previous versions
|
||||||
|
|
||||||
|
### ✅ Consistency
|
||||||
|
- Same scripts across all environments
|
||||||
|
- Centralized script management
|
||||||
|
- Reduced configuration drift
|
||||||
|
|
||||||
|
### ✅ Reliability
|
||||||
|
- Fallback mechanisms for network failures
|
||||||
|
- Automatic dependency installation
|
||||||
|
- Comprehensive error handling
|
||||||
|
|
||||||
|
This pattern makes the AzerothCore deployment both powerful and portable, suitable for everything from local development to production Portainer deployments.
|
||||||
Reference in New Issue
Block a user