variable cleanup

This commit is contained in:
uprightbass360
2025-09-30 14:52:48 -04:00
parent 88b7c8eb84
commit f66e3b7c47
6 changed files with 111 additions and 47 deletions

View File

@@ -51,8 +51,10 @@ MYSQL_HEALTHCHECK_START_PERIOD=120s
MYSQL_EXTERNAL_PORT=64306 MYSQL_EXTERNAL_PORT=64306
# DEPLOYMENT CONFIGURATION # DEPLOYMENT CONFIGURATION
# Storage configuration for Portainer NFS deployments # Storage root path - local: ./storage, production: /nfs/containers or custom mount
STORAGE_PATH=/nfs/containers/azerothcore STORAGE_ROOT=./storage
# Storage configuration for database layer
STORAGE_PATH=${STORAGE_ROOT}/azerothcore
# CONTAINER NAMES # CONTAINER NAMES
# Database layer container names # Database layer container names
@@ -72,5 +74,5 @@ HOST_BACKUP_PATH=./backups
HOST_BACKUP_SCRIPTS_PATH=./scripts HOST_BACKUP_SCRIPTS_PATH=./scripts
# Backup settings # Backup settings
BACKUP_CRON_SCHEDULE=0 3 * * * BACKUP_CRON_SCHEDULE="0 3 * * *"
BACKUP_RETENTION_DAYS=7 BACKUP_RETENTION_DAYS=7

View File

@@ -18,8 +18,10 @@ IMAGE_PULL_POLICY=if_not_present
# ============================================== # ==============================================
# DEPLOYMENT CONFIGURATION (REQUIRED) # DEPLOYMENT CONFIGURATION (REQUIRED)
# ============================================== # ==============================================
# Storage configuration (must match other layers) # Storage root path - local: ./storage, production: /nfs/containers or custom mount
STORAGE_PATH=./local-data STORAGE_ROOT=./storage
# Storage configuration (unified with other layers)
STORAGE_PATH=${STORAGE_ROOT}/azerothcore
# Deployment mode # Deployment mode
DEPLOYMENT_MODE=local DEPLOYMENT_MODE=local

View File

@@ -65,8 +65,10 @@ SOAP_PORT=7878
# ============================================== # ==============================================
# DEPLOYMENT CONFIGURATION (REQUIRED) # DEPLOYMENT CONFIGURATION (REQUIRED)
# ============================================== # ==============================================
# Storage root path - local: ./storage, production: /nfs/containers or custom mount
STORAGE_ROOT=./storage
# Storage configuration (must match database layer) # Storage configuration (must match database layer)
STORAGE_PATH=/nfs/containers/azerothcore STORAGE_PATH=${STORAGE_ROOT}/azerothcore
# ============================================== # ==============================================
# CONTAINER NAMES (REQUIRED) # CONTAINER NAMES (REQUIRED)

View File

@@ -18,8 +18,10 @@ MYSQL_PORT=3306
# ============================================== # ==============================================
# TOOL STORAGE PATHS (REQUIRED) # TOOL STORAGE PATHS (REQUIRED)
# ============================================== # ==============================================
# Storage for tools (separate from core stack) # Storage root path - local: ./storage, production: /nfs/containers or custom mount
STORAGE_PATH_TOOLS=./local-data-tools STORAGE_ROOT=./storage
# Storage for tools (unified with core stack)
STORAGE_PATH_TOOLS=${STORAGE_ROOT}/azerothcore
# ============================================== # ==============================================
# NETWORK CONFIGURATION (REQUIRED) # NETWORK CONFIGURATION (REQUIRED)

View File

