mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 00:58:34 +00:00
tagging new modules and images
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Utility to migrate module images (and optionally storage) to a remote host.
|
||||
# Assumes module images have already been rebuilt locally.
|
||||
# Utility to migrate deployment images (and optionally storage) to a remote host.
|
||||
# Assumes your runtime images have already been built or pulled locally.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -41,6 +41,74 @@ resolve_project_image(){
|
||||
echo "${project_name}:${tag}"
|
||||
}
|
||||
|
||||
declare -a DEPLOY_IMAGE_REFS=()
|
||||
declare -a CLEANUP_IMAGE_REFS=()
|
||||
declare -A DEPLOY_IMAGE_SET=()
|
||||
declare -A CLEANUP_IMAGE_SET=()
|
||||
|
||||
add_deploy_image_ref(){
|
||||
local image="$1"
|
||||
[ -z "$image" ] && return
|
||||
if [[ -z "${DEPLOY_IMAGE_SET[$image]:-}" ]]; then
|
||||
DEPLOY_IMAGE_SET["$image"]=1
|
||||
DEPLOY_IMAGE_REFS+=("$image")
|
||||
fi
|
||||
add_cleanup_image_ref "$image"
|
||||
}
|
||||
|
||||
add_cleanup_image_ref(){
|
||||
local image="$1"
|
||||
[ -z "$image" ] && return
|
||||
if [[ -z "${CLEANUP_IMAGE_SET[$image]:-}" ]]; then
|
||||
CLEANUP_IMAGE_SET["$image"]=1
|
||||
CLEANUP_IMAGE_REFS+=("$image")
|
||||
fi
|
||||
}
|
||||
|
||||
collect_deploy_image_refs(){
|
||||
local auth_modules world_modules auth_playerbots world_playerbots db_import client_data bots_client_data
|
||||
local auth_standard world_standard client_data_standard
|
||||
|
||||
auth_modules="$(read_env_value AC_AUTHSERVER_IMAGE_MODULES "$(resolve_project_image "authserver-modules-latest")")"
|
||||
world_modules="$(read_env_value AC_WORLDSERVER_IMAGE_MODULES "$(resolve_project_image "worldserver-modules-latest")")"
|
||||
auth_playerbots="$(read_env_value AC_AUTHSERVER_IMAGE_PLAYERBOTS "$(resolve_project_image "authserver-playerbots")")"
|
||||
world_playerbots="$(read_env_value AC_WORLDSERVER_IMAGE_PLAYERBOTS "$(resolve_project_image "worldserver-playerbots")")"
|
||||
db_import="$(read_env_value AC_DB_IMPORT_IMAGE "$(resolve_project_image "db-import-playerbots")")"
|
||||
client_data="$(read_env_value AC_CLIENT_DATA_IMAGE_PLAYERBOTS "$(resolve_project_image "client-data-playerbots")")"
|
||||
|
||||
auth_standard="$(read_env_value AC_AUTHSERVER_IMAGE "acore/ac-wotlk-authserver:master")"
|
||||
world_standard="$(read_env_value AC_WORLDSERVER_IMAGE "acore/ac-wotlk-worldserver:master")"
|
||||
client_data_standard="$(read_env_value AC_CLIENT_DATA_IMAGE "acore/ac-wotlk-client-data:master")"
|
||||
|
||||
local refs=(
|
||||
"$auth_modules"
|
||||
"$world_modules"
|
||||
"$auth_playerbots"
|
||||
"$world_playerbots"
|
||||
"$db_import"
|
||||
"$client_data"
|
||||
"$auth_standard"
|
||||
"$world_standard"
|
||||
"$client_data_standard"
|
||||
)
|
||||
for ref in "${refs[@]}"; do
|
||||
add_deploy_image_ref "$ref"
|
||||
done
|
||||
|
||||
# Include default project-tagged images for cleanup even if env moved to custom tags
|
||||
local fallback_refs=(
|
||||
"$(resolve_project_image "authserver-modules-latest")"
|
||||
"$(resolve_project_image "worldserver-modules-latest")"
|
||||
"$(resolve_project_image "authserver-playerbots")"
|
||||
"$(resolve_project_image "worldserver-playerbots")"
|
||||
"$(resolve_project_image "db-import-playerbots")"
|
||||
"$(resolve_project_image "client-data-playerbots")"
|
||||
)
|
||||
for ref in "${fallback_refs[@]}"; do
|
||||
add_cleanup_image_ref "$ref"
|
||||
done
|
||||
}
|
||||
|
||||
ensure_host_writable(){
|
||||
local path="$1"
|
||||
[ -n "$path" ] || return 0
|
||||
@@ -288,25 +356,13 @@ setup_remote_repository(){
|
||||
cleanup_stale_docker_resources(){
|
||||
echo "⋅ Cleaning up stale Docker resources on remote..."
|
||||
|
||||
# Get project name to target our containers/images specifically
|
||||
local project_name
|
||||
project_name="$(resolve_project_name)"
|
||||
|
||||
# Stop and remove old containers
|
||||
echo " • Removing old containers..."
|
||||
run_ssh "docker ps -a --filter 'name=ac-' --format '{{.Names}}' | xargs -r docker rm -f 2>/dev/null || true"
|
||||
|
||||
# Remove old project images to force fresh load
|
||||
echo " • Removing old project images..."
|
||||
local images_to_remove=(
|
||||
"${project_name}:authserver-modules-latest"
|
||||
"${project_name}:worldserver-modules-latest"
|
||||
"${project_name}:authserver-playerbots"
|
||||
"${project_name}:worldserver-playerbots"
|
||||
"${project_name}:db-import-playerbots"
|
||||
"${project_name}:client-data-playerbots"
|
||||
)
|
||||
for img in "${images_to_remove[@]}"; do
|
||||
for img in "${CLEANUP_IMAGE_REFS[@]}"; do
|
||||
run_ssh "docker rmi '$img' 2>/dev/null || true"
|
||||
done
|
||||
|
||||
@@ -320,31 +376,22 @@ cleanup_stale_docker_resources(){
|
||||
|
||||
validate_remote_environment
|
||||
|
||||
echo "⋅ Exporting module images to $TARBALL"
|
||||
collect_deploy_image_refs
|
||||
|
||||
echo "⋅ Exporting deployment images to $TARBALL"
|
||||
# Check which images are available and collect them
|
||||
IMAGES_TO_SAVE=()
|
||||
|
||||
project_auth_modules="$(resolve_project_image "authserver-modules-latest")"
|
||||
project_world_modules="$(resolve_project_image "worldserver-modules-latest")"
|
||||
project_auth_playerbots="$(resolve_project_image "authserver-playerbots")"
|
||||
project_world_playerbots="$(resolve_project_image "worldserver-playerbots")"
|
||||
project_db_import="$(resolve_project_image "db-import-playerbots")"
|
||||
project_client_data="$(resolve_project_image "client-data-playerbots")"
|
||||
|
||||
for image in \
|
||||
"$project_auth_modules" \
|
||||
"$project_world_modules" \
|
||||
"$project_auth_playerbots" \
|
||||
"$project_world_playerbots" \
|
||||
"$project_db_import" \
|
||||
"$project_client_data"; do
|
||||
MISSING_IMAGES=()
|
||||
for image in "${DEPLOY_IMAGE_REFS[@]}"; do
|
||||
if docker image inspect "$image" >/dev/null 2>&1; then
|
||||
IMAGES_TO_SAVE+=("$image")
|
||||
else
|
||||
MISSING_IMAGES+=("$image")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${#IMAGES_TO_SAVE[@]} -eq 0 ]; then
|
||||
echo "❌ No AzerothCore images found to migrate. Run './build.sh' first or pull standard images."
|
||||
echo "❌ No AzerothCore images found to migrate. Run './build.sh' first or pull the images defined in your .env."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -352,6 +399,11 @@ echo "⋅ Found ${#IMAGES_TO_SAVE[@]} images to migrate:"
|
||||
printf ' • %s\n' "${IMAGES_TO_SAVE[@]}"
|
||||
docker image save "${IMAGES_TO_SAVE[@]}" > "$TARBALL"
|
||||
|
||||
if [ ${#MISSING_IMAGES[@]} -gt 0 ]; then
|
||||
echo "⚠️ Skipping ${#MISSING_IMAGES[@]} images not present locally (will need to pull on remote if required):"
|
||||
printf ' • %s\n' "${MISSING_IMAGES[@]}"
|
||||
fi
|
||||
|
||||
if [[ $SKIP_STORAGE -eq 0 ]]; then
|
||||
if [[ -d storage ]]; then
|
||||
echo "⋅ Syncing storage to remote"
|
||||
|
||||
62
setup.sh
62
setup.sh
@@ -1241,7 +1241,7 @@ fi
|
||||
"automation" "quality-of-life" "gameplay-enhancement" "npc-service"
|
||||
"pvp" "progression" "economy" "social" "account-wide"
|
||||
"customization" "scripting" "admin" "premium" "minigame"
|
||||
"content" "rewards" "developer"
|
||||
"content" "rewards" "developer" "database" "tooling" "uncategorized"
|
||||
)
|
||||
declare -A category_titles=(
|
||||
["automation"]="🤖 Automation"
|
||||
@@ -1261,30 +1261,18 @@ fi
|
||||
["content"]="🏰 Content"
|
||||
["rewards"]="🎁 Rewards"
|
||||
["developer"]="🛠️ Developer Tools"
|
||||
["database"]="🗄️ Database"
|
||||
["tooling"]="🔨 Tooling"
|
||||
["uncategorized"]="📦 Miscellaneous"
|
||||
)
|
||||
declare -A processed_categories=()
|
||||
|
||||
# Group modules by category using arrays
|
||||
declare -A modules_by_category
|
||||
local key
|
||||
for key in "${selection_keys[@]}"; do
|
||||
[ -n "${KNOWN_MODULE_LOOKUP[$key]:-}" ] || continue
|
||||
local category="${MODULE_CATEGORY_MAP[$key]:-uncategorized}"
|
||||
if [ -z "${modules_by_category[$category]:-}" ]; then
|
||||
modules_by_category[$category]="$key"
|
||||
else
|
||||
modules_by_category[$category]="${modules_by_category[$category]} $key"
|
||||
fi
|
||||
done
|
||||
|
||||
# Process modules by category
|
||||
local cat
|
||||
for cat in "${category_order[@]}"; do
|
||||
render_category() {
|
||||
local cat="$1"
|
||||
local module_list="${modules_by_category[$cat]:-}"
|
||||
[ -n "$module_list" ] || continue
|
||||
[ -n "$module_list" ] || return 0
|
||||
|
||||
# Check if this category has any valid modules before showing header
|
||||
local has_valid_modules=0
|
||||
# Split the space-separated string properly
|
||||
local -a module_array
|
||||
IFS=' ' read -ra module_array <<< "$module_list"
|
||||
for key in "${module_array[@]}"; do
|
||||
@@ -1296,14 +1284,12 @@ fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Skip category if no valid modules
|
||||
[ "$has_valid_modules" = "1" ] || continue
|
||||
[ "$has_valid_modules" = "1" ] || return 0
|
||||
|
||||
# Display category header only when we have valid modules
|
||||
local cat_title="${category_titles[$cat]:-$cat}"
|
||||
printf '\n%b\n' "${BOLD}${CYAN}═══ ${cat_title} ═══${NC}"
|
||||
|
||||
# Process modules in this category
|
||||
local first_in_cat=1
|
||||
for key in "${module_array[@]}"; do
|
||||
[ -n "${KNOWN_MODULE_LOOKUP[$key]:-}" ] || continue
|
||||
local status_lc="${MODULE_STATUS_MAP[$key],,}"
|
||||
@@ -1313,6 +1299,10 @@ fi
|
||||
printf -v "$key" '%s' "0"
|
||||
continue
|
||||
fi
|
||||
if [ "$first_in_cat" -ne 1 ]; then
|
||||
printf '\n'
|
||||
fi
|
||||
first_in_cat=0
|
||||
local prompt_label
|
||||
prompt_label="$(module_display_name "$key")"
|
||||
if [ "${MODULE_NEEDS_BUILD_MAP[$key]}" = "1" ]; then
|
||||
@@ -1340,6 +1330,30 @@ fi
|
||||
printf -v "$key" '%s' "0"
|
||||
fi
|
||||
done
|
||||
processed_categories["$cat"]=1
|
||||
}
|
||||
|
||||
# Group modules by category using arrays
|
||||
declare -A modules_by_category
|
||||
local key
|
||||
for key in "${selection_keys[@]}"; do
|
||||
[ -n "${KNOWN_MODULE_LOOKUP[$key]:-}" ] || continue
|
||||
local category="${MODULE_CATEGORY_MAP[$key]:-uncategorized}"
|
||||
if [ -z "${modules_by_category[$category]:-}" ]; then
|
||||
modules_by_category[$category]="$key"
|
||||
else
|
||||
modules_by_category[$category]="${modules_by_category[$category]} $key"
|
||||
fi
|
||||
done
|
||||
|
||||
# Process modules by category (ordered, then any new categories)
|
||||
local cat
|
||||
for cat in "${category_order[@]}"; do
|
||||
render_category "$cat"
|
||||
done
|
||||
for cat in "${!modules_by_category[@]}"; do
|
||||
[ -n "${processed_categories[$cat]:-}" ] && continue
|
||||
render_category "$cat"
|
||||
done
|
||||
module_mode_label="preset 3 (Manual)"
|
||||
elif [ "$MODE_SELECTION" = "4" ]; then
|
||||
|
||||
Reference in New Issue
Block a user