refactor: small backup refactoring
This commit is contained in:
parent
42fbde31e5
commit
841757517f
|
@ -108,11 +108,19 @@
|
||||||
GPG_TTY = "$(tty)";
|
GPG_TTY = "$(tty)";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.restic.backups.forgejo = flake.self.lib.droppieBackup {
|
services.restic.backups.forgejo = {
|
||||||
paths = [
|
paths = [
|
||||||
"/var/lib/forgejo"
|
"/var/lib/forgejo"
|
||||||
"/tmp/forgejo-backup.sql"
|
"/tmp/forgejo-backup.sql"
|
||||||
];
|
];
|
||||||
|
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";
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d gitea > /tmp/forgejo-backup.sql
|
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d gitea > /tmp/forgejo-backup.sql
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -47,10 +47,18 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.restic.backups.keycloak = flake.self.lib.droppieBackup {
|
services.restic.backups.keycloak = {
|
||||||
paths = [
|
paths = [
|
||||||
"/tmp/keycloak-backup.sql"
|
"/tmp/keycloak-backup.sql"
|
||||||
];
|
];
|
||||||
|
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";
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d keycloak > /tmp/keycloak-backup.sql
|
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d keycloak > /tmp/keycloak-backup.sql
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -80,11 +80,19 @@
|
||||||
# ])
|
# ])
|
||||||
#'';
|
#'';
|
||||||
|
|
||||||
services.restic.backups.mailman = flake.self.lib.droppieBackup {
|
services.restic.backups.mailman = {
|
||||||
paths = [
|
paths = [
|
||||||
"/var/lib/mailman"
|
"/var/lib/mailman"
|
||||||
"/var/lib/mailman-web/mailman-web.db"
|
"/var/lib/mailman-web/mailman-web.db"
|
||||||
"/var/lib/postfix/conf/aliases.db"
|
"/var/lib/postfix/conf/aliases.db"
|
||||||
];
|
];
|
||||||
|
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";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
|
{ config, pkgs, flake, inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
flake,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
age.secrets."mastodon-secret-key-base" = {
|
age.secrets."mastodon-secret-key-base" = {
|
||||||
file = "${flake.self}/secrets/mastodon-secret-key-base.age";
|
file = "${flake.self}/secrets/mastodon-secret-key-base.age";
|
||||||
mode = "400";
|
mode = "400";
|
||||||
|
@ -98,12 +94,20 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.restic.backups.mastodon = flake.self.lib.droppieBackup {
|
services.restic.backups.mastodon = {
|
||||||
paths = [
|
paths = [
|
||||||
"/tmp/mastodon-backup.sql"
|
"/tmp/mastodon-backup.sql"
|
||||||
];
|
];
|
||||||
|
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";
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d gitea > /tmp/mastodon-backup.sql
|
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d mastodon > /tmp/mastodon-backup.sql
|
||||||
'';
|
'';
|
||||||
backupCleanupCommand = ''
|
backupCleanupCommand = ''
|
||||||
rm /tmp/mastodon-backup.sql
|
rm /tmp/mastodon-backup.sql
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
pkgs,
|
pkgs,
|
||||||
flake,
|
flake,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
|
{
|
||||||
age.secrets."nextcloud-secrets" = {
|
age.secrets."nextcloud-secrets" = {
|
||||||
file = "${flake.self}/secrets/nextcloud-secrets.age";
|
file = "${flake.self}/secrets/nextcloud-secrets.age";
|
||||||
mode = "400";
|
mode = "400";
|
||||||
|
@ -130,11 +131,19 @@
|
||||||
database.createLocally = true;
|
database.createLocally = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
services.restic.backups.nextcloud = flake.self.lib.droppieBackup {
|
services.restic.backups.nextcloud = {
|
||||||
paths = [
|
paths = [
|
||||||
"/var/lib/nextcloud/data"
|
"/var/lib/nextcloud/data"
|
||||||
"/tmp/nextcloud-backup.sql"
|
"/tmp/nextcloud-backup.sql"
|
||||||
];
|
];
|
||||||
|
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";
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d nextcloud > /tmp/nextcloud-backup.sql
|
${pkgs.sudo}/bin/sudo -iu postgres ${pkgs.postgresql}/bin/pg_dump -d nextcloud > /tmp/nextcloud-backup.sql
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{ self, lib, inputs, ... }: {
|
{ self, lib, inputs, ... }: {
|
||||||
# Configuration common to all Linux systems
|
# Configuration common to all Linux systems
|
||||||
flake = {
|
flake = {
|
||||||
pub-solar.lib = let
|
lib = let
|
||||||
callLibs = file: import file {inherit lib;};
|
callLibs = file: import file {inherit lib;};
|
||||||
in rec {
|
in rec {
|
||||||
## Define your own library functions here!
|
## Define your own library functions here!
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
{ 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
|
|
Loading…
Reference in a new issue