weak-head / nimbus

Nimbus is engineered to optimize data backup processes and efficiently orchestrate service deployments for homelabs and dev environments.
MIT License
1 stars 0 forks source link

Configurable backup and upload names #5

Open weak-head opened 3 months ago

weak-head commented 3 months ago

Description

For some particular use cases we need to support different rules for custom backup and upload key naming.

Changes

As an option, replace the way how destination path is composed. Right now, the following method is used:

def _compose_path(self, destination: str, group: str, folder: str, today: datetime) -> str:
    pass

It should be replaced with a Strategy that is injected into Backup command.

The possible extension could include a configurable smart Strategy per a particular backup entry.

Proposed changes to the config:

Simplified short:


backup:
  destination: /mnt/backups
  archive: rar-protected
  upload: aws-archive
  directories: 
    apps:
      - /mnt/ssd/apps/gitlab
      - /mnt/ssd/apps/nextcloud
      - /mnt/ssd/apps/plex

Expanded complete:


backup:
  destination: /mnt/backups
  archive: rar-protected
  upload: aws-archive
  directories: 
    apps:
      - path: /mnt/ssd/apps/gitlab
        backup: gitlab/gitlab.{ext} # backup path
        upload: apps/gitlab.{ext}   # upload key
      - /mnt/ssd/apps/nextcloud
      - /mnt/ssd/apps/plex
weak-head commented 3 months ago

Consider alternative approach with a template path for a destination:

commands:
  backup:
    destination: "/mnt/backups/{group}/{folder_name}/{folder_name}_{datetime}.{ext}"
    archive: rar_protected
    upload: aws_archival
    directories:
      apps:
        - /mnt/ssd/apps/plex
      media:
        - /mnt/hdd/music
      photos:
        - directory: /mnt/hdd/photos/2024
          destination: "/mnt/backups/photos/{folder_name}.{ext}"