does someone want to review our backup to backblaze script courtesy of ClaudeAI? seems to work!
#!/bin/bash BACKUP_DIR="backup" BUCKET_NAME="" DATE=$(date +%Y%m%d) BACKUP_FILE="$DATE-akkoma.pgdump" ENCRYPTED_FILE="${BACKUP_FILE}.enc" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" export B2_APPLICATION_KEY_ID="" export B2_APPLICATION_KEY="" # Your encryption key - store this securely! ENCRYPTION_KEY="" # Stop docker compose docker compose down akkoma # Create backup docker compose exec db pg_dump -d akkoma --format=custom -f /backup/$BACKUP_FILE # Start docker compose again docker compose up akkoma # Encrypt the backup openssl enc -aes-256-cbc -salt -in "./$BACKUP_DIR/$BACKUP_FILE" -out "./$BACKUP_DIR/$ENCRYPTED_FILE" -k "$ENCRYPTION_KEY" -pbkdf2 # Upload encrypted file to B2 if $SCRIPT_DIR/venv/bin/b2 file upload $BUCKET_NAME "./$BACKUP_DIR/$ENCRYPTED_FILE" "backups/$ENCRYPTED_FILE"; then # Delete local files only if upload was successful rm "./$BACKUP_DIR/$BACKUP_FILE" "./$BACKUP_DIR/$ENCRYPTED_FILE" echo "Backup completed, encrypted, and uploaded successfully" else echo "Upload failed - keeping local backup files" exit 1 fi