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/zrepl: init #113090
nixos/zrepl: init #113090
Conversation
|
594b033
to
fc1e78a
Compare
Ran this on a test dataset and it seems to work fine.
with config: { lib, ... }:
{
services.zrepl = {
enable = true;
settings = {
global = {
logging = [{
type = "syslog";
level = "info";
format = "human";
}];
};
jobs = [
{
name = "snapjob";
type = "snap";
filesystems = {
"tank/test<" = true;
};
snapshotting = {
type = "periodic";
interval = "5m";
prefix = "zrepl_snapjob_";
};
pruning = {
keep = [
{
type = "grid";
regex = "^zrepl_.*";
grid = lib.concatStringsSep " | " [
"3x5m" # 3 buckets of 1 snapshot every 5 minutes (15 minutes total)
"16x15m" # 16 buckets of 1 snapshot every 15 minutes (4 hours total)
"6x4h" # 6 buckets of 1 snapshot every 4 hours (1 day total)
"7x1d" # 7 buckets of 1 snapshot every 1 day (1 week total)
"4x1w" # 4 buckets of 1 snapshot every 1 week (~1 month total)
"12x30d" # 12 buckets of 1 snapshot every 30 days (~1 year total)
# (roughly) translated from znapzend config:
# plan = "15min=>5min,4h=>15min,1d=>4h,1w=>1d,1m=>1w,1y=>1m";
];
}
];
};
}
];
};
};
} One thing to keep in mind is that |
@ofborg eval |
b353028
to
e76eb05
Compare
As a test; added this service to a copy of |
zrepl is a ZFS backup and replication tool written in Go.
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.
lgtm, thanks! I'm looking forward to using this on haumea!
I never got around to finishing it, but if you want to build something with structured config options, here's a start: https://github.com/Baughn/machine-config/tree/master/zrepl |
@Baughn I'm guessing you meant to link this file: https://github.com/Baughn/machine-config/blob/master/modules/zrepl.nix I'm also using Baughn's zrepl module, though I added the ability to specify the name of a push job separately from the server CN, which is required if you want multiple push jobs to the same sink, to support multiple root pools (in my case, a fast SSD pool and a "slow" HDD pool) |
tbh, I'm quite happy with this "unstructured" config version -- it's easily extendable if they ever add or remove things from their configuration format without needing to touch the module itself. But if you feel like structuring / typing this, I'll gladly review a PR :) (I just don't feel the need to do submit a PR to that effect, myself.) |
Motivation for this change
People have expressed interest in a zrepl module for NixOS, so I've done the bare minimum to get one up and running. The module conforms to RFC 42 which made it much easier to get the module up and running, considering there was no real "logic" to implement.
Note that I have tested none of the functionality of the service yet, and thus am opening this as a draft.
I tried to have the config be validated at build time, but that doesn't work if you use a config that requires access to certs (the
configcheck
subcommand actually tries to read the file).Things done
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)cc potentially interested parties: @grahamc @ElvishJerricco @infinisil
Example config translated from the snap example: