mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 09:07:20 +00:00
deployment updates
This commit is contained in:
@@ -2,12 +2,44 @@
|
||||
# ac-compose
|
||||
set -e
|
||||
|
||||
echo "🚀 AzerothCore Auto Post-Install Configuration"
|
||||
echo "=============================================="
|
||||
GREEN='\033[0;32m'; BLUE='\033[0;34m'; NC='\033[0m'
|
||||
|
||||
show_post_install_header(){
|
||||
echo -e "\n${BLUE} ⚔️ REALM POST-INSTALL CONFIGURATION ⚔️${NC}"
|
||||
echo -e "${BLUE} ══════════════════════════════════════════${NC}"
|
||||
echo -e "${BLUE} 🏯 Blessing Your Realm with Final Touches 🏯${NC}\n"
|
||||
}
|
||||
|
||||
show_post_install_header
|
||||
|
||||
# Install required packages
|
||||
apk add --no-cache curl mysql-client bash docker-cli-compose jq || apk add --no-cache curl mysql-client bash jq
|
||||
|
||||
ensure_playerbots_db(){
|
||||
local db_name="${DB_PLAYERBOTS_NAME:-acore_playerbots}"
|
||||
local charset="${MYSQL_CHARACTER_SET:-utf8mb4}"
|
||||
local collation="${MYSQL_COLLATION:-utf8mb4_unicode_ci}"
|
||||
echo "🔐 Ensuring playerbots database '${db_name}' exists..."
|
||||
if mysql -h "${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" --skip-ssl-verify -e "CREATE DATABASE IF NOT EXISTS \`${db_name}\` CHARACTER SET ${charset} COLLATE ${collation};" >/dev/null 2>&1; then
|
||||
echo "✅ Playerbots database ready"
|
||||
else
|
||||
echo "⚠️ Failed to guarantee playerbots database"
|
||||
fi
|
||||
}
|
||||
|
||||
update_playerbots_conf(){
|
||||
local target="$1"
|
||||
if [ ! -f "$target" ]; then
|
||||
return 0
|
||||
fi
|
||||
if sed -i "s|^PlayerbotsDatabaseInfo *=.*|PlayerbotsDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_PLAYERBOTS_NAME}\"|" "$target"; then
|
||||
echo " 🔁 Updated $(basename "$target")"
|
||||
else
|
||||
echo " ⚠️ Could not update $(basename "$target")"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# Create install markers directory
|
||||
mkdir -p /install-markers
|
||||
|
||||
@@ -31,6 +63,7 @@ else
|
||||
for i in $(seq 1 120); do
|
||||
if mysql -h "${MYSQL_HOST}" -u"${MYSQL_USER}" -p"${MYSQL_ROOT_PASSWORD}" --skip-ssl-verify -e "SELECT 1;" >/dev/null 2>&1; then
|
||||
echo "✅ MySQL is ready"
|
||||
ensure_playerbots_db
|
||||
break
|
||||
fi
|
||||
echo " ⏳ Attempt $i/120..."
|
||||
@@ -62,6 +95,10 @@ else
|
||||
sed -i "s|^LoginDatabaseInfo *=.*|LoginDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_AUTH_NAME}\"|" /azerothcore/config/worldserver.conf || true
|
||||
sed -i "s|^WorldDatabaseInfo *=.*|WorldDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_WORLD_NAME}\"|" /azerothcore/config/worldserver.conf || true
|
||||
sed -i "s|^CharacterDatabaseInfo *=.*|CharacterDatabaseInfo = \"${MYSQL_HOST};${MYSQL_PORT};${MYSQL_USER};${MYSQL_ROOT_PASSWORD};${DB_CHARACTERS_NAME}\"|" /azerothcore/config/worldserver.conf || true
|
||||
update_playerbots_conf /azerothcore/config/playerbots.conf
|
||||
update_playerbots_conf /azerothcore/config/playerbots.conf.dist
|
||||
update_playerbots_conf /azerothcore/config/modules/playerbots.conf
|
||||
update_playerbots_conf /azerothcore/config/modules/playerbots.conf.dist
|
||||
|
||||
echo "✅ Configuration files updated"
|
||||
|
||||
@@ -84,7 +121,9 @@ else
|
||||
echo "REALMLIST_UPDATED=true" >> /install-markers/post-install-completed
|
||||
|
||||
echo ""
|
||||
echo "🎉 Auto post-install configuration completed successfully!"
|
||||
echo -e "${GREEN}⚔️ Your realm has been blessed and configured! ⚔️${NC}"
|
||||
echo -e "${GREEN}🏰 All post-installation rituals completed${NC}"
|
||||
echo -e "${GREEN}🗡️ Your realm awaits brave adventurers!${NC}"
|
||||
echo ""
|
||||
tail -f /dev/null
|
||||
fi
|
||||
|
||||
116
scripts/deploy-tools.sh
Executable file
116
scripts/deploy-tools.sh
Executable file
@@ -0,0 +1,116 @@
|
||||
#!/bin/bash
|
||||
|
||||
# ac-compose helper to deploy phpMyAdmin and Keira3 tooling.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
COMPOSE_FILE="$ROOT_DIR/compose.yml"
|
||||
ENV_FILE="$ROOT_DIR/.env"
|
||||
|
||||
BLUE='\033[0;34m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
info(){ echo -e "${BLUE}ℹ️ $*${NC}"; }
|
||||
ok(){ echo -e "${GREEN}✅ $*${NC}"; }
|
||||
warn(){ echo -e "${YELLOW}⚠️ $*${NC}"; }
|
||||
err(){ echo -e "${RED}❌ $*${NC}"; }
|
||||
|
||||
read_env(){
|
||||
local key="$1" default="${2:-}" value=""
|
||||
if [ -f "$ENV_FILE" ]; then
|
||||
value="$(grep -E "^${key}=" "$ENV_FILE" 2>/dev/null | tail -n1 | cut -d'=' -f2- | tr -d '\r')"
|
||||
fi
|
||||
if [ -z "$value" ]; then
|
||||
value="$default"
|
||||
fi
|
||||
echo "$value"
|
||||
}
|
||||
|
||||
resolve_project_name(){
|
||||
local raw_name sanitized
|
||||
raw_name="$(read_env COMPOSE_PROJECT_NAME "acore-compose")"
|
||||
sanitized="$(echo "$raw_name" | tr '[:upper:]' '[:lower:]')"
|
||||
sanitized="${sanitized// /-}"
|
||||
sanitized="$(echo "$sanitized" | tr -cd 'a-z0-9_-')"
|
||||
if [[ -z "$sanitized" ]]; then
|
||||
sanitized="acore-compose"
|
||||
elif [[ ! "$sanitized" =~ ^[a-z0-9] ]]; then
|
||||
sanitized="ac${sanitized}"
|
||||
fi
|
||||
echo "$sanitized"
|
||||
}
|
||||
|
||||
compose(){
|
||||
docker compose --project-name "$PROJECT_NAME" -f "$COMPOSE_FILE" "$@"
|
||||
}
|
||||
|
||||
show_header(){
|
||||
echo -e "\n${BLUE} 🛠️ TOOLING DEPLOYMENT 🛠️${NC}"
|
||||
echo -e "${BLUE} ═══════════════════════════${NC}"
|
||||
echo -e "${BLUE} 📊 Enabling Management UIs 📊${NC}\n"
|
||||
}
|
||||
|
||||
ensure_command(){
|
||||
if ! command -v "$1" >/dev/null 2>&1; then
|
||||
err "Required command '$1' not found in PATH."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_mysql_running(){
|
||||
local mysql_service="ac-mysql"
|
||||
local mysql_container
|
||||
mysql_container="$(read_env CONTAINER_MYSQL "ac-mysql")"
|
||||
if docker ps --format '{{.Names}}' | grep -qx "$mysql_container"; then
|
||||
info "MySQL container '$mysql_container' already running."
|
||||
return
|
||||
fi
|
||||
info "Starting database service '$mysql_service'..."
|
||||
compose --profile db up -d "$mysql_service" >/dev/null
|
||||
ok "Database service ready."
|
||||
}
|
||||
|
||||
start_tools(){
|
||||
info "Starting phpMyAdmin and Keira3..."
|
||||
compose --profile tools up --detach --quiet-pull >/dev/null
|
||||
ok "Tooling services are online."
|
||||
}
|
||||
|
||||
show_endpoints(){
|
||||
local pma_port keira_port
|
||||
pma_port="$(read_env PMA_EXTERNAL_PORT 8081)"
|
||||
keira_port="$(read_env KEIRA3_EXTERNAL_PORT 4201)"
|
||||
echo ""
|
||||
echo -e "${GREEN}Accessible endpoints:${NC}"
|
||||
echo " • phpMyAdmin : http://localhost:${pma_port}"
|
||||
echo " • Keira3 : http://localhost:${keira_port}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
main(){
|
||||
if [[ "${1:-}" == "--help" ]]; then
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0")
|
||||
|
||||
Ensures the database service is running and launches the tooling profile
|
||||
containing phpMyAdmin and Keira3 dashboards.
|
||||
EOF
|
||||
exit 0
|
||||
fi
|
||||
|
||||
ensure_command docker
|
||||
docker info >/dev/null 2>&1 || { err "Docker daemon unavailable."; exit 1; }
|
||||
|
||||
PROJECT_NAME="$(resolve_project_name)"
|
||||
|
||||
show_header
|
||||
ensure_mysql_running
|
||||
start_tools
|
||||
show_endpoints
|
||||
}
|
||||
|
||||
main "$@"
|
||||
@@ -6,9 +6,44 @@ set -e
|
||||
execute_module_sql() {
|
||||
local module_dir="$1"
|
||||
local module_name="$2"
|
||||
local playerbots_db="${DB_PLAYERBOTS_NAME:-acore_playerbots}"
|
||||
local character_set="${MYSQL_CHARACTER_SET:-utf8mb4}"
|
||||
local collation="${MYSQL_COLLATION:-utf8mb4_unicode_ci}"
|
||||
local run_sorted_sql
|
||||
|
||||
run_sorted_sql() {
|
||||
local dir="$1"
|
||||
local target_db="$2"
|
||||
local label="$3"
|
||||
local skip_regex="${4:-}"
|
||||
[ -d "$dir" ] || return
|
||||
LC_ALL=C find "$dir" -type f -name "*.sql" | sort | while read -r sql_file; do
|
||||
local base_name
|
||||
base_name="$(basename "$sql_file")"
|
||||
if [ -n "$skip_regex" ] && [[ "$base_name" =~ $skip_regex ]]; then
|
||||
echo " Skipping ${label}: ${base_name}"
|
||||
continue
|
||||
fi
|
||||
echo " Executing ${label}: ${base_name}"
|
||||
if mariadb --ssl=false -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${target_db}" < "$sql_file" >/dev/null 2>&1; then
|
||||
echo " ✅ Successfully executed ${base_name}"
|
||||
else
|
||||
echo " ❌ Failed to execute $sql_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
echo "Processing SQL scripts for $module_name..."
|
||||
|
||||
if [ "$module_name" = "Playerbots" ]; then
|
||||
echo " Ensuring database ${playerbots_db} exists..."
|
||||
if mariadb --ssl=false -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" -e "CREATE DATABASE IF NOT EXISTS \`${playerbots_db}\` CHARACTER SET ${character_set} COLLATE ${collation};" >/dev/null 2>&1; then
|
||||
echo " ✅ Playerbots database ready"
|
||||
else
|
||||
echo " ❌ Failed to ensure playerbots database"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find and execute SQL files in the module
|
||||
if [ -d "$module_dir/data/sql" ]; then
|
||||
# Execute world database scripts
|
||||
@@ -47,6 +82,16 @@ execute_module_sql() {
|
||||
done
|
||||
fi
|
||||
|
||||
# Execute playerbots database scripts
|
||||
if [ "$module_name" = "Playerbots" ] && [ -d "$module_dir/data/sql/playerbots" ]; then
|
||||
local pb_root="$module_dir/data/sql/playerbots"
|
||||
run_sorted_sql "$pb_root/base" "$playerbots_db" "playerbots SQL"
|
||||
run_sorted_sql "$pb_root/custom" "$playerbots_db" "playerbots SQL"
|
||||
run_sorted_sql "$pb_root/updates" "$playerbots_db" "playerbots SQL"
|
||||
run_sorted_sql "$pb_root/archive" "$playerbots_db" "playerbots SQL"
|
||||
echo " Skipping playerbots create scripts (handled by automation)"
|
||||
fi
|
||||
|
||||
# Execute base SQL files (common pattern)
|
||||
find "$module_dir/data/sql" -maxdepth 1 -name "*.sql" -type f | while read sql_file; do
|
||||
echo " Executing base SQL: $(basename "$sql_file")"
|
||||
|
||||
@@ -8,6 +8,16 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
ENV_FILE="$PROJECT_DIR/.env"
|
||||
|
||||
BLUE='\033[0;34m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
show_rebuild_step(){
|
||||
local step="$1" total="$2" message="$3"
|
||||
echo -e "${YELLOW}🔧 Step ${step}/${total}: ${message}...${NC}"
|
||||
}
|
||||
|
||||
usage(){
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") [options]
|
||||
@@ -79,19 +89,11 @@ SENTINEL_FILE="$MODULES_DIR/.requires_rebuild"
|
||||
|
||||
REBUILD_SOURCE_PATH="$SOURCE_OVERRIDE"
|
||||
if [ -z "$REBUILD_SOURCE_PATH" ]; then
|
||||
REBUILD_SOURCE_PATH="$(read_env MODULES_REBUILD_SOURCE_PATH "")"
|
||||
REBUILD_SOURCE_PATH="$(read_env MODULES_REBUILD_SOURCE_PATH "./source/azerothcore")"
|
||||
fi
|
||||
|
||||
if [ -z "$REBUILD_SOURCE_PATH" ]; then
|
||||
cat <<EOF
|
||||
❌ MODULES_REBUILD_SOURCE_PATH is not configured.
|
||||
|
||||
Set MODULES_REBUILD_SOURCE_PATH in .env to the AzerothCore source repository
|
||||
that contains the Docker Compose file used for source builds, then rerun:
|
||||
|
||||
scripts/rebuild-with-modules.sh --yes
|
||||
EOF
|
||||
exit 1
|
||||
REBUILD_SOURCE_PATH="./source/azerothcore"
|
||||
fi
|
||||
|
||||
if [[ "$REBUILD_SOURCE_PATH" != /* ]]; then
|
||||
@@ -170,10 +172,10 @@ fi
|
||||
if [ -d "$MODULES_DIR" ]; then
|
||||
echo "🔄 Syncing enabled modules into source tree..."
|
||||
mkdir -p modules
|
||||
find modules -mindepth 1 -maxdepth 1 -type d -name 'mod-*' -exec rm -rf {} + 2>/dev/null || true
|
||||
if command -v rsync >/dev/null 2>&1; then
|
||||
rsync -a --delete "$MODULES_DIR"/ modules/
|
||||
rsync -a "$MODULES_DIR"/ modules/
|
||||
else
|
||||
rm -rf modules/*
|
||||
cp -R "$MODULES_DIR"/. modules/
|
||||
fi
|
||||
else
|
||||
@@ -183,12 +185,32 @@ fi
|
||||
echo "🚀 Building AzerothCore with modules..."
|
||||
docker compose build --no-cache
|
||||
|
||||
show_rebuild_step 5 5 "Cleaning up build containers"
|
||||
echo "🧹 Cleaning up source build containers..."
|
||||
docker compose down --remove-orphans >/dev/null 2>&1 || true
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
rm -f "$SENTINEL_FILE" 2>/dev/null || true
|
||||
if [ -n "$SENTINEL_FILE" ]; then
|
||||
if ! rm -f "$SENTINEL_FILE" 2>/dev/null; then
|
||||
if [ -f "$SENTINEL_FILE" ] && command -v docker >/dev/null 2>&1; then
|
||||
DB_IMPORT_IMAGE="$(read_env AC_DB_IMPORT_IMAGE "acore/ac-wotlk-db-import:14.0.0-dev")"
|
||||
if docker image inspect "$DB_IMPORT_IMAGE" >/dev/null 2>&1; then
|
||||
docker run --rm \
|
||||
--entrypoint /bin/sh \
|
||||
--user 0:0 \
|
||||
-v "$MODULES_DIR":/modules \
|
||||
"$DB_IMPORT_IMAGE" \
|
||||
-c 'rm -f /modules/.requires_rebuild' >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -f "$SENTINEL_FILE" ]; then
|
||||
echo "⚠️ Unable to remove rebuild sentinel at $SENTINEL_FILE. Remove manually if rebuild detection persists."
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 SUCCESS! AzerothCore source build completed with modules."
|
||||
echo -e "${GREEN}⚔️ Module build forged successfully! ⚔️${NC}"
|
||||
echo -e "${GREEN}🏰 Your custom AzerothCore images are ready${NC}"
|
||||
echo -e "${GREEN}🗡️ Time to stage your enhanced realm!${NC}"
|
||||
|
||||
@@ -4,6 +4,19 @@
|
||||
|
||||
set -e
|
||||
|
||||
BLUE='\033[0;34m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'; NC='\033[0m'
|
||||
|
||||
show_staging_header(){
|
||||
echo -e "\n${BLUE} ⚔️ REALM STAGING SYSTEM ⚔️${NC}"
|
||||
echo -e "${BLUE} ══════════════════════════════${NC}"
|
||||
echo -e "${BLUE} 🎯 Configuring Your Realm 🎯${NC}\n"
|
||||
}
|
||||
|
||||
show_staging_step(){
|
||||
local step="$1" message="$2"
|
||||
echo -e "${YELLOW}🔧 ${step}: ${message}...${NC}"
|
||||
}
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
ENV_FILE="$PROJECT_DIR/.env"
|
||||
@@ -117,6 +130,8 @@ declare -A MODULE_REPO_MAP=(
|
||||
[MODULE_LEVEL_GRANT]=mod-quest-count-level
|
||||
)
|
||||
|
||||
show_staging_header
|
||||
|
||||
# Check for enabled C++ modules that require compilation
|
||||
compile_modules=()
|
||||
for key in "${!MODULE_REPO_MAP[@]}"; do
|
||||
@@ -131,7 +146,8 @@ MODULE_PLAYERBOTS="$(read_env MODULE_PLAYERBOTS "0")"
|
||||
|
||||
# Determine target profile if not specified
|
||||
if [ -z "$TARGET_PROFILE" ]; then
|
||||
if [ ${#compile_modules[@]} -gt 0 ]; then
|
||||
show_staging_step "Profile Detection" "Analyzing enabled modules"
|
||||
if [ ${#compile_modules[@]} -gt 0 ]; then
|
||||
echo "🔧 Detected ${#compile_modules[@]} C++ modules requiring compilation:"
|
||||
for mod in "${compile_modules[@]}"; do
|
||||
echo " • $mod"
|
||||
@@ -165,6 +181,7 @@ if [ "$TARGET_PROFILE" = "modules" ]; then
|
||||
fi
|
||||
|
||||
if [ "$REBUILD_NEEDED" = "1" ]; then
|
||||
show_staging_step "Source Rebuild" "Preparing custom build with modules"
|
||||
echo "🚀 Triggering source rebuild with modules..."
|
||||
if confirm "Proceed with source rebuild? (15-45 minutes)" n; then
|
||||
"$SCRIPT_DIR/rebuild-with-modules.sh" ${ASSUME_YES:+--yes}
|
||||
@@ -178,6 +195,7 @@ if [ "$TARGET_PROFILE" = "modules" ]; then
|
||||
fi
|
||||
|
||||
# Stage the services
|
||||
show_staging_step "Service Orchestration" "Preparing realm services"
|
||||
echo "🎬 Staging services with profile: services-$TARGET_PROFILE"
|
||||
|
||||
# Stop any currently running services
|
||||
@@ -199,11 +217,14 @@ case "$TARGET_PROFILE" in
|
||||
esac
|
||||
|
||||
# Start the target profile
|
||||
show_staging_step "Realm Activation" "Bringing services online"
|
||||
echo "🟢 Starting services-$TARGET_PROFILE profile..."
|
||||
docker compose "${PROFILE_ARGS[@]}" up -d
|
||||
|
||||
echo ""
|
||||
echo "🎉 SUCCESS! AzerothCore staged with profile: services-$TARGET_PROFILE"
|
||||
echo -e "${GREEN}⚔️ Realm staging completed successfully! ⚔️${NC}"
|
||||
echo -e "${GREEN}🏰 Profile: services-$TARGET_PROFILE${NC}"
|
||||
echo -e "${GREEN}🗡️ Your realm is ready for adventure!${NC}"
|
||||
|
||||
# Show status
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user