add post install configuration

This commit is contained in:
uprightbass360
2025-10-01 20:58:13 -04:00
parent 48b1b5b0af
commit ba541fbf78
5 changed files with 334 additions and 2 deletions

102
scripts/post-install-setup.sh Executable file
View File

@@ -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"

96
scripts/update-config.sh Executable file
View File

@@ -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"

112
scripts/update-realmlist.sh Executable file
View File

@@ -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}"