forked from syntaxbullet/aurorabot
chore: improve DX scripts, fix test suite, and harden tooling
Scripts: - remote.sh: remove unused open_browser() function - deploy-remote.sh: add DB backup before deploy, --skip-backup flag, step numbering - db-backup.sh: fix macOS compat (xargs -r is GNU-only), use portable approach - db-restore.sh: add safety backup before restore, SQL file validation, file size display - logs.sh: default to no-follow with --tail=100, order-independent arg parsing - docker-cleanup.sh: add Docker health check, colored output - test-sequential.sh: exclude *.integration.test.ts by default, add --integration flag - simulate-ci.sh: pass --integration flag (has real DB) Tests: - db.test.ts: fix mock path from ./DrizzleClient to @shared/db/DrizzleClient - server.settings.test.ts: rewrite mocks for gameSettingsService (old config/saveConfig removed) - server.test.ts: add missing config.lootdrop and BotClient mocks, complete DrizzleClient chain - indexes.test.ts: rename to indexes.integration.test.ts (requires live DB) Config: - package.json: test script uses sequential runner, add test:ci and db:restore aliases - deploy.yml: use --integration flag in CI (has Postgres service)
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
# =============================================================================
|
||||
# Aurora Database Backup Script
|
||||
# =============================================================================
|
||||
# Creates a timestamped PostgreSQL backup and retains the last 10 backups.
|
||||
#
|
||||
# Usage: ./db-backup.sh
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
@@ -37,9 +41,13 @@ if docker ps | grep -q aurora_db; then
|
||||
echo -e " 📂 File: $BACKUP_FILE"
|
||||
echo -e " 📏 Size: $(du -h "$BACKUP_FILE" | cut -f1)"
|
||||
|
||||
# Keep only last 10 backups
|
||||
# Keep only last 10 backups (cross-platform: works on macOS and Linux)
|
||||
cd "$BACKUP_DIR"
|
||||
ls -t backup_*.sql | tail -n +11 | xargs -r rm --
|
||||
OLD_BACKUPS=$(ls -t backup_*.sql 2>/dev/null | tail -n +11)
|
||||
if [ -n "$OLD_BACKUPS" ]; then
|
||||
echo "$OLD_BACKUPS" | xargs rm --
|
||||
echo -e " ${GREEN}✓${NC} Pruned old backups"
|
||||
fi
|
||||
else
|
||||
echo -e " ${RED}✗${NC} Backup created but empty. Something went wrong."
|
||||
rm -f "$BACKUP_FILE"
|
||||
|
||||
Reference in New Issue
Block a user