diff --git a/docker-compose-azerothcore-services.env b/docker-compose-azerothcore-services.env index 915c739..07dfef2 100644 --- a/docker-compose-azerothcore-services.env +++ b/docker-compose-azerothcore-services.env @@ -65,6 +65,11 @@ AUTH_EXTERNAL_PORT=3784 WORLD_EXTERNAL_PORT=8215 SOAP_EXTERNAL_PORT=7778 +# Server address for client connections (production) +SERVER_ADDRESS=192.168.0.188 +# Use WORLD_EXTERNAL_PORT for realmlist (client connection port) +REALM_PORT=8215 + # Internal ports (container side) AUTH_PORT=3724 WORLD_PORT=8085 @@ -139,4 +144,12 @@ MODULE_LEVEL_GRANT=0 # ADDITIONAL CONTAINER NAMES (OPTIONAL) # ============================================== # Optional service container names -CONTAINER_ELUNA=ac-eluna \ No newline at end of file +CONTAINER_ELUNA=ac-eluna +CONTAINER_MODULES=ac-modules + +# ============================================== +# MODULE MANAGEMENT (OPTIONAL) +# ============================================== +GIT_USERNAME= +GIT_EMAIL= +GIT_PAT= \ No newline at end of file diff --git a/readme.md b/readme.md index 156aec1..0d305b7 100644 --- a/readme.md +++ b/readme.md @@ -79,7 +79,16 @@ This project provides a production-ready AzerothCore deployment using Docker/Pod ## Available Modules -This deployment includes an automated module management system that supports 28 AzerothCore modules. All modules are automatically downloaded from GitHub when enabled and include proper configuration files. +This deployment includes a **comprehensive automated module management system** that supports 28 AzerothCore modules with: + +- ✅ **Automatic module installation and removal** +- ✅ **State tracking with rebuild detection** +- ✅ **SQL script execution for database setup** +- ✅ **Configuration file management** +- ✅ **Source-based compilation integration** +- ✅ **Compatibility analysis and documentation** + +All modules are automatically downloaded from GitHub when enabled and include proper configuration files. ### Quality of Life Modules diff --git a/scripts/post-install-setup.sh b/scripts/post-install-setup.sh new file mode 100755 index 0000000..457ab58 --- /dev/null +++ b/scripts/post-install-setup.sh @@ -0,0 +1,102 @@ +#!/bin/bash + +# AzerothCore Post-Installation Setup Script +# Configures fresh authserver and worldserver installations for production + +set -e + +echo "🚀 AzerothCore Post-Installation Setup" +echo "=====================================" +echo "" + +# Load environment variables from env file if it exists +if [ -f "docker-compose-azerothcore-services.env" ]; then + echo "📂 Loading environment from docker-compose-azerothcore-services.env" + set -a # automatically export all variables + source docker-compose-azerothcore-services.env + set +a # turn off automatic export + echo "" +fi + +# Configuration variables from environment +MYSQL_HOST="${MYSQL_HOST:-ac-mysql}" +MYSQL_PORT="${MYSQL_PORT:-3306}" +MYSQL_USER="${MYSQL_USER:-root}" +MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD:-azerothcore123}" +DB_AUTH_NAME="${DB_AUTH_NAME:-acore_auth}" +DB_WORLD_NAME="${DB_WORLD_NAME:-acore_world}" +DB_CHARACTERS_NAME="${DB_CHARACTERS_NAME:-acore_characters}" +STORAGE_PATH="${STORAGE_PATH:-./storage/azerothcore}" +SERVER_ADDRESS="${SERVER_ADDRESS:-127.0.0.1}" +SERVER_PORT="${REALM_PORT:-8085}" + +echo "📋 Configuration Summary:" +echo " Database: ${MYSQL_HOST}:${MYSQL_PORT}" +echo " Auth DB: ${DB_AUTH_NAME}" +echo " World DB: ${DB_WORLD_NAME}" +echo " Characters DB: ${DB_CHARACTERS_NAME}" +echo " Storage: ${STORAGE_PATH}" +echo " Server: ${SERVER_ADDRESS}:${SERVER_PORT}" +echo "" + +# Step 1: Update configuration files +echo "🔧 Step 1: Updating configuration files..." +if [ ! -x "./scripts/update-config.sh" ]; then + echo "❌ Error: update-config.sh script not found or not executable" + exit 1 +fi + +echo "password" | sudo -S STORAGE_PATH="${STORAGE_PATH}" ./scripts/update-config.sh +if [ $? -eq 0 ]; then + echo "✅ Configuration files updated successfully" +else + echo "❌ Failed to update configuration files" + exit 1 +fi + +echo "" + +# Step 2: Update realmlist table +echo "🌐 Step 2: Updating realmlist table..." +if [ ! -x "./scripts/update-realmlist.sh" ]; then + echo "❌ Error: update-realmlist.sh script not found or not executable" + exit 1 +fi + +./scripts/update-realmlist.sh +if [ $? -eq 0 ]; then + echo "✅ Realmlist table updated successfully" +else + echo "❌ Failed to update realmlist table" + exit 1 +fi + +echo "" + +# Step 3: Restart services to apply changes +echo "🔄 Step 3: Restarting services to apply changes..." +docker compose -f docker-compose-azerothcore-services.yml restart ac-authserver ac-worldserver + +if [ $? -eq 0 ]; then + echo "✅ Services restarted successfully" +else + echo "❌ Failed to restart services" + exit 1 +fi + +echo "" +echo "🎉 Post-installation setup completed successfully!" +echo "" +echo "📋 Summary of changes:" +echo " ✅ AuthServer configured with production database settings" +echo " ✅ WorldServer configured with production database settings" +echo " ✅ Realmlist updated with server address: ${SERVER_ADDRESS}:${SERVER_PORT}" +echo " ✅ Services restarted to apply changes" +echo "" +echo "🎮 Your AzerothCore server is now ready for production!" +echo " Players can connect to: ${SERVER_ADDRESS}:${SERVER_PORT}" +echo "" +echo "💡 Next steps:" +echo " 1. Create admin accounts using the worldserver console" +echo " 2. Test client connectivity" +echo " 3. Configure any additional modules as needed" \ No newline at end of file diff --git a/scripts/update-config.sh b/scripts/update-config.sh new file mode 100755 index 0000000..98dc9d0 --- /dev/null +++ b/scripts/update-config.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +# AzerothCore Configuration Update Script +# Updates .conf files with production database settings + +set -e + +echo "🔧 AzerothCore Configuration Update Script" +echo "==========================================" + +# Load environment variables from env file if it exists +if [ -f "docker-compose-azerothcore-services.env" ]; then + echo "📂 Loading environment from docker-compose-azerothcore-services.env" + set -a # automatically export all variables + source docker-compose-azerothcore-services.env + set +a # turn off automatic export + echo "" +fi + +# Configuration variables from environment +MYSQL_HOST="${MYSQL_HOST:-ac-mysql}" +MYSQL_PORT="${MYSQL_PORT:-3306}" +MYSQL_USER="${MYSQL_USER:-root}" +MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD:-azerothcore123}" +DB_AUTH_NAME="${DB_AUTH_NAME:-acore_auth}" +DB_WORLD_NAME="${DB_WORLD_NAME:-acore_world}" +DB_CHARACTERS_NAME="${DB_CHARACTERS_NAME:-acore_characters}" + +# Configuration file paths +CONFIG_DIR="${STORAGE_PATH}/config" +AUTHSERVER_CONF="${CONFIG_DIR}/authserver.conf" +WORLDSERVER_CONF="${CONFIG_DIR}/worldserver.conf" + +echo "📍 Configuration directory: ${CONFIG_DIR}" + +# Check if configuration files exist +if [ ! -f "${AUTHSERVER_CONF}" ]; then + echo "❌ Error: ${AUTHSERVER_CONF} not found" + exit 1 +fi + +if [ ! -f "${WORLDSERVER_CONF}" ]; then + echo "❌ Error: ${WORLDSERVER_CONF} not found" + exit 1 +fi + +echo "✅ Configuration files found" + +# Backup original files +echo "💾 Creating backups..." +cp "${AUTHSERVER_CONF}" "${AUTHSERVER_CONF}.backup.$(date +%Y%m%d_%H%M%S)" +cp "${WORLDSERVER_CONF}" "${WORLDSERVER_CONF}.backup.$(date +%Y%m%d_%H%M%S)" + +# Update AuthServer configuration +echo "🔧 Updating AuthServer configuration..." +sed -i "s/^LoginDatabaseInfo = .*/LoginDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_AUTH_NAME}\"/" "${AUTHSERVER_CONF}" + +# Verify AuthServer update +AUTH_UPDATED=$(grep "LoginDatabaseInfo" "${AUTHSERVER_CONF}" | grep "${MYSQL_HOST}") +if [ -n "${AUTH_UPDATED}" ]; then + echo "✅ AuthServer configuration updated successfully" + echo " ${AUTH_UPDATED}" +else + echo "❌ Failed to update AuthServer configuration" + exit 1 +fi + +# Update WorldServer configuration +echo "🔧 Updating WorldServer configuration..." +sed -i "s/^LoginDatabaseInfo = .*/LoginDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_AUTH_NAME}\"/" "${WORLDSERVER_CONF}" +sed -i "s/^WorldDatabaseInfo = .*/WorldDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_WORLD_NAME}\"/" "${WORLDSERVER_CONF}" +sed -i "s/^CharacterDatabaseInfo = .*/CharacterDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_CHARACTERS_NAME}\"/" "${WORLDSERVER_CONF}" + +# Verify WorldServer updates +LOGIN_UPDATED=$(grep "^LoginDatabaseInfo" "${WORLDSERVER_CONF}" | grep "${MYSQL_HOST}") +WORLD_UPDATED=$(grep "^WorldDatabaseInfo" "${WORLDSERVER_CONF}" | grep "${MYSQL_HOST}") +CHARACTER_UPDATED=$(grep "^CharacterDatabaseInfo" "${WORLDSERVER_CONF}" | grep "${MYSQL_HOST}") + +if [ -n "${LOGIN_UPDATED}" ] && [ -n "${WORLD_UPDATED}" ] && [ -n "${CHARACTER_UPDATED}" ]; then + echo "✅ WorldServer configuration updated successfully" + echo " Login: ${LOGIN_UPDATED}" + echo " World: ${WORLD_UPDATED}" + echo " Character: ${CHARACTER_UPDATED}" +else + echo "❌ Failed to update WorldServer configuration" + exit 1 +fi + +echo "" +echo "🎉 Configuration update completed successfully!" +echo "📋 Updated files:" +echo " - ${AUTHSERVER_CONF}" +echo " - ${WORLDSERVER_CONF}" +echo "" +echo "💡 Restart authserver and worldserver services to apply changes:" +echo " docker compose -f docker-compose-azerothcore-services.yml restart ac-authserver ac-worldserver" \ No newline at end of file diff --git a/scripts/update-realmlist.sh b/scripts/update-realmlist.sh new file mode 100755 index 0000000..b88ecba --- /dev/null +++ b/scripts/update-realmlist.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# AzerothCore Realmlist Update Script +# Updates the realmlist table with production server address and port + +set -e + +echo "🌐 AzerothCore Realmlist Update Script" +echo "======================================" + +# Store any pre-existing environment variables +SAVED_SERVER_ADDRESS="$SERVER_ADDRESS" +SAVED_REALM_PORT="$REALM_PORT" + +# Load environment variables from env file if it exists +if [ -f "docker-compose-azerothcore-services.env" ]; then + echo "📂 Loading environment from docker-compose-azerothcore-services.env" + set -a # automatically export all variables + source docker-compose-azerothcore-services.env + set +a # turn off automatic export +fi + +# Restore command line variables if they were set +if [ -n "$SAVED_SERVER_ADDRESS" ]; then + SERVER_ADDRESS="$SAVED_SERVER_ADDRESS" + echo "🔧 Using command line SERVER_ADDRESS: $SERVER_ADDRESS" +fi +if [ -n "$SAVED_REALM_PORT" ]; then + REALM_PORT="$SAVED_REALM_PORT" + echo "🔧 Using command line REALM_PORT: $REALM_PORT" +fi + +# Configuration variables from environment +MYSQL_HOST="${MYSQL_HOST:-ac-mysql}" +MYSQL_PORT="${MYSQL_PORT:-3306}" +MYSQL_USER="${MYSQL_USER:-root}" +MYSQL_ROOT_PASSWORD="${MYSQL_ROOT_PASSWORD:-azerothcore123}" +DB_AUTH_NAME="${DB_AUTH_NAME:-acore_auth}" + +# Server configuration - Loaded from environment file or command line +SERVER_ADDRESS="${SERVER_ADDRESS:-127.0.0.1}" +SERVER_PORT="${REALM_PORT:-8085}" +REALM_ID="${REALM_ID:-1}" + +echo "📍 Database: ${MYSQL_HOST}:${MYSQL_PORT}/${DB_AUTH_NAME}" +echo "🌐 Server Address: ${SERVER_ADDRESS}:${SERVER_PORT}" +echo "🏰 Realm ID: ${REALM_ID}" + +# Test database connection +echo "🔌 Testing database connection..." +docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -e "SELECT 1;" > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "✅ Database connection successful" +else + echo "❌ Database connection failed" + exit 1 +fi + +# Check current realmlist entries +echo "📋 Current realmlist entries:" +docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -e "SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist;" + +# Check if realm ID exists before updating +echo "🔍 Checking if realm ID ${REALM_ID} exists..." +REALM_EXISTS=$(docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -se "SELECT COUNT(*) FROM realmlist WHERE id = ${REALM_ID};") +if [ "${REALM_EXISTS}" -eq 0 ]; then + echo "❌ Error: Realm ID ${REALM_ID} does not exist in realmlist table" + echo "💡 Available realm IDs:" + docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -e "SELECT id, name FROM realmlist;" + exit 1 +fi + +echo "✅ Realm ID ${REALM_ID} found" + +# Check if update is needed (compare current values) +CURRENT_VALUES=$(docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -se "SELECT CONCAT(address, ':', port) FROM realmlist WHERE id = ${REALM_ID};") +TARGET_VALUES="${SERVER_ADDRESS}:${SERVER_PORT}" + +if [ "${CURRENT_VALUES}" = "${TARGET_VALUES}" ]; then + echo "ℹ️ Values already match target (${TARGET_VALUES}) - no update needed" + echo "✅ Realmlist is already configured correctly" +else + echo "🔧 Updating existing realm ID ${REALM_ID} from ${CURRENT_VALUES} to ${TARGET_VALUES}..." + docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -e "UPDATE realmlist SET address = '${SERVER_ADDRESS}', port = ${SERVER_PORT} WHERE id = ${REALM_ID};" + + if [ $? -eq 0 ]; then + # Verify the change was applied + NEW_VALUES=$(docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -se "SELECT CONCAT(address, ':', port) FROM realmlist WHERE id = ${REALM_ID};") + if [ "${NEW_VALUES}" = "${TARGET_VALUES}" ]; then + echo "✅ Realmlist update successful (${CURRENT_VALUES} → ${NEW_VALUES})" + else + echo "❌ Update failed - values did not change (${NEW_VALUES})" + exit 1 + fi + else + echo "❌ Failed to execute UPDATE statement" + exit 1 + fi +fi + +# Verify the update +echo "📋 Updated realmlist entries:" +docker exec ac-mysql mysql -u "${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" -e "SELECT id, name, address, localAddress, localSubnetMask, port, icon, flag, timezone, allowedSecurityLevel, population, gamebuild FROM realmlist WHERE id = ${REALM_ID};" + +echo "" +echo "🎉 Realmlist update completed successfully!" +echo "📋 Summary:" +echo " - Realm ID: ${REALM_ID}" +echo " - Address: ${SERVER_ADDRESS}" +echo " - Port: ${SERVER_PORT}" +echo "" +echo "💡 Players should now connect to: ${SERVER_ADDRESS}:${SERVER_PORT}" \ No newline at end of file