From a5cf153a101894fb1d6cfb3ac83c58e107beb29b Mon Sep 17 00:00:00 2001 From: Deckard Date: Tue, 14 Oct 2025 18:55:52 -0400 Subject: [PATCH] startup issues --- docker-compose-azerothcore-database.yml | 3 + docker-compose-azerothcore-services.yml | 4 ++ scripts/download-client-data.sh | 20 +++++++ scripts/setup-server.sh | 80 +++++++++++++++++++++++++ 4 files changed, 107 insertions(+) diff --git a/docker-compose-azerothcore-database.yml b/docker-compose-azerothcore-database.yml index e7458f1..a3aedcd 100644 --- a/docker-compose-azerothcore-database.yml +++ b/docker-compose-azerothcore-database.yml @@ -118,9 +118,12 @@ services: ac-db-import: image: ${AC_DB_IMPORT_IMAGE} container_name: ${CONTAINER_DB_IMPORT} + user: "0:0" depends_on: ac-mysql: condition: service_healthy + ac-db-init: + condition: service_completed_successfully networks: - azerothcore volumes: diff --git a/docker-compose-azerothcore-services.yml b/docker-compose-azerothcore-services.yml index 7450ac3..5d2664c 100644 --- a/docker-compose-azerothcore-services.yml +++ b/docker-compose-azerothcore-services.yml @@ -10,6 +10,7 @@ services: image: ${AC_CLIENT_DATA_IMAGE} pull_policy: ${IMAGE_PULL_POLICY} container_name: ${CONTAINER_CLIENT_DATA} + user: "0:0" # Run as root to install packages volumes: - ${STORAGE_PATH}/data:/azerothcore/data - ${STORAGE_PATH}/cache:/cache @@ -128,6 +129,7 @@ services: image: ${AC_ELUNA_IMAGE} pull_policy: ${IMAGE_PULL_POLICY} container_name: ${CONTAINER_ELUNA} + user: "0:0" # Run as root to handle NFS permissions command: npm run dev volumes: # TypeScript source files (input) @@ -145,6 +147,7 @@ services: image: ${ALPINE_GIT_IMAGE} pull_policy: ${IMAGE_PULL_POLICY} container_name: ${CONTAINER_MODULES} + user: "0:0" # Run as root to handle NFS permissions volumes: - ${STORAGE_PATH}/modules:/modules - ${STORAGE_PATH}/config:/azerothcore/env/dist/etc @@ -220,6 +223,7 @@ services: image: ${ALPINE_IMAGE} pull_policy: ${IMAGE_PULL_POLICY} container_name: ${CONTAINER_POST_INSTALL} + user: "0:0" # Run as root for full permissions volumes: - ${STORAGE_PATH}/config:/azerothcore/config - ${STORAGE_PATH}/install-markers:/install-markers diff --git a/scripts/download-client-data.sh b/scripts/download-client-data.sh index 781f28f..65a1b79 100644 --- a/scripts/download-client-data.sh +++ b/scripts/download-client-data.sh @@ -139,6 +139,26 @@ if [ $UNZIP_EXIT_CODE -ne 0 ]; then exit 1 fi +# Handle nested Data directory issue - move contents if extracted to Data subdirectory +if [ -d "/azerothcore/data/Data" ] && [ -n "$(ls -A /azerothcore/data/Data 2>/dev/null)" ]; then + echo '🔧 Fixing data directory structure (moving from Data/ subdirectory)...' + + # Move all contents from Data subdirectory to the root data directory + for item in /azerothcore/data/Data/*; do + if [ -e "$item" ]; then + mv "$item" /azerothcore/data/ 2>/dev/null || { + echo "⚠️ Could not move $(basename "$item"), using copy instead..." + cp -r "$item" /azerothcore/data/ + rm -rf "$item" + } + fi + done + + # Remove empty Data directory + rmdir /azerothcore/data/Data 2>/dev/null || true + echo '✅ Data directory structure fixed' +fi + # Clean up temporary extraction file (keep cached version) rm -f data.zip diff --git a/scripts/setup-server.sh b/scripts/setup-server.sh index 5a2ad4f..93bb94b 100755 --- a/scripts/setup-server.sh +++ b/scripts/setup-server.sh @@ -191,6 +191,69 @@ main() { esac done + # Permission scheme selection + print_status "HEADER" "PERMISSION SCHEME" + echo "Select your container permission scheme:" + echo "1) Local Development (WSL/Docker Desktop)" + echo " - PUID=0, PGID=0 (root permissions)" + echo " - Best for: Local development, WSL, Docker Desktop" + echo " - Storage: Local directories with full access" + echo "" + echo "2) NFS Server Deployment" + echo " - PUID=1001, PGID=1000 (sharing user)" + echo " - Best for: NFS mounts, multi-user servers" + echo " - Storage: Network storage with user mapping" + echo "" + echo "3) Custom" + echo " - User-specified PUID/PGID values" + echo " - Best for: Specific user requirements" + echo " - Storage: User-specified storage path" + echo " - Manual PUID/PGID input with validation" + echo "" + + while true; do + read -p "$(echo -e "${YELLOW}🔧 Select permission scheme [1-3]: ${NC}")" permission_scheme + case $permission_scheme in + 1) + PERMISSION_SCHEME="local-dev" + PUID=0 + PGID=0 + SCHEME_DESCRIPTION="Local Development (0:0) - Root permissions for local development" + print_status "INFO" "Permission scheme: Local Development" + echo " - PUID=0, PGID=0 (root permissions)" + echo " - Optimized for WSL and Docker Desktop environments" + echo "" + break + ;; + 2) + PERMISSION_SCHEME="nfs-server" + PUID=1001 + PGID=1000 + SCHEME_DESCRIPTION="NFS Server Deployment (1001:1000) - Sharing user for network storage" + print_status "INFO" "Permission scheme: NFS Server Deployment" + echo " - PUID=1001, PGID=1000 (sharing user)" + echo " - Compatible with NFS mounts and multi-user servers" + echo "" + break + ;; + 3) + PERMISSION_SCHEME="custom" + print_status "INFO" "Permission scheme: Custom" + echo " - Manual PUID/PGID configuration" + echo "" + PUID=$(prompt_input "Enter PUID (user ID)" "1000" validate_number) + PGID=$(prompt_input "Enter PGID (group ID)" "1000" validate_number) + SCHEME_DESCRIPTION="Custom (${PUID}:${PGID}) - User-specified permissions" + print_status "SUCCESS" "Custom permissions set: PUID=${PUID}, PGID=${PGID}" + echo "" + break + ;; + *) + print_status "ERROR" "Please select 1, 2, or 3" + ;; + esac + done + # Server configuration print_status "HEADER" "SERVER CONFIGURATION" @@ -508,6 +571,7 @@ main() { # Summary print_status "HEADER" "CONFIGURATION SUMMARY" echo "Deployment Type: $DEPLOYMENT_TYPE" + echo "Permission Scheme: $SCHEME_DESCRIPTION" echo "Server Address: $SERVER_ADDRESS" echo "Client Port: $REALM_PORT" echo "Auth Port: $AUTH_EXTERNAL_PORT" @@ -595,6 +659,10 @@ main() { sed -i "s#BACKUP_DAILY_TIME=.*#BACKUP_DAILY_TIME=${BACKUP_DAILY_TIME}#" docker-compose-azerothcore-database-custom.env sed -i "s#TZ=.*#TZ=${TIMEZONE}#" docker-compose-azerothcore-database-custom.env + # Apply permission scheme settings + sed -i "s#PUID=.*#PUID=${PUID}#" docker-compose-azerothcore-database-custom.env + sed -i "s#PGID=.*#PGID=${PGID}#" docker-compose-azerothcore-database-custom.env + # Toggle database images based on playerbots module selection if [ "$MODULE_PLAYERBOTS" = "1" ]; then # Swap AC_DB_IMPORT_IMAGE to enable mod-playerbots database @@ -616,6 +684,10 @@ main() { sed -i "s#SERVER_ADDRESS=.*#SERVER_ADDRESS=${SERVER_ADDRESS}#" docker-compose-azerothcore-services-custom.env sed -i "s#REALM_PORT=.*#REALM_PORT=${REALM_PORT}#" docker-compose-azerothcore-services-custom.env + # Apply permission scheme settings + sed -i "s#PUID=.*#PUID=${PUID}#" docker-compose-azerothcore-services-custom.env + sed -i "s#PGID=.*#PGID=${PGID}#" docker-compose-azerothcore-services-custom.env + # Toggle Docker images based on playerbots module selection if [ "$MODULE_PLAYERBOTS" = "1" ]; then # Swap specific images that have _DISABLED variants @@ -639,6 +711,10 @@ main() { # Substitute values in tools env file using a different delimiter sed -i "s#STORAGE_ROOT=.*#STORAGE_ROOT=${STORAGE_ROOT}#" docker-compose-azerothcore-tools-custom.env + # Apply permission scheme settings + sed -i "s#PUID=.*#PUID=${PUID}#" docker-compose-azerothcore-tools-custom.env + sed -i "s#PGID=.*#PGID=${PGID}#" docker-compose-azerothcore-tools-custom.env + # Toggle tools images based on playerbots module selection if [ "$MODULE_PLAYERBOTS" = "1" ]; then # Swap AC_TOOLS_IMAGE to enable mod-playerbots tools @@ -656,6 +732,10 @@ main() { sed -i "s#STORAGE_ROOT=.*#STORAGE_ROOT=${STORAGE_ROOT}#" docker-compose-azerothcore-modules-custom.env sed -i "s#MYSQL_ROOT_PASSWORD=.*#MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}#" docker-compose-azerothcore-modules-custom.env + # Apply permission scheme settings + sed -i "s#PUID=.*#PUID=${PUID}#" docker-compose-azerothcore-modules-custom.env + sed -i "s#PGID=.*#PGID=${PGID}#" docker-compose-azerothcore-modules-custom.env + # Set all module variables sed -i "s#MODULE_PLAYERBOTS=.*#MODULE_PLAYERBOTS=${MODULE_PLAYERBOTS}#" docker-compose-azerothcore-modules-custom.env sed -i "s#MODULE_AOE_LOOT=.*#MODULE_AOE_LOOT=${MODULE_AOE_LOOT}#" docker-compose-azerothcore-modules-custom.env