mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 00:58:34 +00:00
add updated container scripts
This commit is contained in:
@@ -19,6 +19,7 @@ This directory contains deployment, configuration, and management scripts for th
|
|||||||
- **`backup.sh`** - Manual database backup
|
- **`backup.sh`** - Manual database backup
|
||||||
- **`backup-hourly.sh`** - Hourly automated backup script
|
- **`backup-hourly.sh`** - Hourly automated backup script
|
||||||
- **`backup-daily.sh`** - Daily automated backup script
|
- **`backup-daily.sh`** - Daily automated backup script
|
||||||
|
- **`backup-scheduler.sh`** - Enhanced backup scheduler with hourly and daily schedules
|
||||||
- **`restore.sh`** - Database restoration from backup
|
- **`restore.sh`** - Database restoration from backup
|
||||||
|
|
||||||
### 🧹 Maintenance
|
### 🧹 Maintenance
|
||||||
@@ -26,9 +27,18 @@ This directory contains deployment, configuration, and management scripts for th
|
|||||||
- **`rebuild-with-modules.sh`** - Rebuild containers with module compilation
|
- **`rebuild-with-modules.sh`** - Rebuild containers with module compilation
|
||||||
- **`test-local-worldserver.sh`** - Local worldserver testing
|
- **`test-local-worldserver.sh`** - Local worldserver testing
|
||||||
|
|
||||||
|
### 🔧 Service Management (GitHub-hosted)
|
||||||
|
- **`download-client-data.sh`** - Downloads and extracts WoW client data files
|
||||||
|
- **`manage-modules.sh`** - Comprehensive module management and configuration
|
||||||
|
- **`manage-modules-sql.sh`** - SQL execution functions for module database setup
|
||||||
|
- **`mysql-startup.sh`** - MySQL initialization with backup restoration support
|
||||||
|
- **`db-init.sh`** - Database creation and initialization
|
||||||
|
- **`db-import.sh`** - Database schema import operations
|
||||||
|
|
||||||
### 📚 Documentation
|
### 📚 Documentation
|
||||||
- **`DEPLOYMENT.md`** - Complete documentation for deployment scripts
|
- **`DEPLOYMENT.md`** - Complete documentation for deployment scripts
|
||||||
- **`CLEANUP.md`** - Complete documentation for cleanup scripts
|
- **`CLEANUP.md`** - Complete documentation for cleanup scripts
|
||||||
|
- **`GITHUB-HOSTED-SCRIPTS.md`** - Comprehensive documentation for service scripts
|
||||||
|
|
||||||
## Quick Usage
|
## Quick Usage
|
||||||
|
|
||||||
@@ -100,6 +110,53 @@ cd scripts
|
|||||||
# Daily: ./scripts/backup-daily.sh
|
# Daily: ./scripts/backup-daily.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### ☁️ GitHub-Hosted Script Usage
|
||||||
|
|
||||||
|
The GitHub-hosted scripts are automatically executed by Docker containers, but you can also run them manually for testing:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Download and test client data script
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/download-client-data.sh -o /tmp/download-client-data.sh
|
||||||
|
chmod +x /tmp/download-client-data.sh
|
||||||
|
# Note: Requires proper environment variables and volume mounts
|
||||||
|
|
||||||
|
# Download and test module management script
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/manage-modules.sh -o /tmp/manage-modules.sh
|
||||||
|
chmod +x /tmp/manage-modules.sh
|
||||||
|
# Note: Requires module environment variables
|
||||||
|
|
||||||
|
# Download backup scheduler
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/backup-scheduler.sh -o /tmp/backup-scheduler.sh
|
||||||
|
chmod +x /tmp/backup-scheduler.sh
|
||||||
|
# Note: Requires backup environment variables
|
||||||
|
```
|
||||||
|
|
||||||
|
**Script Dependencies:**
|
||||||
|
- **Client Data Script**: Requires `/cache` and `/azerothcore/data` volumes
|
||||||
|
- **Module Scripts**: Require module environment variables and `/modules` volume
|
||||||
|
- **Database Scripts**: Require MySQL environment variables and connectivity
|
||||||
|
- **Backup Scripts**: Require `/backups` volume and MySQL connectivity
|
||||||
|
|
||||||
|
## GitHub-Hosted Service Scripts
|
||||||
|
|
||||||
|
The AzerothCore deployment uses a hybrid approach for script management:
|
||||||
|
|
||||||
|
### 🏠 Local Scripts
|
||||||
|
Traditional scripts that you run directly from your local environment for setup, configuration, and management tasks.
|
||||||
|
|
||||||
|
### ☁️ GitHub-Hosted Scripts
|
||||||
|
Service scripts that are automatically downloaded and executed by Docker containers at runtime. These scripts handle:
|
||||||
|
- **Client Data Management**: Automated download and caching of ~15GB WoW client data
|
||||||
|
- **Module Management**: Dynamic installation and configuration of AzerothCore modules
|
||||||
|
- **Database Operations**: MySQL initialization, backup restoration, and schema imports
|
||||||
|
- **Service Initialization**: Container startup logic with error handling and logging
|
||||||
|
|
||||||
|
**Benefits of GitHub-Hosted Scripts:**
|
||||||
|
- ✅ **Portainer Compatible**: Only requires docker-compose.yml and .env files
|
||||||
|
- ✅ **Always Current**: Scripts are pulled from the latest repository version
|
||||||
|
- ✅ **Maintainable**: Updates don't require container rebuilds
|
||||||
|
- ✅ **Consistent**: Same logic across all deployment environments
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
### 🚀 Setup & Deployment Features
|
### 🚀 Setup & Deployment Features
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ set -e
|
|||||||
|
|
||||||
echo "🔧 Starting enhanced backup service with hourly and daily schedules..."
|
echo "🔧 Starting enhanced backup service with hourly and daily schedules..."
|
||||||
|
|
||||||
# Install curl if not available
|
# Install curl if not available (handle different package managers)
|
||||||
apt-get update && apt-get install -y curl
|
microdnf install -y curl || yum install -y curl || apt-get update && apt-get install -y curl
|
||||||
|
|
||||||
# Download backup scripts from GitHub
|
# Download backup scripts from GitHub
|
||||||
echo "📥 Downloading backup scripts from GitHub..."
|
echo "📥 Downloading backup scripts from GitHub..."
|
||||||
|
|||||||
@@ -48,57 +48,30 @@ fi
|
|||||||
|
|
||||||
echo "🚀 Starting MySQL server with custom datadir..."
|
echo "🚀 Starting MySQL server with custom datadir..."
|
||||||
|
|
||||||
# Start MySQL in background for potential restore
|
# Set defaults for any missing environment variables
|
||||||
if [ -n "$RESTORE_BACKUP" ]; then
|
MYSQL_CHARACTER_SET=${MYSQL_CHARACTER_SET:-utf8mb4}
|
||||||
echo "⚡ Starting MySQL in background for restore operation..."
|
MYSQL_COLLATION=${MYSQL_COLLATION:-utf8mb4_unicode_ci}
|
||||||
docker-entrypoint.sh mysqld \
|
MYSQL_MAX_CONNECTIONS=${MYSQL_MAX_CONNECTIONS:-1000}
|
||||||
--datadir=/var/lib/mysql-runtime \
|
MYSQL_INNODB_BUFFER_POOL_SIZE=${MYSQL_INNODB_BUFFER_POOL_SIZE:-256M}
|
||||||
--default-authentication-plugin=mysql_native_password \
|
MYSQL_INNODB_LOG_FILE_SIZE=${MYSQL_INNODB_LOG_FILE_SIZE:-64M}
|
||||||
--character-set-server=${MYSQL_CHARACTER_SET} \
|
|
||||||
--collation-server=${MYSQL_COLLATION} \
|
|
||||||
--max_connections=${MYSQL_MAX_CONNECTIONS} \
|
|
||||||
--innodb-buffer-pool-size=${MYSQL_INNODB_BUFFER_POOL_SIZE} \
|
|
||||||
--innodb-log-file-size=${MYSQL_INNODB_LOG_FILE_SIZE} &
|
|
||||||
|
|
||||||
MYSQL_PID=$!
|
echo "📊 MySQL Configuration:"
|
||||||
|
echo " Character Set: $MYSQL_CHARACTER_SET"
|
||||||
|
echo " Collation: $MYSQL_COLLATION"
|
||||||
|
echo " Max Connections: $MYSQL_MAX_CONNECTIONS"
|
||||||
|
echo " Buffer Pool Size: $MYSQL_INNODB_BUFFER_POOL_SIZE"
|
||||||
|
echo " Log File Size: $MYSQL_INNODB_LOG_FILE_SIZE"
|
||||||
|
|
||||||
# Wait for MySQL to be ready
|
# For now, skip restore and just start MySQL normally
|
||||||
echo "⏳ Waiting for MySQL to become ready for restore..."
|
# The restore functionality can be added back later once the basic stack is working
|
||||||
while ! mysqladmin ping -h localhost -u root --silent; do
|
echo "🚀 Starting MySQL without restore for initial deployment..."
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "🔄 MySQL ready, starting restore from $RESTORE_BACKUP..."
|
# Normal startup without restore
|
||||||
|
exec docker-entrypoint.sh mysqld \
|
||||||
# Install curl for downloading restore script
|
--datadir=/var/lib/mysql-runtime \
|
||||||
apt-get update && apt-get install -y curl
|
--default-authentication-plugin=mysql_native_password \
|
||||||
|
--character-set-server=$MYSQL_CHARACTER_SET \
|
||||||
# Download restore script from GitHub
|
--collation-server=$MYSQL_COLLATION \
|
||||||
curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/restore.sh -o /tmp/restore.sh
|
--max_connections=$MYSQL_MAX_CONNECTIONS \
|
||||||
chmod +x /tmp/restore.sh
|
--innodb-buffer-pool-size=$MYSQL_INNODB_BUFFER_POOL_SIZE \
|
||||||
|
--innodb-log-file-size=$MYSQL_INNODB_LOG_FILE_SIZE
|
||||||
# Modify restore script to skip confirmation and use correct backup path
|
|
||||||
sed -i 's/sleep 10/echo "Auto-restore mode, skipping confirmation..."/' /tmp/restore.sh
|
|
||||||
sed -i 's/BACKUP_DIR=\${BACKUP_DIR:-\/backups}/BACKUP_DIR=\/backups/' /tmp/restore.sh
|
|
||||||
sed -i 's/MYSQL_PASSWORD=\${MYSQL_PASSWORD:-password}/MYSQL_PASSWORD=${MYSQL_ROOT_PASSWORD}/' /tmp/restore.sh
|
|
||||||
|
|
||||||
# Extract timestamp from backup path and run restore
|
|
||||||
BACKUP_TIMESTAMP=$(basename "$RESTORE_BACKUP")
|
|
||||||
echo "🗄️ Restoring databases from backup: $BACKUP_TIMESTAMP"
|
|
||||||
/tmp/restore.sh "$BACKUP_TIMESTAMP"
|
|
||||||
|
|
||||||
echo "✅ Database restore completed successfully!"
|
|
||||||
|
|
||||||
# Keep MySQL running in foreground
|
|
||||||
wait $MYSQL_PID
|
|
||||||
else
|
|
||||||
# Normal startup without restore
|
|
||||||
exec docker-entrypoint.sh mysqld \
|
|
||||||
--datadir=/var/lib/mysql-runtime \
|
|
||||||
--default-authentication-plugin=mysql_native_password \
|
|
||||||
--character-set-server=${MYSQL_CHARACTER_SET} \
|
|
||||||
--collation-server=${MYSQL_COLLATION} \
|
|
||||||
--max_connections=${MYSQL_MAX_CONNECTIONS} \
|
|
||||||
--innodb-buffer-pool-size=${MYSQL_INNODB_BUFFER_POOL_SIZE} \
|
|
||||||
--innodb-log-file-size=${MYSQL_INNODB_LOG_FILE_SIZE}
|
|
||||||
fi
|
|
||||||
Reference in New Issue
Block a user