volsync icon indicating copy to clipboard operation
volsync copied to clipboard

Support a kopia-based backup

Open onedr0p opened this issue 3 years ago • 13 comments

Describe the feature you'd like to have.

Hi again 👋🏼

Would it be possible to support Kopia? I know you already have support for restic, for data backups, but I figured Kopia would fit in nicely as it's becoming a very popular tool for incremental data backup. In my tests, it is also blazing fast.

https://github.com/kopia/kopia

It is written in Go and has decent APIs

https://pkg.go.dev/github.com/kopia/kopia/repo?utm_source=godoc

What is the value to the end user? (why is it a priority?)

Supporting another way of backing and restoring data.

How will we know we have a good solution? (acceptance criteria)

Additional context

onedr0p avatar Jul 15 '22 01:07 onedr0p

Found below link with Kopia benchmark details while browsing through the history of Kopia. https://www.kasten.io/kubernetes/resources/blog/benchmarking-kopia-architecture-scale-and-performance

vh05 avatar Jul 19 '22 07:07 vh05

Yeah those benchmarks are pretty clear that Kopia is a serious contender to Restic :)

onedr0p avatar Jul 19 '22 14:07 onedr0p

hi any plans for this?

trieded avatar Nov 27 '22 09:11 trieded

There's needs to be some considerations made on how to implement this since kopia works a little different than existing movers. For example kopia can support a single "kopia repository" for multiple kubernetes volumes and "kopia snapshots" are the way you backup or restore data.

onedr0p avatar Nov 27 '22 18:11 onedr0p

Local Filesystem Commands

This method is for using Kopia on your filesystem, not backing up to s3. Kopia does support s3 but I need to look into how that works. It's probably quite similar.

In the backup and restore examples below the following are defined as:

  • /snapshots is the location of the Kopia Repository
  • /data is the location of the PVC root filesystem

Note that in the examples below /snapshots is a single Kopia Repository with multiple snapshots across all PVCs that are backed up. This can help with deduplication if all the PVC volumes are in the same Kopia Repository. It could also be architected to support a 1:1 snapshot to Kopia Repository like the restic implementation is currently doing.

At a glance in the Kopia web UI, a single Kopia Repository with multiple snapshots (PVCs) looks like this:

image

Create backup

[[ ! -f /snapshots/kopia.repository.f ]] && kopia repository create filesystem --path=/snapshots
kopia repo connect filesystem --path=/snapshots --override-hostname=cluster --override-username=root
kopia policy set /data/<namespace/<app>/<claim> --compression=zstd --keep-latest 14 --keep-hourly 0 --keep-daily 7 --keep-weekly 2 --keep-monthly 0 --keep-annual 0
kopia snap create /data/<namespace/<app>/<claim>
kopia repo disconnect

Restore Backup

# Get latest snapshot ID
SNAPSHOT=$(kopia snapshot list /data/<namespace/<app>/<claim> --json | jq --raw-output '.[-1] | .id')
kopia repo connect filesystem --path=/snapshots --override-hostname=cluster --override-username=root
kopia snap restore "${SNAPSHOT}" /data/<namespace/<app>/<claim>
kopia repo disconnect

Maintenance

This can also be set to run after snapshot but it probably wouldn't be wise to have that happen in case it happens several or more times at once.

kopia repo connect filesystem --path=/snapshots --override-hostname=cluster --override-username=root
kopia maintenance set --owner=root@cluster
kopia maintenance run --full
kopia repo disconnect

I hope this can help lend some help on implementing this feature into VolSync.

onedr0p avatar Nov 27 '22 19:11 onedr0p

hi any plans for this?

We don't have any plans at this time. The issue is simply a lack of dev resources for implementation and ongoing maintenance of a mover that is largely redundant w/ the restic one.

I realize that kopia seems to be gaining favor over restic. Perhaps in the future our priorities will change.

JohnStrunk avatar Nov 28 '22 15:11 JohnStrunk

Are you all open to PRs to add Kopia support @JohnStrunk ?

onedr0p avatar Nov 28 '22 16:11 onedr0p

I'd be happy to help with the PR as well, if John is open to PRs that add Kopia's support.

perfectra1n avatar Oct 06 '23 00:10 perfectra1n

@tesshuflower and I discussed this a bit, and we'd like to find a way that we can take more community contributions to the project. So, if you all are interested in contributing a kopia mover, we're happy to shepherd it through.

By the end of the process, we need to have:

  • Mover code (controller + mover parts)
  • Documentation
  • Tests

Since this will be a fairly substantial piece, starting w/ a design PR is probably a good place to begin.

JohnStrunk avatar Nov 01 '23 15:11 JohnStrunk