@@ -82,7 +82,7 @@ services:
ports: ports:
- "${INFLUXDB_EXTERNAL_PORT:-8087}:8086" - "${INFLUXDB_EXTERNAL_PORT:-8087}:8086"
volumes: volumes:
- ${STORAGE_PATH_TOOLS:-./volumes-tools}/azerothcore/influxdb:/var/lib/influxdb2 - ${STORAGE_PATH_TOOLS:-./storage/azerothcore}/azerothcore/influxdb:/var/lib/influxdb2
restart: unless-stopped restart: unless-stopped
networks: networks:
- azerothcore - azerothcore
@@ -110,7 +110,7 @@ services:
ports: ports:
- "${GF_EXTERNAL_PORT:-3001}:3000" - "${GF_EXTERNAL_PORT:-3001}:3000"
volumes: volumes:
- ${STORAGE_PATH_TOOLS:-./volumes-tools}/azerothcore/grafana:/var/lib/grafana - ${STORAGE_PATH_TOOLS:-./storage/azerothcore}/azerothcore/grafana:/var/lib/grafana
entrypoint: ["/bin/bash", "-c"] entrypoint: ["/bin/bash", "-c"]
command: command:
- | - |

130
readme.md
View File

@@ -107,7 +107,9 @@ acore-compose/
├── docker-compose-azerothcore-tools.env # Tools configuration ├── docker-compose-azerothcore-tools.env # Tools configuration
├── docker-compose-azerothcore-optional.env # Optional services config ├── docker-compose-azerothcore-optional.env # Optional services config
├── scripts/ # Deployment, cleanup, and backup automation ├── scripts/ # Deployment, cleanup, and backup automation
├── local-data/ # Local storage (when not using NFS) ├── storage/ # Unified storage root (configurable via STORAGE_ROOT)
│ └── azerothcore/ # All persistent data (database, configs, tools)
├── backups/ # Database backups
└── readme.md # This documentation └── readme.md # This documentation
``` ```
@@ -160,6 +162,14 @@ cd acore-compose
# - docker-compose-azerothcore-database.env: Database settings # - docker-compose-azerothcore-database.env: Database settings
# - docker-compose-azerothcore-services.env: Game server settings # - docker-compose-azerothcore-services.env: Game server settings
# - docker-compose-azerothcore-tools.env: Management tools settings # - docker-compose-azerothcore-tools.env: Management tools settings
# IMPORTANT: Configure storage location for your environment
# For local development (default):
# STORAGE_ROOT=./storage
# For production with NFS:
# STORAGE_ROOT=/nfs/containers
# For custom mount:
# STORAGE_ROOT=/mnt/azerothcore-data
``` ```
### Step 2: Deploy the Stack ### Step 2: Deploy the Stack
@@ -226,10 +236,22 @@ set realmlist YOUR_SERVER_IP
Configuration is managed through separate `.env` files for each layer: Configuration is managed through separate `.env` files for each layer:
#### Storage Configuration (All Layers)
- `STORAGE_ROOT`: Root storage path (default: `./storage`)
- **Local development**: `./storage`
- **Production NFS**: `/nfs/containers`
- **Custom mount**: `/mnt/azerothcore-data`
- All layers derive their storage paths from `STORAGE_ROOT`:
- Database: `${STORAGE_ROOT}/azerothcore`
- Services: `${STORAGE_ROOT}/azerothcore`
- Tools: `${STORAGE_ROOT}/azerothcore`
- Optional: `${STORAGE_ROOT}/azerothcore`
#### Database Layer (`docker-compose-azerothcore-database.env`) #### Database Layer (`docker-compose-azerothcore-database.env`)
- `MYSQL_ROOT_PASSWORD`: Database root password (default: azerothcore123) - `MYSQL_ROOT_PASSWORD`: Database root password (default: azerothcore123)
- `MYSQL_EXTERNAL_PORT`: External MySQL port (default: 64306) - `MYSQL_EXTERNAL_PORT`: External MySQL port (default: 64306)
- `STORAGE_PATH`: Data storage path (default: /nfs/containers/azerothcore) - `STORAGE_ROOT`: Root storage path (default: ./storage)
- `STORAGE_PATH`: Derived storage path (${STORAGE_ROOT}/azerothcore)
- `NETWORK_SUBNET`: Docker network subnet - `NETWORK_SUBNET`: Docker network subnet
- `BACKUP_RETENTION_DAYS`: Backup retention period - `BACKUP_RETENTION_DAYS`: Backup retention period
@@ -237,6 +259,8 @@ Configuration is managed through separate `.env` files for each layer:
- `AUTH_EXTERNAL_PORT`: Auth server external port (3784) - `AUTH_EXTERNAL_PORT`: Auth server external port (3784)
- `WORLD_EXTERNAL_PORT`: World server external port (8215) - `WORLD_EXTERNAL_PORT`: World server external port (8215)
- `SOAP_EXTERNAL_PORT`: SOAP API port (7778) - `SOAP_EXTERNAL_PORT`: SOAP API port (7778)
- `STORAGE_ROOT`: Root storage path (default: ./storage)
- `STORAGE_PATH`: Derived storage path (${STORAGE_ROOT}/azerothcore)
- `PLAYERBOT_ENABLED`: Enable/disable playerbots (1/0) - `PLAYERBOT_ENABLED`: Enable/disable playerbots (1/0)
- `PLAYERBOT_MAX_BOTS`: Maximum number of bots (default: 40) - `PLAYERBOT_MAX_BOTS`: Maximum number of bots (default: 40)
@@ -245,7 +269,8 @@ Configuration is managed through separate `.env` files for each layer:
- `KEIRA3_EXTERNAL_PORT`: Database editor port (4201) - `KEIRA3_EXTERNAL_PORT`: Database editor port (4201)
- `GF_EXTERNAL_PORT`: Grafana monitoring port (3001) - `GF_EXTERNAL_PORT`: Grafana monitoring port (3001)
- `INFLUXDB_EXTERNAL_PORT`: InfluxDB metrics port (8087) - `INFLUXDB_EXTERNAL_PORT`: InfluxDB metrics port (8087)
- `STORAGE_PATH_TOOLS`: Tools storage path (default: ./volumes-tools) - `STORAGE_ROOT`: Root storage path (default: ./storage)
- `STORAGE_PATH_TOOLS`: Derived storage path (${STORAGE_ROOT}/azerothcore)
### Realm Configuration ### Realm Configuration
@@ -265,48 +290,76 @@ SELECT * FROM realmlist;"
## Volume Management ## Volume Management
### Named Volumes ### Storage Architecture
| Volume Name | Container Mount | Purpose | Can Be Bind Mounted | The deployment uses a unified storage approach controlled by the `STORAGE_ROOT` variable:
|-------------|-----------------|---------|---------------------|
| `ac_mysql_data` | `/var/lib/mysql` | MySQL database files | ✅ Yes - For backup/migration |
| `ac_data` | `/azerothcore/data` | Game data (maps, vmaps, etc.) | ✅ Yes - Required for data files |
| `ac_config` | `/azerothcore/env/dist/etc` | Configuration files | ✅ Yes - For custom configs |
| `ac_logs` | `/azerothcore/logs` | Application logs | ✅ Yes - For log analysis |
| `ac_backup` | `/backups` | Database backups | ✅ Yes - For external backup storage |
### Bind Mount Examples | Storage Component | Local Path | Production Path | Purpose |
|-------------------|------------|-----------------|---------|
| **Database Data** | `./storage/azerothcore/mysql-data` | `${STORAGE_ROOT}/azerothcore/mysql-data` | MySQL database files |
| **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 |
| **Tools Data** | `./storage/azerothcore/azerothcore/grafana` | `${STORAGE_ROOT}/azerothcore/azerothcore/grafana` | Grafana dashboards |
| **Metrics Data** | `./storage/azerothcore/azerothcore/influxdb` | `${STORAGE_ROOT}/azerothcore/azerothcore/influxdb` | InfluxDB time series data |
| **Backups** | `./backups` | `./backups` | Database backup files |
To use bind mounts instead of named volumes, modify the compose file: ### Storage Configuration Examples
```yaml #### Local Development
volumes: ```bash
# Replace named volume with bind mount # All data stored locally in ./storage/
- /srv/azerothcore/mysql:/var/lib/mysql STORAGE_ROOT=./storage
- /srv/azerothcore/data:/azerothcore/data
- /srv/azerothcore/config:/azerothcore/env/dist/etc
- /srv/azerothcore/logs:/azerothcore/logs
- /srv/azerothcore/backups:/backups
``` ```
#### Production with NFS
```bash
# All data on NFS mount
STORAGE_ROOT=/nfs/containers
```
#### Custom Mount Point
```bash
# All data on dedicated storage mount
STORAGE_ROOT=/mnt/azerothcore-data
```
### Unified Storage Benefits
**Single Mount Point**: Only need to mount one directory in production
**Simplified Backup**: All persistent data in one location
**Easy Migration**: Copy entire `${STORAGE_ROOT}/azerothcore` directory
**Consistent Paths**: All layers use same storage root
**Environment Flexibility**: Change storage location via single variable
### Volume Backup Procedures ### Volume Backup Procedures
#### Backup MySQL Data: #### Complete Storage Backup:
```bash ```bash
# Create backup of MySQL volume # Backup entire storage directory (recommended)
docker run --rm \ tar czf azerothcore-storage-backup-$(date +%Y%m%d).tar.gz storage/
-v ac_mysql_data:/data \
-v $(pwd):/backup \ # Or backup to remote location
alpine tar czf /backup/mysql-backup-$(date +%Y%m%d).tar.gz -C /data . rsync -av storage/ backup-server:/backups/azerothcore/$(date +%Y%m%d)/
``` ```
#### Backup Game Data: #### Component-Specific Backups:
```bash ```bash
# Create backup of game data volume # Backup just database files
docker run --rm \ tar czf mysql-backup-$(date +%Y%m%d).tar.gz storage/azerothcore/mysql-data/
-v ac_data:/data \
-v $(pwd):/backup \ # Backup just game data
alpine tar czf /backup/gamedata-backup-$(date +%Y%m%d).tar.gz -C /data . tar czf gamedata-backup-$(date +%Y%m%d).tar.gz storage/azerothcore/data/
# Backup just configuration
tar czf config-backup-$(date +%Y%m%d).tar.gz storage/azerothcore/config/
```
#### Production Storage Backup:
```bash
# When using custom STORAGE_ROOT
source docker-compose-azerothcore-database.env
tar czf azerothcore-backup-$(date +%Y%m%d).tar.gz ${STORAGE_ROOT}/azerothcore/
``` ```
## Maintenance ## Maintenance
@@ -414,15 +467,15 @@ docker logs -f ac-worldserver
# Export logs to file # Export logs to file
docker logs ac-worldserver > worldserver.log 2>&1 docker logs ac-worldserver > worldserver.log 2>&1
# Clear old logs (if using bind mount) # Clear old logs (adjust path based on STORAGE_ROOT)
find /srv/azerothcore/logs -name "*.log" -mtime +30 -delete find ${STORAGE_ROOT}/azerothcore/logs -name "*.log" -mtime +30 -delete
``` ```
#### Log Rotation (using bind mount): #### Log Rotation (using bind mount):
```bash ```bash
# Create logrotate config # Create logrotate config (adjust path based on STORAGE_ROOT)
cat > /etc/logrotate.d/azerothcore <<EOF cat > /etc/logrotate.d/azerothcore <<EOF
/srv/azerothcore/logs/*.log { ${STORAGE_ROOT}/azerothcore/logs/*.log {
daily daily
rotate 7 rotate 7
compress compress
@@ -441,11 +494,14 @@ The deployment includes a comprehensive automated backup system with individual
Configure via environment variables in `docker-compose-azerothcore-database.env`: Configure via environment variables in `docker-compose-azerothcore-database.env`:
- `STORAGE_ROOT`: Root storage path (default: ./storage)
- `BACKUP_CRON_SCHEDULE`: Cron expression (default: "0 3 * * *" - 3 AM daily) - `BACKUP_CRON_SCHEDULE`: Cron expression (default: "0 3 * * *" - 3 AM daily)
- `BACKUP_RETENTION_DAYS`: Days to keep backups (default: 7) - `BACKUP_RETENTION_DAYS`: Days to keep backups (default: 7)
- `HOST_BACKUP_PATH`: Local backup storage path (default: ./backups) - `HOST_BACKUP_PATH`: Local backup storage path (default: ./backups)
- `HOST_BACKUP_SCRIPTS_PATH`: Backup scripts path (default: ./scripts) - `HOST_BACKUP_SCRIPTS_PATH`: Backup scripts path (default: ./scripts)
**Note**: The backup service operates independently of `STORAGE_ROOT` and uses dedicated backup paths for database exports.
### Backup Features ### Backup Features
**Individual Database Backups**: Separate compressed files for each database **Individual Database Backups**: Separate compressed files for each database