Consolidate backup storage to single mongo-backup directory

- Unify all backup scripts to use ./mongo-backup/ directory
- Update db-backup--standalone.sh to store volume backups in mongo-backup/
- Update db-backup--swarm.sh to use mongo-backup as default directory
- Update db-restore-from-backup--swarm.sh to look in mongo-backup/
- Update all header comments and documentation to reflect new location
- Update .gitignore to ignore both backups/ and mongo-backup/
- Update README.md with consolidated backup directory paths

This simplifies backup management by having all backup types in one location.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-26 11:20:29 +01:00
parent ba2a278d7e
commit 2375c1a193
5 changed files with 16 additions and 14 deletions

View File

@@ -21,9 +21,9 @@ set -euo pipefail
# - Creates compressed tarball (.tar.gz) of the volume
#
# OUTPUT:
# - Backup files stored in: ./backups/
# - Backup files stored in: ./mongo-backup/
# - Filename format: mongo-volume-backup-YYYY-MM-DD-HH-MM.tar.gz
# - Log file: ./backups/db-backup-standalone.log
# - Log file: ./mongo-backup/db-backup-standalone.log
# - Automatic rotation: keeps newest 7 backups (configurable via KEEP env var)
#
# USAGE:
@@ -37,8 +37,10 @@ set -euo pipefail
# ==============================================================================
# Configuration
BACKUP_DIR="${BACKUP_DIR:-$SCRIPT_DIR/mongo-backup}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LOG_FILE="$SCRIPT_DIR/backups/db-backup-standalone.log"
LOG_FILE="$BACKUP_DIR/db-backup-standalone.log"
MONGO_SERVICE="mongo"
COMPOSE_FILE="$SCRIPT_DIR/docker-compose-standalone.yaml"
@@ -60,7 +62,6 @@ docker compose -f "$COMPOSE_FILE" stop "$MONGO_SERVICE"
TIMESTAMP=$(date +"%Y-%m-%d-%H-%M")
# backup directory and retention (can be overridden via env)
BACKUP_DIR="${BACKUP_DIR:-$SCRIPT_DIR/backups}"
KEEP="${KEEP:-7}"
mkdir -p "$BACKUP_DIR"