Keep a yearly Borg archive and for the past 12 months
Adjust backup timings Convert borgmatic config from Nix
This commit is contained in:
parent
afa0bd023e
commit
0fe9bf287f
4 changed files with 57 additions and 43 deletions
|
@ -79,6 +79,7 @@
|
||||||
rsync
|
rsync
|
||||||
fio
|
fio
|
||||||
libva-utils
|
libva-utils
|
||||||
|
jq
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = lib.mkIf (! machine.isRaspberryPi) {
|
boot = lib.mkIf (! machine.isRaspberryPi) {
|
||||||
|
|
|
@ -23,6 +23,8 @@ in
|
||||||
spec = {
|
spec = {
|
||||||
accessModes = [ "ReadWriteOnce" ];
|
accessModes = [ "ReadWriteOnce" ];
|
||||||
capacity.storage = longhornVolume.storage;
|
capacity.storage = longhornVolume.storage;
|
||||||
|
persistentVolumeReclaimPolicy = "Delete";
|
||||||
|
volumeMode = "Filesystem";
|
||||||
|
|
||||||
claimRef = {
|
claimRef = {
|
||||||
inherit name;
|
inherit name;
|
||||||
|
@ -32,24 +34,22 @@ in
|
||||||
csi = {
|
csi = {
|
||||||
driver = "driver.longhorn.io";
|
driver = "driver.longhorn.io";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
|
volumeHandle = name;
|
||||||
|
|
||||||
volumeAttributes = {
|
volumeAttributes = {
|
||||||
dataLocality = "disabled";
|
dataLocality = "disabled";
|
||||||
fromBackup = "";
|
fromBackup = "";
|
||||||
fsType = "ext4";
|
fsType = "ext4";
|
||||||
numberOfReplicas = "2";
|
numberOfReplicas = "2";
|
||||||
|
staleReplicaTimeout = "30";
|
||||||
|
unmapMarkSnapChainRemoved = "ignored";
|
||||||
|
|
||||||
recurringJobSelector = lib.generators.toYAML { } [{
|
recurringJobSelector = lib.generators.toYAML { } [{
|
||||||
name = "backup-nfs";
|
name = "backup-nfs";
|
||||||
isGroup = false;
|
isGroup = false;
|
||||||
}];
|
}];
|
||||||
staleReplicaTimeout = "30";
|
|
||||||
unmapMarkSnapChainRemoved = "ignored";
|
|
||||||
};
|
};
|
||||||
volumeHandle = name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
persistentVolumeReclaimPolicy = "Delete";
|
|
||||||
volumeMode = "Filesystem";
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
config.lab.longhornVolumes;
|
config.lab.longhornVolumes;
|
||||||
|
|
|
@ -10,41 +10,55 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
borgmaticConfig = pkgs.writeTextFile {
|
borgmaticConfig = pkgs.writeTextFile {
|
||||||
name = "borgmatic-config";
|
name = "borgmatic-config.yaml";
|
||||||
text = ''
|
|
||||||
source_directories:
|
text = lib.generators.toYAML { } {
|
||||||
- ${cfg.snapshotLocation}
|
source_directories = [ cfg.snapshotLocation ];
|
||||||
repositories:
|
|
||||||
- path: ${cfg.repoLocation}
|
repositories = [
|
||||||
label: nfs
|
{
|
||||||
- path: ssh://s6969ym3@s6969ym3.repo.borgbase.com/./repo
|
path = cfg.repoLocation;
|
||||||
label: borgbase
|
label = "nfs";
|
||||||
exclude_patterns:
|
}
|
||||||
- ${cfg.snapshotLocation}/media
|
{
|
||||||
ssh_command: "${pkgs.openssh}/bin/ssh -i ${config.age.secrets."borgbase.pem".path} -o StrictHostKeychecking=no"
|
path = "ssh://s6969ym3@s6969ym3.repo.borgbase.com/./repo";
|
||||||
keep_daily: 7
|
label = "borgbase";
|
||||||
keep_weekly: 4
|
}
|
||||||
keep_monthly: 6
|
];
|
||||||
encryption_passcommand: "${pkgs.coreutils}/bin/cat ''${BORG_PASSPHRASE_FILE}"
|
|
||||||
before_everything:
|
exclude_patterns = [ "${cfg.snapshotLocation}/media" ];
|
||||||
- ${beforeEverything}/bin/beforeEverything
|
ssh_command = "${pkgs.openssh}/bin/ssh -i ${config.age.secrets."borgbase.pem".path} -o StrictHostKeychecking=no";
|
||||||
postgresql_databases:
|
keep_daily = 7;
|
||||||
- name: nextcloud
|
keep_weekly = 4;
|
||||||
hostname: lewis.dmz
|
keep_monthly = 12;
|
||||||
username: nextcloud
|
keep_yearly = -1;
|
||||||
password: ''${NEXTCLOUD_DATABASE_PASSWORD}
|
encryption_passcommand = "${pkgs.coreutils}/bin/cat ${config.age.secrets."borg_passphrase".path}";
|
||||||
format: tar
|
before_everything = [ "${beforeEverything}/bin/beforeEverything" ];
|
||||||
- name: hedgedoc
|
|
||||||
hostname: lewis.dmz
|
postgresql_databases = [
|
||||||
username: hedgedoc
|
{
|
||||||
password: ''${HEDGEDOC_DATABASE_PASSWORD}
|
name = "nextcloud";
|
||||||
format: tar
|
hostname = "lewis.dmz";
|
||||||
- name: paperless
|
username = "nextcloud";
|
||||||
hostname: lewis.dmz
|
password = "\${NEXTCLOUD_DATABASE_PASSWORD}";
|
||||||
username: paperless
|
format = "tar";
|
||||||
password: ''${PAPERLESS_DATABASE_PASSWORD}
|
}
|
||||||
format: tar
|
{
|
||||||
'';
|
name = "hedgedoc";
|
||||||
|
hostname = "lewis.dmz";
|
||||||
|
username = "hedgedoc";
|
||||||
|
password = "\${HEDGEDOC_DATABASE_PASSWORD}";
|
||||||
|
format = "tar";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "paperless";
|
||||||
|
hostname = "lewis.dmz";
|
||||||
|
username = "paperless";
|
||||||
|
password = "\${PAPERLESS_DATABASE_PASSWORD}";
|
||||||
|
format = "tar";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
@ -116,7 +130,7 @@ in
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = "*-*-* 3:00:00";
|
OnCalendar = "*-*-* 3:00:00";
|
||||||
Persistent = true;
|
Persistent = true;
|
||||||
RandomizedDelaySec = "3h";
|
RandomizedDelaySec = "1h";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,6 @@ in {
|
||||||
k3s
|
k3s
|
||||||
openiscsi # Required for Longhorn
|
openiscsi # Required for Longhorn
|
||||||
nfs-utils # Required for Longhorn
|
nfs-utils # Required for Longhorn
|
||||||
jq # Required for Longhorn
|
|
||||||
];
|
];
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
|
|
Loading…
Reference in a new issue