summaryrefslogtreecommitdiffstats
path: root/configs/backup.nix
blob: 30d60111e3373498312f20d20a272570c3a464c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
{ config, lib, mylib, pkgs, ... }: {
  krebs.backup.plans = {
  } // lib.mapAttrs (_: lib.recursiveUpdate {
    snapshots = {
      daily    = { format = "%Y-%m-%d"; retain =  7; };
      weekly   = { format = "%YW%W";    retain =  4; };
      monthly  = { format = "%Y-%m";    retain = 12; };
      yearly   = { format = "%Y";                    };
    };
  }) {
    bu-home-xu = {
      method = "push";
      src = { host = config.krebs.hosts.bu; path = "/home"; };
      dst = { host = config.krebs.hosts.xu; path = "/bku/bu-home"; };
      startAt = "05:20";
    };
    bu-home-zu = {
      method = "push";
      src = { host = config.krebs.hosts.bu; path = "/home"; };
      dst = { host = config.krebs.hosts.zu; path = "/bku/bu-home"; };
      startAt = "05:25";
    };
    nomic-home-xu = {
      method = "push";
      src = { host = config.krebs.hosts.nomic; path = "/home"; };
      dst = { host = config.krebs.hosts.xu;    path = "/bku/nomic-home"; };
      startAt = "05:00";
    };
    nomic-home-zu = {
      method = "push";
      src = { host = config.krebs.hosts.nomic; path = "/home"; };
      dst = { host = config.krebs.hosts.zu; path = "/bku/nomic-home"; };
      startAt = "04:20";
    };
    nomic-pull-querel-home = {
      method = "pull";
      src = { host = config.krebs.hosts.querel; path = "/home"; };
      dst = { host = config.krebs.hosts.nomic; path = "/fs/ponyhof/bku/querel-home"; };
      startAt = "22:00";
    };
    xu-home-bu = {
      method = "push";
      src = { host = config.krebs.hosts.xu; path = "/home"; };
      dst = { host = config.krebs.hosts.bu; path = "/bku/xu-home"; };
      startAt = "04:50";
    };
    xu-home-nomic = {
      method = "push";
      src = { host = config.krebs.hosts.xu; path = "/home"; };
      dst = { host = config.krebs.hosts.nomic; path = "/fs/cis3hG/bku/xu-home"; };
      startAt = "05:20";
    };
    xu-home-zu = {
      method = "push";
      src = { host = config.krebs.hosts.xu; path = "/home"; };
      dst = { host = config.krebs.hosts.zu; path = "/bku/xu-home"; };
      startAt = "06:20";
    };
    xu-pull-ni-ejabberd = {
      method = "pull";
      src = { host = config.krebs.hosts.ni; path = "/var/lib/ejabberd"; };
      dst = { host = config.krebs.hosts.xu; path = "/bku/ni-ejabberd"; };
      startAt = "07:00";
    };
    xu-pull-ni-home = {
      method = "pull";
      src = { host = config.krebs.hosts.ni; path = "/home"; };
      dst = { host = config.krebs.hosts.xu; path = "/bku/ni-home"; };
      startAt = "07:00";
    };
    zu-home-xu = {
      method = "push";
      src = { host = config.krebs.hosts.zu; path = "/home"; };
      dst = { host = config.krebs.hosts.xu; path = "/bku/zu-home"; };
      startAt = "05:00";
    };
    zu-pull-ni-ejabberd = {
      method = "pull";
      src = { host = config.krebs.hosts.ni; path = "/var/lib/ejabberd"; };
      dst = { host = config.krebs.hosts.zu; path = "/bku/ni-ejabberd"; };
      startAt = "06:00";
    };
    zu-pull-ni-home = {
      method = "pull";
      src = { host = config.krebs.hosts.ni; path = "/home"; };
      dst = { host = config.krebs.hosts.zu; path = "/bku/ni-home"; };
      startAt = "06:30";
    };
  } // lib.mapAttrs (_: lib.recursiveUpdate {
    snapshots = {
      minutely = { format = "%Y-%m-%dT%H:%M"; retain = 3; };
      hourly   = { format = "%Y-%m-%dT%H";    retain = 3; };
      daily    = { format = "%Y-%m-%d";       retain = 3; };
    };
    startAt = null;
  }) {
    xu-test-push-xu = {
      method = "push";
      src = { host = config.krebs.hosts.xu; path = "/tmp/xu-bku-test-data"; };
      dst = { host = config.krebs.hosts.xu; path = "/bku/xu-test-push"; };
    };
    xu-test-pull-xu = {
      method = "pull";
      src = { host = config.krebs.hosts.xu; path = "/tmp/xu-bku-test-data"; };
      dst = { host = config.krebs.hosts.xu; path = "/bku/xu-test-pull"; };
    };
  };
}