Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tentacool container volume export backups #334

Closed
samhh opened this issue Jun 5, 2022 · 16 comments
Closed

Tentacool container volume export backups #334

samhh opened this issue Jun 5, 2022 · 16 comments

Comments

@samhh
Copy link
Owner

samhh commented Jun 5, 2022

Via sftp?

The volumes are pretty big, ~150MB in some cases. I might not want to back this up weekly when so little tends to change in that timeframe?

From experience I don't trust the in-app backups for either HASS or Pi-Hole to actually back everything up.

@samhh
Copy link
Owner Author

samhh commented Jun 18, 2022

Starmie's HASS volume backup is ~150MB, ~120MB of which is home-assistant_v2.db.

@samhh
Copy link
Owner Author

samhh commented Aug 17, 2022

Zigbee2MQTT's database (?) should be backed up as well.

@samhh
Copy link
Owner Author

samhh commented Aug 31, 2022

HASS is now up to 450MB for a backup, almost all of which is down to the database. This should grow with devices and history but not with time, as by default history is purged after ten days. Apparently that's all the database is used for. I don't really need this backing up given my horrendous upload bandwidth.

@samhh
Copy link
Owner Author

samhh commented Aug 31, 2022

Down to 33MB if I:

tar -f backup.tar --delete home-assistant_v2.db

@samhh
Copy link
Owner Author

samhh commented Aug 31, 2022

28MB:

tar -f backup.tar --wildcards --delete "home-assistant_v2.*"

@samhh
Copy link
Owner Author

samhh commented Aug 31, 2022

A zip backup can be requested and downloaded from the Zigbee2MQTT UI. For me right now it's tiny, ~30kB.

@samhh
Copy link
Owner Author

samhh commented Aug 31, 2022

9a20fb5 & 3e93a91

Starmie and Onix wouldn't be necessary if only they were configurable in Nix. Exeggutor always will be as it contains the Zigbee coordinator database.

Still missing some lesser used services.

@samhh
Copy link
Owner Author

samhh commented Aug 31, 2022

Also a nicer way to:

  1. Store/run that script (in the quotes).
  2. Provide su perms.

Would be nice.

@samhh
Copy link
Owner Author

samhh commented Sep 9, 2022

Is there a declarative backup solution?

@samhh
Copy link
Owner Author

samhh commented Nov 6, 2022

^ Here we go: 75f3be0

On restic branch for now. Deployed to Tentacool, let's see what happens overnight. Looks promising after an initial test on Alakazam. Timers are all set up as expected to run at 4am.

Restoring etc from Alakazam is a bit of a faff owing to #360 (NB restic encryption key is also in password store). I think if that were fixed I might be able to include the relevant decrypted env before running restic. For now the backup script can be modified similar to the documentation in the commit.

Should things look good tomorrow let's keep running the manual backup script as normal for now. The plan is to test how this works for a few weeks, including with restores, then remove or otherwise deprecate the Duplicity buckets and remove all calls to Duplicity from the backup script.

At that point it's a case of figuring out how to automate the remaining bits of the backup script. I imagine much or all of it can be handled via systemd timers managed by Nix.

Ideally at some point everything will be backed up automatically, almost all of it declaratively via Nix.

@samhh
Copy link
Owner Author

samhh commented Nov 7, 2022

^ Looks like the buckets are populated and the services all ran at 4AM on Tentacool. At the moment they run in parallel, that seems to be working fine but something to keep in mind is possibly offsetting them.

@samhh
Copy link
Owner Author

samhh commented Nov 14, 2022

Restic backups look like they're working well.

Only annoyance right now - not a blocker - is that the paths are <nas path>/<backup path> rather than just <backup path>. I can't find a Nix option that works around this (by changing PWD). Relevant upstream feature request: restic/restic#2092

Edit: It's also including backups for the Synology eaDir/ dirs, and .DS_Store. Related-ish: 421c66e. Could find some way of getting to --exclude.

@samhh
Copy link
Owner Author

samhh commented Nov 14, 2022

^ For the unwanted metadata: 81f4dbb

Deployed to Tentacool. Coming through in the backup commands in the units as --exclude=@eaDir/ --exclude=.DS_Store.

Raised the linked issue for the duplication between this and the wallpaper script.

@samhh
Copy link
Owner Author

samhh commented Nov 14, 2022

Let's test it tomorrow after another scheduled backup runs. Currently the latest snapshot includes the unwanted files:

$ <B2 ENV> restic --password-command <PASS CMD> -r b2:archive-restic2 ls latest | rg '(eaDir)|(.DS_Store)'
<many results>

@samhh
Copy link
Owner Author

samhh commented Dec 5, 2022

^ Working well for a few weeks. Backup script trimmed down: f54d6d8

@samhh
Copy link
Owner Author

samhh commented Dec 5, 2022

Mostly done. Next most relevant improvement tracked at #378.

@samhh samhh closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant