mirror of
https://github.com/uprightbass360/AzerothCore-RealmMaster.git
synced 2026-01-13 00:58:34 +00:00
backup functionality and documentation
This commit is contained in:
@@ -102,7 +102,6 @@ HOST_BACKUP_PATH=${STORAGE_PATH}/backups
|
||||
# ==============================================
|
||||
# Backup settings
|
||||
# ==============================================
|
||||
BACKUP_CRON_SCHEDULE="0 9 * * *"
|
||||
BACKUP_RETENTION_DAYS=3
|
||||
BACKUP_RETENTION_HOURS=6
|
||||
BACKUP_DIR=/backups
|
||||
BACKUP_DAILY_TIME=09
|
||||
@@ -150,8 +150,7 @@ services:
|
||||
MYSQL_PASSWORD: ${MYSQL_ROOT_PASSWORD}
|
||||
BACKUP_RETENTION_DAYS: ${BACKUP_RETENTION_DAYS}
|
||||
BACKUP_RETENTION_HOURS: ${BACKUP_RETENTION_HOURS}
|
||||
BACKUP_CRON_SCHEDULE: ${BACKUP_CRON_SCHEDULE}
|
||||
BACKUP_DIR: ${BACKUP_DIR}
|
||||
BACKUP_DAILY_TIME: ${BACKUP_DAILY_TIME}
|
||||
DB_AUTH_NAME: ${DB_AUTH_NAME}
|
||||
DB_WORLD_NAME: ${DB_WORLD_NAME}
|
||||
DB_CHARACTERS_NAME: ${DB_CHARACTERS_NAME}
|
||||
@@ -185,7 +184,7 @@ services:
|
||||
|
||||
# Enhanced scheduler with hourly and daily backups
|
||||
echo "⏰ Starting enhanced backup scheduler:"
|
||||
echo " 📅 Daily backups: ${BACKUP_CRON_SCHEDULE} (retention: ${BACKUP_RETENTION_DAYS} days)"
|
||||
echo " 📅 Daily backups: ${BACKUP_DAILY_TIME}:00 UTC (retention: ${BACKUP_RETENTION_DAYS} days)"
|
||||
echo " ⏰ Hourly backups: every hour (retention: ${BACKUP_RETENTION_HOURS} hours)"
|
||||
|
||||
# Track last backup times to avoid duplicates
|
||||
@@ -197,15 +196,15 @@ services:
|
||||
current_minute=$(date +%M)
|
||||
current_time="$current_hour:$current_minute"
|
||||
|
||||
# Daily backup check (9:00 AM)
|
||||
if [ "$$current_hour" = "09" ] && [ "$$current_minute" = "00" ] && [ "$$last_daily_hour" != "$$current_hour" ]; then
|
||||
# Daily backup check (configurable time)
|
||||
if [ "$$current_hour" = "${BACKUP_DAILY_TIME}" ] && [ "$$current_minute" = "00" ] && [ "$$last_daily_hour" != "$$current_hour" ]; then
|
||||
echo "📅 [$(date)] Daily backup time reached, running daily backup..."
|
||||
/tmp/backup-daily.sh
|
||||
last_daily_hour="$$current_hour"
|
||||
# Sleep for 2 minutes to avoid running multiple times
|
||||
sleep 120
|
||||
# Hourly backup check (every hour at minute 0, except during daily backup)
|
||||
elif [ "$$current_minute" = "00" ] && [ "$$current_hour" != "09" ] && [ "$$last_hourly_minute" != "$$current_minute" ]; then
|
||||
elif [ "$$current_minute" = "00" ] && [ "$$current_hour" != "${BACKUP_DAILY_TIME}" ] && [ "$$last_hourly_minute" != "$$current_minute" ]; then
|
||||
echo "⏰ [$(date)] Hourly backup time reached, running hourly backup..."
|
||||
/tmp/backup-hourly.sh
|
||||
last_hourly_minute="$$current_minute"
|
||||
|
||||
@@ -1072,7 +1072,25 @@ services:
|
||||
echo "✅ No C++ modules enabled - pre-built containers can be used"
|
||||
fi
|
||||
|
||||
echo 'Module management complete. Keeping container alive...'
|
||||
echo 'Module management complete.'
|
||||
|
||||
# Download rebuild script from GitHub for local access
|
||||
echo '📥 Downloading rebuild-with-modules.sh from GitHub...'
|
||||
apk add --no-cache curl
|
||||
if curl -fsSL https://raw.githubusercontent.com/uprightbass360/acore-compose/main/scripts/rebuild-with-modules.sh -o /tmp/rebuild-with-modules.sh 2>/dev/null; then
|
||||
echo '✅ Downloaded rebuild-with-modules.sh from GitHub'
|
||||
chmod +x /tmp/rebuild-with-modules.sh
|
||||
echo '📍 Script available at: /tmp/rebuild-with-modules.sh'
|
||||
elif [ -f "/project/scripts/rebuild-with-modules.sh" ]; then
|
||||
echo '📁 Using local rebuild-with-modules.sh for testing'
|
||||
cp /project/scripts/rebuild-with-modules.sh /tmp/rebuild-with-modules.sh
|
||||
chmod +x /tmp/rebuild-with-modules.sh
|
||||
echo '✅ Copied to /tmp/rebuild-with-modules.sh'
|
||||
else
|
||||
echo '⚠️ Warning: rebuild-with-modules.sh not found in GitHub or locally'
|
||||
fi
|
||||
|
||||
echo 'Keeping container alive...'
|
||||
tail -f /dev/null
|
||||
restart: "no"
|
||||
networks:
|
||||
|
||||
10
readme.md
10
readme.md
@@ -130,8 +130,7 @@ acore-compose/
|
||||
| `ac-authserver` | acore/ac-wotlk-authserver:14.0.0-dev | Authentication server | 3784:3724 |
|
||||
| `ac-worldserver` | acore/ac-wotlk-worldserver:14.0.0-dev | Game world server | 8215:8085, 7778:7878 |
|
||||
| `ac-eluna` | acore/eluna-ts:master | Lua scripting engine | - |
|
||||
| `ac-phpmyadmin` | phpmyadmin/phpmyadmin:latest | Database management web UI | 8081:80|
|
||||
|
||||
| `ac-phpmyadmin` | phpmyadmin/phpmyadmin:latest | Database management web UI | 8081:80 |
|
||||
| `ac-keira3` | uprightbass360/keira3:latest | Production database editor with API | 4201:8080 |
|
||||
| `ac-backup` | mysql:8.0 | Automated backup service | - |
|
||||
| `ac-modules` | alpine/git:latest | Module management | - |
|
||||
@@ -336,7 +335,7 @@ The deployment uses a unified storage approach controlled by the `STORAGE_ROOT`
|
||||
| **Game Data** | `./storage/azerothcore/data` | `${STORAGE_ROOT}/azerothcore/data` | Maps, vmaps, mmaps, DBC files |
|
||||
| **Configuration** | `./storage/azerothcore/config` | `${STORAGE_ROOT}/azerothcore/config` | Server configuration files |
|
||||
| **Application Logs** | `./storage/azerothcore/logs` | `${STORAGE_ROOT}/azerothcore/logs` | Server and service logs |
|
||||
| **Backups** | `./backups` | `./backups` | Database backup files |
|
||||
| **Backups** | `./storage/azerothcore/backups` | `${STORAGE_ROOT}/azerothcore/backups` | Database backup files |
|
||||
|
||||
### Storage Configuration Examples
|
||||
|
||||
@@ -537,10 +536,9 @@ The system provides **dual backup schedules** for comprehensive data protection:
|
||||
Configure via environment variables in `docker-compose-azerothcore-database.env`:
|
||||
|
||||
- `STORAGE_ROOT`: Root storage path (default: ./storage)
|
||||
- `BACKUP_CRON_SCHEDULE`: Daily backup time (default: "0 9 * * *" - 9 AM UTC)
|
||||
- `BACKUP_RETENTION_DAYS`: Days to keep daily backups (default: 3)
|
||||
- `BACKUP_RETENTION_HOURS`: Hours to keep hourly backups (default: 6)
|
||||
- `BACKUP_DIR`: Container backup directory (default: /backups)
|
||||
- `BACKUP_DAILY_TIME`: Hour for daily backup in 24h format (default: 09)
|
||||
- `HOST_BACKUP_PATH`: Host backup storage path (default: ${STORAGE_PATH}/backups)
|
||||
- `DB_AUTH_NAME`, `DB_WORLD_NAME`, `DB_CHARACTERS_NAME`: Database names (configurable)
|
||||
|
||||
@@ -569,7 +567,7 @@ The `ac-backup` container runs continuously with dual scheduling:
|
||||
- **Purpose**: Recent recovery and frequent data protection
|
||||
|
||||
**Daily Backups**:
|
||||
- **Schedule**: Daily at 9:00 AM UTC (configurable via `BACKUP_CRON_SCHEDULE`)
|
||||
- **Schedule**: Daily at configurable time (default: 9:00 AM UTC)
|
||||
- **Retention**: 3 days (keeps last 3 daily backups)
|
||||
- **Location**: `${HOST_BACKUP_PATH}/daily/`
|
||||
- **Features**: Enhanced with database statistics and comprehensive metadata
|
||||
|
||||
@@ -6,7 +6,7 @@ MYSQL_HOST=${MYSQL_HOST:-ac-mysql}
|
||||
MYSQL_PORT=${MYSQL_PORT:-3306}
|
||||
MYSQL_USER=${MYSQL_USER:-root}
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
|
||||
BACKUP_DIR=${BACKUP_DIR:-/backups}
|
||||
BACKUP_DIR="/backups"
|
||||
RETENTION_DAYS=${BACKUP_RETENTION_DAYS:-3}
|
||||
DATE_FORMAT="%Y%m%d_%H%M%S"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ MYSQL_HOST=${MYSQL_HOST:-ac-mysql}
|
||||
MYSQL_PORT=${MYSQL_PORT:-3306}
|
||||
MYSQL_USER=${MYSQL_USER:-root}
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
|
||||
BACKUP_DIR=${BACKUP_DIR:-/backups}
|
||||
BACKUP_DIR="/backups"
|
||||
RETENTION_HOURS=${BACKUP_RETENTION_HOURS:-6}
|
||||
DATE_FORMAT="%Y%m%d_%H%M%S"
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ MYSQL_HOST=${MYSQL_HOST:-ac-mysql}
|
||||
MYSQL_PORT=${MYSQL_PORT:-3306}
|
||||
MYSQL_USER=${MYSQL_USER:-root}
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
|
||||
BACKUP_DIR=${BACKUP_DIR:-/backups}
|
||||
BACKUP_DIR="/backups"
|
||||
RETENTION_DAYS=${BACKUP_RETENTION_DAYS:-7}
|
||||
DATE_FORMAT="%Y%m%d_%H%M%S"
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ MYSQL_HOST=${MYSQL_HOST:-ac-mysql}
|
||||
MYSQL_PORT=${MYSQL_PORT:-3306}
|
||||
MYSQL_USER=${MYSQL_USER:-root}
|
||||
MYSQL_PASSWORD=${MYSQL_PASSWORD:-password}
|
||||
BACKUP_DIR=${BACKUP_DIR:-/backups}
|
||||
BACKUP_DIR="/backups"
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: restore.sh <backup_timestamp>"
|
||||
|
||||
Reference in New Issue
Block a user