mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-06 21:17:14 -06:00
feat: fixed conflicting tmpfiles rule
This commit is contained in:
parent
5d73a78115
commit
e9b5dd13f7
1 changed files with 35 additions and 18 deletions
|
|
@ -1,4 +1,9 @@
|
|||
{ flake, lib, ... }:
|
||||
{
|
||||
flake,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (flake.config.machines.devices)
|
||||
ceres
|
||||
|
|
@ -8,16 +13,15 @@ let
|
|||
;
|
||||
|
||||
service = instances.postgresql;
|
||||
backupPath = "${instances.syncthing.paths.path1}/${service.name}";
|
||||
# backupPath = "${instances.syncthing.paths.path1}/${service.name}";
|
||||
in
|
||||
{
|
||||
services = {
|
||||
postgresqlBackup = {
|
||||
enable = true;
|
||||
location = backupPath;
|
||||
# location = backupPath;
|
||||
# compression = "zstd";
|
||||
startAt = "*-*-* 22:00:00";
|
||||
# backupAll = true;
|
||||
startAt = "*-*-* 07:00:00";
|
||||
databases = [
|
||||
instances.mastodon.name
|
||||
instances.firefly-iii.name
|
||||
|
|
@ -53,20 +57,33 @@ in
|
|||
instances.syncthing.name
|
||||
];
|
||||
|
||||
systemd.services = {
|
||||
postgresqlBackup-firefly-iii = {
|
||||
serviceConfig = {
|
||||
Group = lib.mkForce instances.syncthing.name;
|
||||
};
|
||||
};
|
||||
postgresqlBackup-mastodon = {
|
||||
serviceConfig = {
|
||||
Group = lib.mkForce instances.syncthing.name;
|
||||
};
|
||||
systemd.services.sync-postgres-backups = {
|
||||
description = "Sync PostgreSQL backups to Syncthing";
|
||||
after = [
|
||||
"postgresqlBackup-firefly-iii.service"
|
||||
"postgresqlBackup-mastodon.service"
|
||||
];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = instances.syncthing.name;
|
||||
Group = instances.syncthing.name;
|
||||
};
|
||||
script = ''
|
||||
${pkgs.rsync}/bin/rsync -av --delete \
|
||||
/var/backup/postgresql/ \
|
||||
${instances.syncthing.paths.path1}/${service.name}/
|
||||
|
||||
${pkgs.rsync}/bin/rsync -av --delete \
|
||||
/var/lib/${instances.firefly-iii.name}/storage/ \
|
||||
${instances.syncthing.paths.path1}/${service.name}/firefly-iii-storage/
|
||||
'';
|
||||
};
|
||||
|
||||
system.activationScripts.postgresCommands = ''
|
||||
chown -R ${service.name}:${service.name} ${service.paths.path0}
|
||||
'';
|
||||
systemd.timers.sync-postgres-backups = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "*-*-* 22:10:00"; # 10 mins after backup
|
||||
Persistent = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue