Enhance DB automation: Added conference export, absolute path restore logic, and automated multi-user credential resetting. Updated README and CHEATSHEET.

This commit is contained in:
Scott Idem
2026-01-12 20:28:02 -05:00
parent f886250ae3
commit ea45d99f13
6 changed files with 106 additions and 10 deletions

View File

@@ -214,3 +214,39 @@ ln -s /mnt/data_drive/srv/data/osit_app/hosted_files_dev /home/scott/OSIT_dev/ae
ln -s /mnt/data_drive/srv/data/osit_app/hosted_tmp /home/scott/OSIT_dev/aether_container_env/srv/hosted_tmp_link
ln -s /mnt/data_drive/srv/data/osit_app/hosted_tmp_dev /home/scott/OSIT_dev/aether_container_env/srv/hosted_tmp_dev_link
## Database Management (Physical Backups & Restores)
The system uses physical hot backups via `mariabackup` for speed and data integrity.
### User-Facing Scripts
These scripts are located in the `aether_container_env/` root directory.
* **`./backup_db.sh`**:
* Triggers an immediate hot backup of the local MariaDB instance.
* Stores results in `backups/local_backup_YYYYMMDD_HHMM.gz`.
* **`./export_db.sh`**:
* Creates a "Conference Ready" backup.
* Triggers a backup inside the `ae_ops_dev` container and moves it to `backups/conference_export/`.
* Ensures the resulting file is owned by the host user (UID 1000).
* **`./restore_db.sh [backup_file.gz]`**:
* Performs a full "Clean Slate" restoration from a `.gz` stream file.
* **Logic**: Stops MariaDB -> Archives current data (`srv/mariadb_bak_...`) -> Wipes `srv/mariadb` -> Extracts/Prepares data -> Resets `root` and `aether_dev` passwords to match your current `.env`.
* **`./check_and_import.sh`**:
* Watchdog script that monitors `backups/import/` for new `.gz` files.
* If a file is found, it triggers `./restore_db.sh` and then moves the processed file to `backups/imported/`.
### Internal Logic Scripts
These are located in `aether_container_env/scripts/` and are primarily called by the user-facing scripts or the `ae_ops` cron service.
* **`scripts/backup_internal.sh`**:
* Runs inside the `ae_ops` container.
* Connects to MariaDB, streams the backup, and fixes file ownership for the host.
* **`scripts/restore_internal.sh`**:
* Runs inside a temporary restoration container.
* Handles decompression, metadata linking (handling `mariadb_backup_...` vs legacy `xtrabackup_...` filenames), and log application (`--prepare`).
### Backup Directory Structure
* `backups/`: General local backups.
* `backups/import/`: Drop files here for `check_and_import.sh`.
* `backups/imported/`: Archive of processed import files.
* `backups/conference_export/`: Specialized manual exports.