diff --git a/scripts/deploy-and-check.sh b/scripts/deploy-and-check.sh index 84183ea..25e4492 100755 --- a/scripts/deploy-and-check.sh +++ b/scripts/deploy-and-check.sh @@ -4,7 +4,7 @@ # AzerothCore Docker Deployment & Health Check Script # ============================================== # This script deploys the complete AzerothCore stack and performs comprehensive health checks -# Usage: ./deploy-and-check.sh [--skip-deploy] [--quick-check] +# Usage: ./deploy-and-check.sh [--skip-deploy] [--quick-check] [--setup] set -e # Exit on any error @@ -18,6 +18,8 @@ NC='\033[0m' # No Color # Script options SKIP_DEPLOY=false QUICK_CHECK=false +RUN_SETUP=false +MODULES_ENABLED=false # Parse command line arguments while [[ $# -gt 0 ]]; do @@ -30,10 +32,15 @@ while [[ $# -gt 0 ]]; do QUICK_CHECK=true shift ;; + --setup) + RUN_SETUP=true + shift + ;; -h|--help) - echo "Usage: $0 [--skip-deploy] [--quick-check]" + echo "Usage: $0 [--skip-deploy] [--quick-check] [--setup]" echo " --skip-deploy Skip deployment, only run health checks" echo " --quick-check Run basic health checks only" + echo " --setup Run interactive server setup before deployment" exit 0 ;; *) @@ -162,6 +169,7 @@ deploy_stack() { # Check if custom environment files exist first, then fallback to base files DB_ENV_FILE="../docker-compose-azerothcore-database-custom.env" SERVICES_ENV_FILE="../docker-compose-azerothcore-services-custom.env" + MODULES_ENV_FILE="../docker-compose-azerothcore-modules-custom.env" TOOLS_ENV_FILE="../docker-compose-azerothcore-tools-custom.env" # Fallback to base files if custom files don't exist @@ -171,11 +179,14 @@ deploy_stack() { if [ ! -f "$SERVICES_ENV_FILE" ]; then SERVICES_ENV_FILE="../docker-compose-azerothcore-services.env" fi + if [ ! -f "$MODULES_ENV_FILE" ]; then + MODULES_ENV_FILE="../docker-compose-azerothcore-modules.env" + fi if [ ! -f "$TOOLS_ENV_FILE" ]; then TOOLS_ENV_FILE="../docker-compose-azerothcore-tools.env" fi - # Check if environment files exist + # Check if required environment files exist for env_file in "$DB_ENV_FILE" "$SERVICES_ENV_FILE" "$TOOLS_ENV_FILE"; do if [ ! -f "$env_file" ]; then print_status "ERROR" "Environment file $env_file not found" @@ -184,8 +195,15 @@ deploy_stack() { fi done + # Check if modules are enabled (set global variable) + if [ -f "$MODULES_ENV_FILE" ]; then + MODULES_ENABLED=true + else + MODULES_ENABLED=false + fi + print_status "INFO" "Step 1: Deploying database layer..." - docker compose --env-file "$DB_ENV_FILE" -f ../docker-compose-azerothcore-database.yml up -d + docker compose --env-file "$DB_ENV_FILE" -f ../docker-compose-azerothcore-database.yml up -d --remove-orphans # Wait for database initialization wait_for_service "MySQL" 24 "docker exec ac-mysql mysql -uroot -pazerothcore123 -e 'SELECT 1' >/dev/null 2>&1" @@ -194,7 +212,7 @@ deploy_stack() { wait_for_service "Database Import" 36 "docker inspect ac-db-import --format='{{.State.ExitCode}}' 2>/dev/null | grep -q '^0$' || docker logs ac-db-import 2>/dev/null | grep -q 'Database import complete'" print_status "INFO" "Step 2: Deploying services layer..." - docker compose --env-file "$SERVICES_ENV_FILE" -f ../docker-compose-azerothcore-services.yml up -d + docker compose --env-file "$SERVICES_ENV_FILE" -f ../docker-compose-azerothcore-services.yml up -d --remove-orphans # Wait for client data extraction print_status "INFO" "Waiting for client data download and extraction (this may take 10-20 minutes)..." @@ -203,8 +221,22 @@ deploy_stack() { # Wait for worldserver to be healthy wait_for_service "World Server" 24 "check_container_health ac-worldserver" - print_status "INFO" "Step 3: Deploying tools layer..." - docker compose --env-file "$TOOLS_ENV_FILE" -f ../docker-compose-azerothcore-tools.yml up -d + # Deploy modules if enabled + if [ "$MODULES_ENABLED" = true ]; then + print_status "INFO" "Step 3: Deploying modules layer..." + docker compose --env-file "$MODULES_ENV_FILE" -f ../docker-compose-azerothcore-modules.yml up -d --remove-orphans + + # Wait for modules to be ready + sleep 5 + + STEP_NUMBER=4 + else + print_status "INFO" "Modules layer skipped (no custom modules configuration found)" + STEP_NUMBER=3 + fi + + print_status "INFO" "Step $STEP_NUMBER: Deploying tools layer..." + docker compose --env-file "$TOOLS_ENV_FILE" -f ../docker-compose-azerothcore-tools.yml up -d --remove-orphans # Wait for tools to be ready sleep 10 @@ -218,6 +250,12 @@ perform_health_checks() { # Check all containers local containers=("ac-mysql" "ac-backup" "ac-authserver" "ac-worldserver" "ac-phpmyadmin" "ac-keira3") + + # Add modules container if modules are enabled + if [ "$MODULES_ENABLED" = true ]; then + containers+=("ac-modules") + fi + local container_failures=0 for container in "${containers[@]}"; do @@ -329,6 +367,31 @@ main() { exit 1 fi + # Run setup if requested + if [ "$RUN_SETUP" = true ]; then + print_status "HEADER" "RUNNING SERVER SETUP" + print_status "INFO" "Starting interactive server configuration..." + + # Change to parent directory to run setup script + cd "$(dirname "$(pwd)")" + + if [ -f "scripts/setup-server.sh" ]; then + bash scripts/setup-server.sh + if [ $? -ne 0 ]; then + print_status "ERROR" "Server setup failed or was cancelled" + exit 1 + fi + else + print_status "ERROR" "Setup script not found at scripts/setup-server.sh" + exit 1 + fi + + # Return to scripts directory + cd scripts + print_status "SUCCESS" "Server setup completed!" + echo "" + fi + # Deploy the stack unless skipped if [ "$SKIP_DEPLOY" = false ]; then deploy_stack diff --git a/scripts/setup-server.sh b/scripts/setup-server.sh index d7439f7..74e4eab 100755 --- a/scripts/setup-server.sh +++ b/scripts/setup-server.sh @@ -269,13 +269,14 @@ main() { print_status "HEADER" "MODULE CONFIGURATION" echo "AzerothCore supports 25+ enhancement modules. Choose your setup:" echo "1) Suggested Modules (recommended for beginners)" - echo "2) Manual Selection (advanced users)" - echo "3) No Modules (vanilla experience)" + echo "2) Playerbots Setup (AI companions + solo-friendly modules)" + echo "3) Manual Selection (advanced users)" + echo "4) No Modules (vanilla experience)" echo "" MODULE_SELECTION_MODE="" while true; do - read -p "$(echo -e "${YELLOW}🔧 Select module configuration [1-3]: ${NC}")" module_choice + read -p "$(echo -e "${YELLOW}🔧 Select module configuration [1-4]: ${NC}")" module_choice case $module_choice in 1) MODULE_SELECTION_MODE="suggested" @@ -292,6 +293,23 @@ main() { break ;; 2) + MODULE_SELECTION_MODE="playerbots" + print_status "INFO" "Playerbots Setup Selected:" + echo " 🤖 Playerbots - AI companions and guild members" + echo " ✅ Solo LFG - Dungeon finder for solo players" + echo " ✅ Solocraft - Scale content for solo players" + echo " ✅ Autobalance - Dynamic dungeon difficulty" + echo " ✅ AH Bot - Auction house automation" + echo " ✅ Transmog - Equipment appearance customization" + echo " ✅ NPC Buffer - Convenience buffs" + echo " ✅ Learn Spells - Auto-learn class spells" + echo " ✅ Fireworks - Level-up celebrations" + echo "" + print_status "WARNING" "Playerbots requires special build - this setup uses uprightbass360/azerothcore-wotlk-playerbots" + echo "" + break + ;; + 3) MODULE_SELECTION_MODE="manual" print_status "INFO" "Manual Module Selection:" echo " You will be prompted for each of the 25+ available modules" @@ -299,7 +317,7 @@ main() { echo "" break ;; - 3) + 4) MODULE_SELECTION_MODE="none" print_status "INFO" "No Modules Selected:" echo " Pure AzerothCore experience without enhancements" @@ -308,7 +326,7 @@ main() { break ;; *) - print_status "ERROR" "Please select 1, 2, or 3" + print_status "ERROR" "Please select 1, 2, 3, or 4" ;; esac done @@ -359,15 +377,27 @@ main() { MODULE_LEARN_SPELLS=1 MODULE_FIREWORKS=1 + elif [ "$MODULE_SELECTION_MODE" = "playerbots" ]; then + # Enable playerbots + solo-friendly modules + MODULE_PLAYERBOTS=1 + MODULE_SOLO_LFG=1 + MODULE_SOLOCRAFT=1 + MODULE_AUTOBALANCE=1 + MODULE_AHBOT=1 + MODULE_TRANSMOG=1 + MODULE_NPC_BUFFER=1 + MODULE_LEARN_SPELLS=1 + MODULE_FIREWORKS=1 + elif [ "$MODULE_SELECTION_MODE" = "manual" ]; then print_status "PROMPT" "Configure each module (y/n):" # Core Gameplay Modules echo -e "\n${BLUE}🎮 Core Gameplay Modules:${NC}" + MODULE_PLAYERBOTS=$(prompt_yes_no "Playerbots - AI companions (uses uprightbass360/azerothcore-wotlk-playerbots build)" "n") MODULE_SOLO_LFG=$(prompt_yes_no "Solo LFG - Dungeon finder for solo players" "n") MODULE_SOLOCRAFT=$(prompt_yes_no "Solocraft - Scale dungeons/raids for solo play" "n") MODULE_AUTOBALANCE=$(prompt_yes_no "Autobalance - Dynamic difficulty scaling" "n") - MODULE_PLAYERBOTS=$(prompt_yes_no "Playerbots - AI companions (REQUIRES SPECIAL BUILD)" "n") # Quality of Life Modules echo -e "\n${BLUE}🛠️ Quality of Life Modules:${NC}" @@ -431,6 +461,8 @@ main() { # Module summary if [ "$MODULE_SELECTION_MODE" = "suggested" ]; then echo "Modules: Suggested preset (8 modules)" + elif [ "$MODULE_SELECTION_MODE" = "playerbots" ]; then + echo "Modules: Playerbots preset (9 modules including AI companions)" elif [ "$MODULE_SELECTION_MODE" = "manual" ]; then ENABLED_COUNT=0 [ "$MODULE_SOLO_LFG" = "1" ] && ENABLED_COUNT=$((ENABLED_COUNT + 1)) @@ -654,6 +686,30 @@ main() { fi echo "" + # Playerbots usage information + if [ "$MODULE_SELECTION_MODE" = "playerbots" ] || [ "$MODULE_PLAYERBOTS" = "1" ]; then + print_status "HEADER" "PLAYERBOTS USAGE" + echo "Your server includes AI playerbots! Here are the key commands:" + echo "" + echo "🤖 Guild Bot Management:" + echo " .bot add - Add a random bot to your guild" + echo " .bot add - Add a bot of specific class" + echo " .bot remove - Remove a bot from your guild" + echo " .guild create - Create a guild (if needed)" + echo "" + echo "🎮 Bot Control:" + echo " .bot invite - Invite bot to group" + echo " .bot uninvite - Remove bot from group" + echo " .bot command - Send commands to your bots" + echo "" + echo "⚙️ Bot Configuration:" + echo " .bot settings - View bot configuration options" + echo " .bot stats - Show server bot statistics" + echo "" + echo "📖 For more commands, visit: https://github.com/celguar/playerbots" + echo "" + fi + print_status "SUCCESS" "🎉 Server setup complete!" print_status "INFO" "Your custom environment files are ready for deployment." }