diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2025-03-14 00:33:59 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2025-03-14 01:06:18 +0100 |
commit | 3556fca8370666371de613e6221d407bc553c902 (patch) | |
tree | beb10e4ab40078295d2d45566e48b9aa6e86616a /systems/dilion | |
parent | 70952c48b9895d587dd7f548e0bdb56d0a02818a (diff) | |
download | Nix-3556fca8370666371de613e6221d407bc553c902.tar.gz Nix-3556fca8370666371de613e6221d407bc553c902.tar.zst Nix-3556fca8370666371de613e6221d407bc553c902.zip |
Zrepl config with raspi
Diffstat (limited to 'systems/dilion')
-rw-r--r-- | systems/dilion/base.nix | 76 | ||||
-rw-r--r-- | systems/dilion/flake.lock | 10 |
2 files changed, 56 insertions, 30 deletions
diff --git a/systems/dilion/base.nix b/systems/dilion/base.nix index b47d928..05593aa 100644 --- a/systems/dilion/base.nix +++ b/systems/dilion/base.nix | |||
@@ -230,6 +230,7 @@ | |||
230 | 230 | ||
231 | systemd.services.zrepl.serviceConfig.User = "backup"; | 231 | systemd.services.zrepl.serviceConfig.User = "backup"; |
232 | systemd.services.zrepl.path = [ pkgs.openssh ]; | 232 | systemd.services.zrepl.path = [ pkgs.openssh ]; |
233 | systemd.services.zrepl.unitConfig.After = lib.mkForce [ "wg-quick-wg0.service" "zfs.target" ]; | ||
233 | # pour eldiron: | 234 | # pour eldiron: |
234 | # zfs allow backup create,mount,receive,destroy,rename,snapshot,hold,bookmark,release zpool/backup | 235 | # zfs allow backup create,mount,receive,destroy,rename,snapshot,hold,bookmark,release zpool/backup |
235 | # pour flony: | 236 | # pour flony: |
@@ -242,44 +243,69 @@ | |||
242 | jobs = [ | 243 | jobs = [ |
243 | { | 244 | { |
244 | type = "sink"; | 245 | type = "sink"; |
245 | # must not change | 246 | name = "backup-from-immae-eu"; |
246 | name = "backup-from-eldiron"; | ||
247 | root_fs = "zpool/backup"; | 247 | root_fs = "zpool/backup"; |
248 | serve.type = "tls"; | 248 | serve.type = "tls"; |
249 | serve.listen = ":19000"; | 249 | serve.listen = "192.168.1.8:19000"; |
250 | serve.ca = config.secrets.fullPaths."zrepl/certificates/eldiron.crt"; | 250 | serve.ca = config.secrets.fullPaths."zrepl/certificates/ca.crt"; |
251 | serve.cert = config.secrets.fullPaths."zrepl/certificates/dilion.crt"; | 251 | serve.cert = config.secrets.fullPaths."zrepl/certificates/dilion.crt"; |
252 | serve.key = config.secrets.fullPaths."zrepl/dilion.key"; | 252 | serve.key = config.secrets.fullPaths."zrepl/dilion.key"; |
253 | serve.client_cns = [ "eldiron" ]; | 253 | serve.client_cns = [ "eldiron" ]; |
254 | } | 254 | } |
255 | { | 255 | { |
256 | type = "source"; | 256 | type = "push"; |
257 | # must not change | 257 | # must not change |
258 | name = "backup-to-wd-zpool"; | 258 | name = "backup-to-raspi-encrypted"; |
259 | # not encrypted! | ||
260 | serve.type = "tls"; | ||
261 | serve.listen = ":19001"; | ||
262 | serve.ca = config.secrets.fullPaths."zrepl/certificates/flony.crt"; | ||
263 | serve.cert = config.secrets.fullPaths."zrepl/certificates/dilion.crt"; | ||
264 | serve.key = config.secrets.fullPaths."zrepl/dilion.key"; | ||
265 | serve.client_cns = [ "flony" ]; | ||
266 | filesystems."zpool/libvirt<" = true; | ||
267 | filesystems."zpool/root<" = true; | 259 | filesystems."zpool/root<" = true; |
268 | snapshotting.type = "manual"; | 260 | filesystems."zpool/root/tmp" = false; |
261 | connect = { | ||
262 | address = "192.168.44.101:19025"; | ||
263 | type = "tls"; | ||
264 | server_cn = "raspi"; | ||
265 | ca = config.secrets.fullPaths."zrepl/certificates/ca.crt"; | ||
266 | cert = config.secrets.fullPaths."zrepl/certificates/dilion.crt"; | ||
267 | key = config.secrets.fullPaths."zrepl/dilion.key"; | ||
268 | }; | ||
269 | send.encrypted = true; | ||
270 | snapshotting = { | ||
271 | type = "cron"; | ||
272 | prefix = "raspi_zrepl_"; | ||
273 | cron = "30 1 * * *"; # Europe/Paris | ||
274 | }; | ||
275 | pruning.keep_sender = [ | ||
276 | { type = "regex"; negate = true; regex = "^raspi_zrepl_.*"; } | ||
277 | { type = "grid"; grid = "3x1d"; regex = "^raspi_zrepl_.*"; } | ||
278 | ]; | ||
279 | pruning.keep_receiver = [ | ||
280 | { type = "grid"; grid = "3x1d"; regex = "^raspi_zrepl_.*"; } | ||
281 | ]; | ||
269 | } | 282 | } |
270 | { | 283 | { |
271 | type = "source"; | 284 | type = "push"; |
272 | # must not change | 285 | # must not change |
273 | name = "backup-to-wd-zpool-docker"; | 286 | name = "backup-to-raspi-clear"; |
274 | # not encrypted! | ||
275 | serve.type = "tls"; | ||
276 | serve.listen = ":19002"; | ||
277 | serve.ca = config.secrets.fullPaths."zrepl/certificates/flony.crt"; | ||
278 | serve.cert = config.secrets.fullPaths."zrepl/certificates/dilion.crt"; | ||
279 | serve.key = config.secrets.fullPaths."zrepl/dilion.key"; | ||
280 | serve.client_cns = [ "flony" ]; | ||
281 | filesystems."zpool/docker<" = true; | 287 | filesystems."zpool/docker<" = true; |
282 | snapshotting.type = "manual"; | 288 | filesystems."zpool/libvirt<" = true; |
289 | connect = { | ||
290 | address = "192.168.44.101:19025"; | ||
291 | type = "tls"; | ||
292 | server_cn = "raspi"; | ||
293 | ca = config.secrets.fullPaths."zrepl/certificates/ca.crt"; | ||
294 | cert = config.secrets.fullPaths."zrepl/certificates/dilion.crt"; | ||
295 | key = config.secrets.fullPaths."zrepl/dilion.key"; | ||
296 | }; | ||
297 | snapshotting = { | ||
298 | type = "cron"; | ||
299 | prefix = "raspi_zrepl_"; | ||
300 | cron = "0 1 * * *"; # Europe/Paris | ||
301 | }; | ||
302 | pruning.keep_sender = [ | ||
303 | { type = "regex"; negate = true; regex = "^raspi_zrepl_.*"; } | ||
304 | { type = "grid"; grid = "3x1d"; regex = "^raspi_zrepl_.*"; } | ||
305 | ]; | ||
306 | pruning.keep_receiver = [ | ||
307 | { type = "grid"; grid = "3x1d"; regex = "^raspi_zrepl_.*"; } | ||
308 | ]; | ||
283 | } | 309 | } |
284 | ]; | 310 | ]; |
285 | }; | 311 | }; |
diff --git a/systems/dilion/flake.lock b/systems/dilion/flake.lock index 71557c0..0a03786 100644 --- a/systems/dilion/flake.lock +++ b/systems/dilion/flake.lock | |||
@@ -59,7 +59,7 @@ | |||
59 | "environment": { | 59 | "environment": { |
60 | "locked": { | 60 | "locked": { |
61 | "lastModified": 1, | 61 | "lastModified": 1, |
62 | "narHash": "sha256-TsRuohxw/zmZy1PV2kyraE9VbLULWOyad2jir8O9UbQ=", | 62 | "narHash": "sha256-6HzZMgW6wsSkeN87+OcMhVnWxUKFT2C9EMXvmMfxRzc=", |
63 | "path": "../../flakes/private/environment", | 63 | "path": "../../flakes/private/environment", |
64 | "type": "path" | 64 | "type": "path" |
65 | }, | 65 | }, |
@@ -71,7 +71,7 @@ | |||
71 | "environment_2": { | 71 | "environment_2": { |
72 | "locked": { | 72 | "locked": { |
73 | "lastModified": 1, | 73 | "lastModified": 1, |
74 | "narHash": "sha256-TsRuohxw/zmZy1PV2kyraE9VbLULWOyad2jir8O9UbQ=", | 74 | "narHash": "sha256-6HzZMgW6wsSkeN87+OcMhVnWxUKFT2C9EMXvmMfxRzc=", |
75 | "path": "../environment", | 75 | "path": "../environment", |
76 | "type": "path" | 76 | "type": "path" |
77 | }, | 77 | }, |
@@ -83,7 +83,7 @@ | |||
83 | "environment_3": { | 83 | "environment_3": { |
84 | "locked": { | 84 | "locked": { |
85 | "lastModified": 1, | 85 | "lastModified": 1, |
86 | "narHash": "sha256-TsRuohxw/zmZy1PV2kyraE9VbLULWOyad2jir8O9UbQ=", | 86 | "narHash": "sha256-6HzZMgW6wsSkeN87+OcMhVnWxUKFT2C9EMXvmMfxRzc=", |
87 | "path": "../environment", | 87 | "path": "../environment", |
88 | "type": "path" | 88 | "type": "path" |
89 | }, | 89 | }, |
@@ -207,7 +207,7 @@ | |||
207 | }, | 207 | }, |
208 | "locked": { | 208 | "locked": { |
209 | "lastModified": 1, | 209 | "lastModified": 1, |
210 | "narHash": "sha256-UtTwF1ni+Qy4n65KjH2WLtb263VIf7fnvVWExxSMR6U=", | 210 | "narHash": "sha256-7tqKXf2kdZ2wIEQTJud7gdN+/eOkXxeQeT03KwmfTwQ=", |
211 | "path": "../../flakes/private/monitoring", | 211 | "path": "../../flakes/private/monitoring", |
212 | "type": "path" | 212 | "type": "path" |
213 | }, | 213 | }, |
@@ -599,7 +599,7 @@ | |||
599 | }, | 599 | }, |
600 | "locked": { | 600 | "locked": { |
601 | "lastModified": 1, | 601 | "lastModified": 1, |
602 | "narHash": "sha256-InNiobFoX6ugM50G4xuWHJrFjqkRTXixxvTjj69wfuw=", | 602 | "narHash": "sha256-VUtVclRBHcgFrAuf3tdhcA/f1h7U1gBj7KFu0lAnP34=", |
603 | "path": "../../flakes/private/system", | 603 | "path": "../../flakes/private/system", |
604 | "type": "path" | 604 | "type": "path" |
605 | }, | 605 | }, |