- Add OnboardingWizard, BetaBanner, CookieBanner components - Add legal pages (Privacy, Terms, Cookies) - Update Layout with mobile topbar, sidebar drawer, plan banner - Update SettingsPage with profile, API config, security - Update CharacterForm with topic suggestions, niche chips - Update EditorialCalendar with shared strategy card - Update ContentPage with narrative technique + brief - Update SocialAccounts with 4 platforms and token guides - Fix CSS button color inheritance, mobile responsive - Add backup script - Update .gitignore for pgdata and backups Co-Authored-By: Claude (BRAIN/StackOS) <noreply@anthropic.com>
28 lines
906 B
Bash
Executable File
28 lines
906 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
BACKUP_DIR="/opt/lab-leopost-full-prod/backups"
|
|
FNAME="leopost_$(date +%Y%m%d_%H%M).sql.gz"
|
|
GDRIVE_DIR="gdrive:Backups/Leopost"
|
|
LOG="$BACKUP_DIR/backup.log"
|
|
RETENTION_DAYS=7
|
|
|
|
log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG"; }
|
|
|
|
log "--- Avvio backup $FNAME ---"
|
|
|
|
# 1. pg_dump → gzip
|
|
docker exec prod-leopost-postgres pg_dump -U leopost leopost | gzip > "$BACKUP_DIR/$FNAME"
|
|
SIZE=$(du -sh "$BACKUP_DIR/$FNAME" | cut -f1)
|
|
log "Dump creato: $FNAME ($SIZE)"
|
|
|
|
# 2. Upload su Google Drive
|
|
rclone copy "$BACKUP_DIR/$FNAME" "$GDRIVE_DIR" --log-level ERROR 2>>"$LOG"
|
|
log "Upload Drive completato: $GDRIVE_DIR/$FNAME"
|
|
|
|
# 3. Cleanup locale > 7 giorni
|
|
DELETED=$(find "$BACKUP_DIR" -name 'leopost_*.sql.gz' -mtime +$RETENTION_DAYS -print -delete | wc -l)
|
|
log "Cleanup: $DELETED file rimossi (retention ${RETENTION_DAYS}gg)"
|
|
|
|
log "--- Backup completato con successo ---"
|