mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 11:37:44 +00:00
Use a single Restic repository for a whole host
This commit is contained in:
parent
b3a23637f9
commit
1eb906e040
1 changed files with 34 additions and 40 deletions
|
@ -3,51 +3,45 @@
|
||||||
systemConfiguration {
|
systemConfiguration {
|
||||||
secrets.resticPassword.file = ./password.age;
|
secrets.resticPassword.file = ./password.age;
|
||||||
|
|
||||||
services.restic.backups = let
|
services.restic.backups.disk = {
|
||||||
defaultConfig = name: {
|
repository = "sftp:backup@disk:${config.networking.hostName}-backup";
|
||||||
repository = "sftp:backup@disk:${config.networking.hostName}-${name}";
|
passwordFile = config.secrets.resticPassword.path;
|
||||||
passwordFile = config.secrets.resticPassword.path;
|
initialize = true;
|
||||||
initialize = true;
|
|
||||||
|
|
||||||
pruneOpts = [
|
pruneOpts = [
|
||||||
"--keep-daily unlimited"
|
"--keep-daily unlimited"
|
||||||
"--keep-weekly unlimited"
|
"--keep-weekly unlimited"
|
||||||
"--keep-monthly 6"
|
"--keep-monthly 6"
|
||||||
"--keep-yearly 12"
|
"--keep-yearly 12"
|
||||||
];
|
];
|
||||||
|
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = "daily";
|
OnCalendar = "daily";
|
||||||
Persistent = true;
|
Persistent = true;
|
||||||
};
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
general = (defaultConfig "general") // {
|
|
||||||
paths = map (dir: "/var/lib/${dir}") [
|
|
||||||
"dkim"
|
|
||||||
"forgejo"
|
|
||||||
"gitea-runner"
|
|
||||||
"grafana"
|
|
||||||
"mail"
|
|
||||||
"matrix-sliding-sync"
|
|
||||||
"matrix-synapse"
|
|
||||||
"nextcloud"
|
|
||||||
"postfix"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
postgresql = (defaultConfig "postgresql") // {
|
paths = [
|
||||||
paths = [ "/tmp/postgresql-dump.sql.gz" ];
|
"/tmp/postgresql-dump.sql.gz"
|
||||||
|
] ++ map (dir: "/var/lib/${dir}") [
|
||||||
|
"dkim"
|
||||||
|
"forgejo"
|
||||||
|
"gitea-runner"
|
||||||
|
"grafana"
|
||||||
|
"mail"
|
||||||
|
"matrix-sliding-sync"
|
||||||
|
"matrix-synapse"
|
||||||
|
"nextcloud"
|
||||||
|
"postfix"
|
||||||
|
];
|
||||||
|
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
${config.services.postgresql.package}/bin/pg_dumpall --clean \
|
${config.services.postgresql.package}/bin/pg_dumpall --clean \
|
||||||
| ${lib.getExe pkgs.gzip} --rsyncable \
|
| ${lib.getExe pkgs.gzip} --rsyncable \
|
||||||
> /tmp/postgresql-dump.sql.gz
|
> /tmp/postgresql-dump.sql.gz
|
||||||
'';
|
'';
|
||||||
|
|
||||||
backupCleanupCommand = ''
|
backupCleanupCommand = ''
|
||||||
rm /tmp/postgresql-dump.sql.gz
|
rm /tmp/postgresql-dump.sql.gz
|
||||||
'';
|
'';
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue