Files
AzerothCore-RealmMaster/docs/MODULE_DBC_FILES.md
uprightbass360 5c9f1d7389 feat: comprehensive module system and database management improvements
This commit introduces major enhancements to the module installation system,
database management, and configuration handling for AzerothCore deployments.

## Module System Improvements

### Module SQL Staging & Installation
- Refactor module SQL staging to properly handle AzerothCore's sql/ directory structure
- Fix SQL staging path to use correct AzerothCore format (sql/custom/db_*/*)
- Implement conditional module database importing based on enabled modules
- Add support for both cpp-modules and lua-scripts module types
- Handle rsync exit code 23 (permission warnings) gracefully during deployment

### Module Manifest & Automation
- Add automated module manifest generation via GitHub Actions workflow
- Implement Python-based module manifest updater with comprehensive validation
- Add module dependency tracking and SQL file discovery
- Support for blocked modules and module metadata management

## Database Management Enhancements

### Database Import System
- Add db-guard container for continuous database health monitoring and verification
- Implement conditional database import that skips when databases are current
- Add backup restoration and SQL staging coordination
- Support for Playerbots database (4th database) in all import operations
- Add comprehensive database health checking and status reporting

### Database Configuration
- Implement 10 new dbimport.conf settings from environment variables:
  - Database.Reconnect.Seconds/Attempts for connection reliability
  - Updates.AllowedModules for module auto-update control
  - Updates.Redundancy for data integrity checks
  - Worker/Synch thread settings for all three core databases
- Auto-apply dbimport.conf settings via auto-post-install.sh
- Add environment variable injection for db-import and db-guard containers

### Backup & Recovery
- Fix backup scheduler to prevent immediate execution on container startup
- Add backup status monitoring script with detailed reporting
- Implement backup import/export utilities
- Add database verification scripts for SQL update tracking

## User Import Directory

- Add new import/ directory for user-provided database files and configurations
- Support for custom SQL files, configuration overrides, and example templates
- Automatic import of user-provided databases and configs during initialization
- Documentation and examples for custom database imports

## Configuration & Environment

- Eliminate CLIENT_DATA_VERSION warning by adding default value syntax
- Improve CLIENT_DATA_VERSION documentation in .env.template
- Add comprehensive database import settings to .env and .env.template
- Update setup.sh to handle new configuration variables with proper defaults

## Monitoring & Debugging

- Add status dashboard with Go-based terminal UI (statusdash.go)
- Implement JSON status output (statusjson.sh) for programmatic access
- Add comprehensive database health check script
- Add repair-storage-permissions.sh utility for permission issues

## Testing & Documentation

- Add Phase 1 integration test suite for module installation verification
- Add comprehensive documentation for:
  - Database management (DATABASE_MANAGEMENT.md)
  - Module SQL analysis (AZEROTHCORE_MODULE_SQL_ANALYSIS.md)
  - Implementation mapping (IMPLEMENTATION_MAP.md)
  - SQL staging comparison and path coverage
  - Module assets and DBC file requirements
- Update SCRIPTS.md, ADVANCED.md, and troubleshooting documentation
- Update references from database-import/ to import/ directory

## Breaking Changes

- Renamed database-import/ directory to import/ for clarity
- Module SQL files now staged to AzerothCore-compatible paths
- db-guard container now required for proper database lifecycle management

## Bug Fixes

- Fix module SQL staging directory structure for AzerothCore compatibility
- Handle rsync exit code 23 gracefully during deployments
- Prevent backup from running immediately on container startup
- Correct SQL staging paths for proper module installation
2025-11-20 18:26:00 -05:00

142 lines
4.6 KiB
Markdown

# Module DBC File Handling
## Overview
Some AzerothCore modules include binary `.dbc` (Database Client) files that modify game data. These files serve two purposes:
1. **Server-side DBC files**: Override base game data on the server
2. **Client-side DBC files**: Packaged in MPQ patches for player clients
## Server DBC Staging
### How It Works
The module staging system (`scripts/bash/stage-modules.sh`) automatically deploys server-side DBC files to `/azerothcore/data/dbc/` in the worldserver container.
### Enabling DBC Staging for a Module
Add the `server_dbc_path` field to the module's entry in `config/module-manifest.json`:
```json
{
"key": "MODULE_WORGOBLIN",
"name": "mod-worgoblin",
"repo": "https://github.com/heyitsbench/mod-worgoblin.git",
"type": "cpp",
"server_dbc_path": "data/patch/DBFilesClient",
"description": "Enables Worgen and Goblin characters with DB/DBC adjustments",
"category": "customization"
}
```
### Manifest Fields
| Field | Required | Description |
|-------|----------|-------------|
| `server_dbc_path` | Optional | Relative path within module to server-side DBC files |
| `notes` | Optional | Additional installation notes (e.g., client patch requirements) |
### Example Directory Structures
**mod-worgoblin:**
```
mod-worgoblin/
└── data/
└── patch/
└── DBFilesClient/ ← server_dbc_path: "data/patch/DBFilesClient"
├── CreatureModelData.dbc
├── CharSections.dbc
└── ...
```
**mod-arac:**
```
mod-arac/
└── patch-contents/
└── DBFilesContent/ ← server_dbc_path: "patch-contents/DBFilesContent"
├── CharBaseInfo.dbc
├── CharStartOutfit.dbc
└── SkillRaceClassInfo.dbc
```
## Important Distinctions
### Server-Side vs Client-Side DBC Files
**Server-Side DBC Files:**
- Loaded by worldserver at startup
- Must have valid data matching AzerothCore's expectations
- Copied to `/azerothcore/data/dbc/`
- Specified via `server_dbc_path` in manifest
**Client-Side DBC Files:**
- Packaged in MPQ patches for WoW clients
- May contain empty/stub data for UI display only
- **NOT** deployed by the staging system
- Must be distributed to players separately
### Example: mod-bg-slaveryvalley
The mod-bg-slaveryvalley module contains DBC files in `client-side/DBFilesClient/`, but these are **CLIENT-ONLY** files (empty stubs). The actual server data must be downloaded separately from the module's releases.
**Manifest entry:**
```json
{
"key": "MODULE_BG_SLAVERYVALLEY",
"name": "mod-bg-slaveryvalley",
"notes": "DBC files in client-side/DBFilesClient are CLIENT-ONLY. Server data must be downloaded separately from releases."
}
```
## Workflow
1. **Module enabled**`.env` has `MODULE_NAME=1`
2. **Staging runs**`./scripts/bash/stage-modules.sh`
3. **Manifest check** → Reads `server_dbc_path` from `config/module-manifest.json`
4. **DBC copy** → Copies `*.dbc` files to worldserver container
5. **Server restart**`docker restart ac-worldserver` to load new DBC data
## Current Modules with Server DBC Files
| Module | Status | server_dbc_path | Notes |
|--------|--------|----------------|-------|
| mod-worgoblin | Disabled | `data/patch/DBFilesClient` | Requires client patch |
| mod-arac | Enabled | `patch-contents/DBFilesContent` | Race/class combinations |
| mod-bg-slaveryvalley | Enabled | *Not set* | DBC files are client-only |
| prestige-and-draft-mode | Enabled | *Not set* | Manual server DBC setup required |
## Troubleshooting
### DBC Field Count Mismatch
**Error:**
```
/azerothcore/data/dbc/AreaTable.dbc exists, and has 0 field(s) (expected 36).
```
**Cause:** Client-only DBC file was incorrectly deployed to server
**Solution:** Remove `server_dbc_path` from manifest or verify DBC files contain valid server data
### DBC Files Not Loading
**Check:**
1. Module is enabled in `.env`
2. `server_dbc_path` is set in `config/module-manifest.json`
3. DBC directory exists at specified path
4. Worldserver was restarted after staging
## Best Practices
1. **Only set `server_dbc_path` for modules with valid server-side DBC files**
2. **Test DBC deployments carefully** - invalid DBC data causes worldserver crashes
3. **Document client patch requirements** in the `notes` field
4. **Verify DBC field counts** match AzerothCore expectations
5. **Keep client-only DBC files separate** from server DBC staging
## Related Documentation
- [Module Management](./ADVANCED.md#module-management)
- [Database Management](./DATABASE_MANAGEMENT.md)
- [Troubleshooting](./TROUBLESHOOTING.md)