Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
All services: admin-v2, studio-v2, website, ai-compliance-sdk, consent-service, klausur-service, voice-service, and infrastructure. Large PDFs and compiled binaries excluded via .gitignore.
72 lines
2.8 KiB
Bash
Executable File
72 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
# =============================================================================
|
|
# Tägliches Backup vom Mac Mini zum MacBook
|
|
# =============================================================================
|
|
# Dieses Script synchronisiert das Projekt vom Mac Mini zum MacBook
|
|
# um bei Festplattendefekt keine Daten zu verlieren.
|
|
#
|
|
# Installation:
|
|
# chmod +x ~/Projekte/breakpilot-pwa/scripts/daily-backup.sh
|
|
#
|
|
# Manuell ausführen:
|
|
# ~/Projekte/breakpilot-pwa/scripts/daily-backup.sh
|
|
#
|
|
# Automatisch täglich (via LaunchAgent - wird unten erstellt):
|
|
# Das Script läuft automatisch jeden Tag um 02:00 Uhr
|
|
# =============================================================================
|
|
|
|
set -e
|
|
|
|
# Konfiguration
|
|
MACMINI_HOST="benjaminadmin@macmini"
|
|
REMOTE_DIR="/Users/benjaminadmin/Projekte/breakpilot-pwa"
|
|
LOCAL_DIR="/Users/benjaminadmin/Projekte/breakpilot-pwa"
|
|
BACKUP_LOG="/Users/benjaminadmin/Projekte/backup-logs"
|
|
TIMESTAMP=$(date +%Y-%m-%d_%H-%M-%S)
|
|
|
|
# Log-Verzeichnis erstellen
|
|
mkdir -p "$BACKUP_LOG"
|
|
LOG_FILE="$BACKUP_LOG/backup-$TIMESTAMP.log"
|
|
|
|
echo "=== Backup gestartet: $TIMESTAMP ===" | tee "$LOG_FILE"
|
|
|
|
# 1. Prüfe Verbindung zum Mac Mini
|
|
echo "[1/4] Prüfe Verbindung zum Mac Mini..." | tee -a "$LOG_FILE"
|
|
if ! ping -c 1 -t 5 macmini &>/dev/null; then
|
|
echo "FEHLER: Mac Mini nicht erreichbar!" | tee -a "$LOG_FILE"
|
|
exit 1
|
|
fi
|
|
echo " ✓ Mac Mini erreichbar" | tee -a "$LOG_FILE"
|
|
|
|
# 2. Hole neuesten Stand vom Git Remote
|
|
echo "[2/4] Hole neueste Commits von Gitea..." | tee -a "$LOG_FILE"
|
|
cd "$LOCAL_DIR"
|
|
git fetch origin 2>&1 | tee -a "$LOG_FILE"
|
|
echo " ✓ Git fetch erfolgreich" | tee -a "$LOG_FILE"
|
|
|
|
# 3. Synchronisiere Docker-Volumes und Datenbanken (optional)
|
|
echo "[3/4] Sichere wichtige Daten vom Mac Mini..." | tee -a "$LOG_FILE"
|
|
|
|
# Postgres Backup
|
|
POSTGRES_BACKUP="$BACKUP_LOG/postgres-$TIMESTAMP.sql.gz"
|
|
ssh "$MACMINI_HOST" "/usr/local/bin/docker exec breakpilot-pwa-postgres pg_dump -U postgres breakpilot | gzip" > "$POSTGRES_BACKUP" 2>> "$LOG_FILE"
|
|
if [ -s "$POSTGRES_BACKUP" ]; then
|
|
echo " ✓ Postgres-Backup: $POSTGRES_BACKUP" | tee -a "$LOG_FILE"
|
|
else
|
|
echo " ⚠ Postgres-Backup fehlgeschlagen oder leer" | tee -a "$LOG_FILE"
|
|
fi
|
|
|
|
# 4. Aufräumen alter Backups (behalte letzte 7 Tage)
|
|
echo "[4/4] Räume alte Backups auf..." | tee -a "$LOG_FILE"
|
|
find "$BACKUP_LOG" -name "postgres-*.sql.gz" -mtime +7 -delete 2>/dev/null
|
|
find "$BACKUP_LOG" -name "backup-*.log" -mtime +7 -delete 2>/dev/null
|
|
echo " ✓ Alte Backups entfernt (>7 Tage)" | tee -a "$LOG_FILE"
|
|
|
|
echo "" | tee -a "$LOG_FILE"
|
|
echo "=== Backup abgeschlossen: $(date +%Y-%m-%d_%H-%M-%S) ===" | tee -a "$LOG_FILE"
|
|
echo "" | tee -a "$LOG_FILE"
|
|
echo "Zusammenfassung:" | tee -a "$LOG_FILE"
|
|
echo " - Git Repository: Aktuell (via fetch)" | tee -a "$LOG_FILE"
|
|
echo " - Postgres-Backup: $POSTGRES_BACKUP" | tee -a "$LOG_FILE"
|
|
echo " - Log: $LOG_FILE" | tee -a "$LOG_FILE"
|