spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.88k stars 1.04k forks source link

Borg Repo Key backup #2672

Closed ThellraAK closed 1 year ago

ThellraAK commented 1 year ago

Is your feature request related to a problem? Please describe.

There is no clear documentation on how to get your borg repokey

Describe the solution you'd like

Getting out the key is straightforward, you just need to take the docker exec command from /etc/systemd/system/matrix-backup-borg.service and replace the sh line with sh -c "borgmatic borg key export"

Describe alternatives you've considered

Could try and figure out how to make a systemd unit thing like the one I copy/pasted the command from, instead of copying and editing it.

Additional context

Seems like there's two ways to do this, update the documentation with "Copy Paste this command and change the SH bit" or creating a new systemd service oneshot thing, I'm willing to do the first, or try the second.

aine-etke commented 1 year ago

There is a script to perform such actions in the borg dir (iirc, /matrix/backup-borg/cli/borgmatic)

ThellraAK commented 1 year ago

@etkecc

Oh wow, you can actually just run borgmatic from in there

/matrix/backup-borg/bin/borgmatic borg key export

Gets you the repo key.

Something like this?
https://github.com/spantaleev/matrix-docker-ansible-deploy/compare/master...ThellraAK:matrix-docker-ansible-deploy:master

aine-etke commented 1 year ago

Yup, looks good, but I'd suggest to change a wording a bit to something like this: you don't have to backup repokey, because if remote repo is destroyed, you can't get encrypted backup from it anyway, but better to export it just in case

ThellraAK commented 1 year ago

@etkecc Yeah, for some reason I had it in my head you always needed the repokey...

I think adding this in will just confuse people, I don't think it's ever needed at all.