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
nixos/borgbackup: Borgbackup retry #99196
base: master
Are you sure you want to change the base?
Conversation
Related: #85696 |
I marked this as stale due to inactivity. → More info |
I suggest you set a shorter interval instead and use |
@dotlambda, why? That sounds like a worse version of using the appropriate systemd features? Systemd knows whether or not the unit ran successfully so it doesn't require any superfluous checking of the remote repository. |
Is that even possible in an append-only scenario? |
Would appreciate a review on this. |
8288eb1
to
556a56d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotlambda, your scheduled end of the week (very end of the week) ping : ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a test case in which the server machine is started after the job is started for the first time in order to test whether the job is actually restarted.
1d359b2
to
ce28d24
Compare
@dotlambda, I have no experience with NixOS tests. How would I start a server after starting a job on it? |
should this be closed in favor of #153346? |
Have to say this is leaving a rather sour taste in my mouth. I'd also still like the Restart option so a failed attempt doesn't necessarily mean a lost backup. |
@toonn could you please resolve the merge conflicts? I would be happy to have this merged. Please have a look at: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/backup/borgbackup.nix#L104= |
I was lacking an option to specify borgbackup jobs should restart if they failed. My remote borg repo isn't always available so setting up weekly backups wasn't very useful. The backups failed every time so my files were never backed up. Specifying `Restart=on-failure` and `RestartSec=X min` should prevent spurious failures from ruining your day when it comes time to restore your non-existent backups : ) Might need a Persistent timer for more reliability, in case system happens to be powered down every day at the time of backup.
A persistent timer is useful if your machine is regularly turned off around scheduled backup times. It's useful to randomly delay the backup timers especially when they are persistent because they tend to bunch together when powering up your machine. I've renamed the `persistentTimer` option to be in line with other NixOS options like `nix.gc.persistent` and `systemd.timer` terminology. I've renamed `mkBackupTimers` to the singular because the plural is deceptive, the function only ever generates a config for a single timer. I also alphabetized the attrsets here and for the options, excepting `type` as seems to be the convention.
Co-authored-by: Robert Schütz <nix@dotlambda.de>
@Stunkymonkey, rebased. I renamed And I renamed |
Found |
By replacing I agree that this change should come with a test. |
Motivation for this change
I was lacking an option to specify borgbackup jobs should restart if
they failed. My remote borg repo isn't always available so setting up
weekly backups wasn't very useful. The backups failed every time so my
files were never backed up. Specifying
Restart=on-failure
andRestartSec=X min
should prevent spurious failures from ruining yourday when it comes time to restore your non-existent backups : )
Things done
I've run this patch (applied at nixos-19.09) for quite a while now and it's worked like a charm.
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)