pghoard icon indicating copy to clipboard operation
pghoard copied to clipboard

support rclone

Open happy-v587 opened this issue 3 years ago • 2 comments

By using rclone tool, we can support more storage.

https://rclone.org/

Just want to ask if this way is OK? If it's OK, I'll sort out the documents and tests

happy-v587 avatar Aug 26 '21 07:08 happy-v587

Hello !

Thank you for contributing !

Out of curiosity, what is your use-case for rclone ? If it's a specific storage not already covered by PGHoard it might make sense to implement it directly.

As for direct rclone support, since it is a "meta-storage" so to speak, we don't feel like including it as-is. What we could do instead would be to allow to specify a class name as the storage type, and then use this, making the storage layer extensible. You could just move your RCloneTransfer class to another package, and then use it from the config file: "storage_type": "mypackage.RCloneTransfer"

Would that suit your needs ?

rdunklau avatar Sep 09 '21 13:09 rdunklau

@HappyUncle Thanks for this PR. Since it lacks of documentation, here's a simple example of how to use it:

{
  "backup_location": "/home/pghoard/backup/metadata",
  "backup_sites": {
    "example-site": {
      "nodes": [
        {
          "host": "127.0.0.1",
          "port": 5433,
          "user": "backup",
          "password": "secret",
          "application_name": "pghoard"
        }
      ],
      "object_storage": {
        "storage_type": "rclone",
        "remote_clone_config_path": "/home/pghoard/backup/rclone.conf",
        "source": "/home/pghoard/backup/rclone/",
        "destination": "onedrive-encrypted",
        "destination_path": "/backups/"
      },
      "pg_data_directory": "/var/lib/postgresql/14/main/"
    }
  }
}

Notes:

  • OneDrive is just cloud storage, it IS NOT a reliable backup target! Please use a real backup provider!
  • onedrive-encrypted is the target, which is defined in rclone.conf
  • the backup on the target located at: /backups/example-site/

tobwen avatar Nov 14 '21 06:11 tobwen