Add settings page with change password, fix terminal ws bug
Deploy Dashboard / deploy (push) Failing after 2m5s
Deploy Dashboard / deploy (push) Failing after 2m5s
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Configuration
|
||||
BACKUP_DIR="/volume1/backups/nas-tools"
|
||||
DATE=$(date +%Y%m%d_%H%M%S)
|
||||
RETENTION_DAYS=7
|
||||
|
||||
# Ensure backup directory exists
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
log() {
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
|
||||
}
|
||||
|
||||
log "Starting backup..."
|
||||
|
||||
# 1. Database Dumps
|
||||
log "Dumping databases..."
|
||||
|
||||
# Gitea DB
|
||||
docker exec gitea-db pg_dump -U gitea gitea > "$BACKUP_DIR/gitea_db_$DATE.sql"
|
||||
if [ $? -eq 0 ]; then
|
||||
log "Gitea DB dumped successfully."
|
||||
else
|
||||
log "Error dumping Gitea DB!"
|
||||
fi
|
||||
|
||||
# Immich DB
|
||||
docker exec immich-db pg_dump -U postgres immich > "$BACKUP_DIR/immich_db_$DATE.sql"
|
||||
if [ $? -eq 0 ]; then
|
||||
log "Immich DB dumped successfully."
|
||||
else
|
||||
log "Error dumping Immich DB!"
|
||||
fi
|
||||
|
||||
# 2. File Backups (Configs & Data)
|
||||
# Exclude heavy media files if handled separately, but for now backing up key configs
|
||||
log "Compressing configuration files..."
|
||||
|
||||
# Dashboard & Gitea & Immich configs
|
||||
# Assuming /volume1/docker structure
|
||||
tar -czf "$BACKUP_DIR/configs_$DATE.tar.gz" \
|
||||
-C /volume1/docker \
|
||||
nas-dashboard/backend/config.py \
|
||||
nas-dashboard/.env \
|
||||
gitea/conf \
|
||||
immich/.env \
|
||||
--exclude='gitea/data' \
|
||||
--exclude='immich/upload' \
|
||||
--exclude='immich/thumbs'
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
log "Configs compressed successfully."
|
||||
else
|
||||
log "Error compressing configs!"
|
||||
fi
|
||||
|
||||
# 3. Cleanup Old Backups
|
||||
log "Cleaning up backups older than $RETENTION_DAYS days..."
|
||||
find "$BACKUP_DIR" -type f -name "*_db_*.sql" -mtime +$RETENTION_DAYS -delete
|
||||
find "$BACKUP_DIR" -type f -name "configs_*.tar.gz" -mtime +$RETENTION_DAYS -delete
|
||||
|
||||
log "Backup completed."
|
||||
Reference in New Issue
Block a user