Files
OSIT-AE-Docker-Env/backup_db.sh

24 lines
798 B
Bash
Executable File

#!/bin/bash
# Aether MariaDB Backup Script (Physical Backup)
# Performs a live, hot backup of the running local container.
set -e
PROJECT_ROOT="/home/scott/OSIT_dev/aether_container_env"
BACKUP_DIR="${PROJECT_ROOT}/backups"
TIMESTAMP=$(date +%Y%m%d_%H%M)
BACKUP_FILE="${BACKUP_DIR}/local_backup_${TIMESTAMP}.gz"
echo "--- Starting Aether Local Database Backup ---"
# Ensure backup directory exists
mkdir -p "${BACKUP_DIR}"
# Run mariabackup inside the container and stream it to a gzipped file on the host
# We use root here since it's a workstation dev env
echo ">>> Backing up to ${BACKUP_FILE}..."
docker exec ae_mariadb_dev mariabackup --user=root --password='$1sky.AE_dev.2023' --backup --stream=xbstream | gzip > "${BACKUP_FILE}"
echo "--- Backup Complete! ---"
ls -lh "${BACKUP_FILE}"