backups #47

Merged
teutat3s merged 7 commits from feat/backups into main 2023-11-06 21:24:04 +00:00
11 changed files with 116 additions and 4 deletions
Showing only changes of commit 42fbde31e5 - Show all commits

View file

@ -107,4 +107,17 @@
environment.variables = {
GPG_TTY = "$(tty)";
};
services.restic.backups.forgejo = flake.self.lib.droppieBackup {
paths = [
"/var/lib/forgejo"
"/tmp/forgejo-backup.sql"
];
backupPrepareCommand = ''
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d gitea > /tmp/forgejo-backup.sql
'';
backupCleanupCommand = ''
rm /tmp/forgejo-backup.sql
'';
};
}

View file

@ -46,4 +46,16 @@
"pub.solar" = flake.inputs.keycloak-theme-pub-solar.legacyPackages.${pkgs.system}.keycloak-theme-pub-solar;
};
};
services.restic.backups.keycloak = flake.self.lib.droppieBackup {
paths = [
"/tmp/keycloak-backup.sql"
];
backupPrepareCommand = ''
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d keycloak > /tmp/keycloak-backup.sql
'';
backupCleanupCommand = ''
rm /tmp/keycloak-backup.sql
'';
};
}

View file

@ -79,4 +79,12 @@
# "allauth.socialaccount.providers.gitlab"
# ])
#'';
services.restic.backups.mailman = flake.self.lib.droppieBackup {
paths = [
"/var/lib/mailman"
"/var/lib/mailman-web/mailman-web.db"
"/var/lib/postfix/conf/aliases.db"
];
};
}

View file

@ -1,6 +1,10 @@
{ config, pkgs, flake, inputs, ... }:
{
config,
pkgs,
flake,
inputs,
...
}: {
age.secrets."mastodon-secret-key-base" = {
file = "${flake.self}/secrets/mastodon-secret-key-base.age";
mode = "400";
@ -93,4 +97,16 @@
OMNIAUTH_ONLY = "true";
};
};
services.restic.backups.mastodon = flake.self.lib.droppieBackup {
paths = [
"/tmp/mastodon-backup.sql"
];
backupPrepareCommand = ''
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d gitea > /tmp/mastodon-backup.sql
b12f marked this conversation as resolved Outdated

gitea -> mastodon

`gitea` -> `mastodon`
'';
backupCleanupCommand = ''
rm /tmp/mastodon-backup.sql
'';
};
}

View file

@ -3,8 +3,7 @@
pkgs,
flake,
...
}:
{
}: {
age.secrets."nextcloud-secrets" = {
file = "${flake.self}/secrets/nextcloud-secrets.age";
mode = "400";
@ -130,4 +129,17 @@
autoUpdateApps.enable = true;
database.createLocally = true;
};
services.restic.backups.nextcloud = flake.self.lib.droppieBackup {
paths = [
"/var/lib/nextcloud/data"
"/tmp/nextcloud-backup.sql"
];
backupPrepareCommand = ''
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d nextcloud > /tmp/nextcloud-backup.sql
'';
backupCleanupCommand = ''
rm /tmp/nextcloud-backup.sql
'';
};
}

View file

@ -0,0 +1,7 @@
{ flake, ... }: {
age.secrets."restic-repo-droppie" = {
file = "${flake.self}/secrets/restic-repo-droppie.age";
mode = "400";
owner = "root";
};
}

View file

@ -7,6 +7,7 @@
./configuration.nix
./networking.nix
./backups.nix
./apps/nginx.nix
./apps/collabora.nix

View file

@ -11,6 +11,10 @@
## In configs, they can be used under "lib.our"
deploy = import ./deploy.nix { inherit inputs lib; };
linux = {
unlockZFSOnBoot = import ./unlock-zfs-on-boot.nix {publicKeys = self.publicKeys.allAdmins;};
};
};
};
}

10
lib/droppie-backup.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, ... }: extraOptions: {
timerConfig = {
OnCalendar = "*-*-* 02:00:00 Etc/UTC";
# droppie will be offline if nachtigall misses the timer
Persistent = false;
};
initialize = true;
passwordFile = config.age.secrets."restic-repo-droppie".path;
repository = "yule@droppie.b12f.io:/media/internal/backups-pub-solar";
} // extraOptions

View file

@ -0,0 +1,27 @@
age-encryption.org/v1
-> ssh-ed25519 iDKjwg T5uxRdAUm+mxC5VdLsJcvA7BolM8l0cofI8V6fEUEBE
dCpeg4SheN/krKGe72jHNbdul3Lvy/AwG3dq4pY/AkM
-> ssh-ed25519 uYcDNw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WUxVi/PKdrg4
k5J8BnC0ltep+Unjvc9rbsTAERAAwHVBx3Le1Uw3i7k
-> fz6"|e\K-grease ~A 1vo}k)X ;M<?)N(
Vk3qpd1xFZX7MJ9C7gYW
--- 7AC9JN+pNedtCrkbAxsME8f/pDqsGJf9a6hA5YvILhU
ËeÉ#&8áäÞ çgNȺœ9è·ìEùÄhItDq&§j06nðË1ÇF/&Â6(óH|B<>¥ù^Y}Œ;8š·fHaVc_¢Ä~^_ÛÇ Ø†m9sŽ-

View file

@ -43,4 +43,6 @@ in {
"nextcloud-admin-pass.age".publicKeys = nachtigallKeys ++ baseKeys;
"searx-environment.age".publicKeys = nachtigallKeys ++ baseKeys;
"restic-repo-droppie.age".publicKeys = nachtigallKeys ++ baseKeys;
}