Files
ankn b46de6dc7d
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
ci: migrate GitHub actions to Gitea actions
2026-07-22 15:42:06 +02:00

31 lines
742 B
Bash
Executable File

#!/bin/bash
# Configuration
BACKUP_DIR="./server/data/backups"
DB_CONTAINER="andrekniede-umami-db-1"
DB_USER="postgres"
DB_NAME="postgres" # Defaults for the postgres image unless otherwise specified
DATE=$(date +"%Y-%m-%d")
BACKUP_FILE="$BACKUP_DIR/umami-backup-$DATE.sql"
# Create backup directory if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Dump the database
echo "Dumping Umami database..."
docker exec -t $DB_CONTAINER pg_dump -c -U $DB_USER > "$BACKUP_FILE"
if [ $? -eq 0 ]; then
echo "Database dump successful."
# Git operations
git add "$BACKUP_FILE"
git commit -m "chore: automated umami database backup $DATE"
git push
echo "Backup pushed to repository."
else
echo "Error during database dump."
exit 1
fi