@cryptotaxi247 / infra / commits / 3ceb8cc7

haumea: remove zrepl

Martin Weinelt committed Dec 14, 2025 at 02:56 UTC 3ceb8cc7612183437858357f4e9163fbe99af84a
2 files changed -136
build/haumea/default.nix
-1
@@ -12,7 +12,6 @@
12 ./boot.nix
13 ./network.nix
14 ./postgresql.nix
15 - ./zrepl.nix
15 ];
16
17 networking = {
build/haumea/zrepl.nix deleted
-135
@@ -1,135 +0,0 @@
1 -{
2 - config,
3 - lib,
4 - ...
5 -}:
6 -
7 -{
8 - age.secrets."zrepl-ssh-key" = {
9 - file = ../secrets/zrepl-ssh-key.age;
10 - mode = "0400";
11 - };
12 -
13 - programs.ssh = {
14 - knownHosts = {
15 - rsync-net = {
16 - hostNames = [
17 - "zh2543b.rsync.net"
18 - "2001:1620:2019::324"
19 - ];
20 - publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKlIcNwmx7id/XdYKZzVX2KtZQ4PAsEa9KVQ9N43L3PX";
21 - };
22 - };
23 - };
24 -
25 - services.zrepl =
26 - let
27 - defaultBackupJob = {
28 - type = "push";
29 - filesystems."rpool/safe<" = true;
30 - snapshotting = {
31 - type = "periodic";
32 - interval = "30m";
33 - prefix = "zrepl_snap_";
34 - hooks = [
35 - {
36 - # https://zrepl.github.io/master/configuration/snapshotting.html#postgres-checkpoint-hook
37 - type = "postgres-checkpoint";
38 - dsn = "host=/run/postgresql dbname=hydra user=root sslmode=disable";
39 - filesystems."rpool/safe/postgres" = true;
40 - }
41 - ];
42 - };
43 -
44 - # The current pruning setup is an exponentially growing scheme, at both sides.
45 - pruning = {
46 - keep_sender = [
47 - { type = "not_replicated"; }
48 - {
49 - type = "grid";
50 - regex = "^zrepl_snap_.*";
51 - grid = lib.concatStringsSep " | " [
52 - "1x1h(keep=all)"
53 - "1x1h"
54 - "1x2h"
55 - "1x4h"
56 - # "grid" acts weird if an interval isn't a whole-number multiple
57 - # of the previous one, so we jump from 8h to 24h
58 - "2x8h"
59 - "1x1d"
60 - "1x2d"
61 - "1x4d"
62 - "1x8d"
63 - # At this point we keep ~10 snapshots spanning 8--16 days (depends on moment),
64 - # with exponentially increasing spacing (almost).
65 - ];
66 - }
67 - ];
68 - keep_receiver = [
69 - {
70 - type = "grid";
71 - regex = "^zrepl_snap_.*";
72 - grid = lib.concatStringsSep " | " [
73 - "2x1h(keep=all)"
74 - "2x1h"
75 - "2x2h"
76 - "2x4h"
77 - "4x8h"
78 - # At this point the grid spans 2 days by ~13 snapshots.
79 - # (See note above about 8h -> 24h.)
80 - "2x1d"
81 - "2x2d"
82 - "2x4d"
83 - "2x8d"
84 - "2x16d"
85 - "2x32d"
86 - "2x64d"
87 - "2x128d"
88 - # At this point we keep ~29 snapshots spanning 384--512 days (depends on moment),
89 - # with exponentially increasing spacing (almost).
90 - ];
91 - }
92 - ];
93 - };
94 - };
95 - in
96 - {
97 - enable = true;
98 - settings = {
99 - global = {
100 - logging = [
101 - {
102 - type = "syslog";
103 - level = "info";
104 - format = "human";
105 - }
106 - ];
107 - };
108 -
109 - jobs = [
110 - # Covers 20240629+
111 - (
112 - defaultBackupJob
113 - // {
114 - name = "rsyncnet";
115 - connect = {
116 - identity_file = config.age.secrets."zrepl-ssh-key".path;
117 - type = "ssh+stdinserver";
118 - host = "zh4461b.rsync.net";
119 - user = "root";
120 - port = 22;
121 - };
122 - }
123 - )
124 - /*
125 - rsync.net provides a VM with FreeBSD
126 - - almost nothing is preserved on upgrades except this "data1" zpool
127 - $ scp ./zrepl.yml root@zh4461b.rsync.net:/usr/local/etc/zrepl/zrepl.yml
128 - # pkg install zrepl
129 - # service zrepl enable
130 - # service zrepl start
131 - */
132 - ];
133 - };
134 - };
135 -}