I’m experimenting with running NextCloud (AIO) on a VPS with a B2 bucket as the primary storage. I want to compare performance compared to running it on my home server (esp. when I’m remote) and get an idea of the kinds of costs I’d rack up doing it.
As part of the setup I have configured the built in borg backup but it has this caveat:
Be aware that this solution does not back up files and folders that are mounted into Nextcloud using the external storage app - but you can add further Docker volumes and host paths that you want to back up after the initial backup is done.
The primary storage is external but I’m not using the “external storage” app. So, I have 2 questions.
- Does it backup object storage if it’s primary (my gut says no)?
- If no, what’s a good way to backup the B2 bucket?
I’ve done some research on this topic and I’m kinda coming up empty. I would normally use restic but restic doesn’t work in that direction (B2 -> local backup).
It looks like rclone can be used to mount a B2 bucket. One idea I had was to mount it, read-only, and let AIO/borg backup that path with the container backups.
Has anyone done this before? Any thoughts?
Did you try to mount your bucket on your host system via rclone?
rclone mount b2:bucket /path/on/host --daemon --vfs-cache-mode full
I would mount it on the host system and add an additional volume in your docker-compose.yml
You could give this a try, if you want to use it in your container 🤔
I did. That’s where I ran into the problems.
I’m embarrassed to admit I didn’t try this. I think I was too far into the weeds the other night. I’ll give this a try.
If it works, I’m thinking I’ll need to setup a systemd service to auto-mount the path on boot and set it as a dependency in docker so docker doesn’t start before it?
Your way should work with a systemd service. I do it the same way but I just need one bucket mounted in my file system, so I don’t need dependencies
I was able to get the rclone mount on boot via a systemd unit without much trouble.
I even managed to drag it kicking and screaming into a docker volume that I mounted as an external volume to the Nextcloud AIO stack. It still refused to allow me to add it as a backup directory.
I think I’m throwing in the towel with getting Nextcloud to back it up via the built in mechanism. I’ll just schedule a separate job (cron/systemd) that runs shortly after the Nextcloud backup. It should be close enough for my purposes.