heater and nextcloud backup improvments
This commit is contained in:
parent
cf61334f5e
commit
83253ed9f8
9 changed files with 98 additions and 18 deletions
|
@ -13,4 +13,20 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# mirror backup folder to /media
|
||||||
|
systemd.services.borg-mirror-to-media = {
|
||||||
|
enable = true;
|
||||||
|
script = ''
|
||||||
|
${pkgs.rsync}/bin/rsync -a \
|
||||||
|
/var/lib/borgbackup/ \
|
||||||
|
/media/borg-backup-mirror \
|
||||||
|
--delete-after
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
systemd.timers.borg-mirror-to-media = {
|
||||||
|
enable = true;
|
||||||
|
timerConfig.OnCalendar = "daily";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,12 @@
|
||||||
|
|
||||||
# no need to be encrypted
|
# no need to be encrypted
|
||||||
# -----------------------
|
# -----------------------
|
||||||
|
borg-mirror = {
|
||||||
|
enable = true;
|
||||||
|
path = "/media/syncthing/borg";
|
||||||
|
rescanInterval = 36 * 3600;
|
||||||
|
type = "receiveonly";
|
||||||
|
};
|
||||||
books = {
|
books = {
|
||||||
enable = true;
|
enable = true;
|
||||||
path = "/media/syncthing/books";
|
path = "/media/syncthing/books";
|
||||||
|
|
|
@ -11,4 +11,20 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# mirror backup folder to /media
|
||||||
|
systemd.services.borg-mirror-to-media = {
|
||||||
|
enable = true;
|
||||||
|
script = ''
|
||||||
|
${pkgs.rsync}/bin/rsync -a \
|
||||||
|
/var/lib/borgbackup/ \
|
||||||
|
/media/borg-backup-mirror \
|
||||||
|
--delete-after
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
systemd.timers.borg-mirror-to-media = {
|
||||||
|
enable = true;
|
||||||
|
timerConfig.OnCalendar = "daily";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,4 +261,35 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.borgbackup.jobs = {
|
||||||
|
"nextcloud-to-media" = {
|
||||||
|
repo = "/media/syncthing/borg/nextcloud";
|
||||||
|
# make sure syncthing is capable of reading the files
|
||||||
|
postHook = ''
|
||||||
|
chown syncthing:syncthing -R /media/syncthing/borg
|
||||||
|
'';
|
||||||
|
compression = "lz4";
|
||||||
|
paths = [
|
||||||
|
"/home/nextcloud/data/tina/files/Documents"
|
||||||
|
"/home/nextcloud/data/tina/files/Pictures"
|
||||||
|
"/home/nextcloud/data/tina/files/Joplin"
|
||||||
|
"/home/nextcloud/data/tina/files/SofortUpload"
|
||||||
|
"/home/nextcloud/data/palo/files/Joplin"
|
||||||
|
"/home/nextcloud/data/palo/files/InstantUpload"
|
||||||
|
];
|
||||||
|
doInit = true;
|
||||||
|
encryption = {
|
||||||
|
mode = "repokey-blake2";
|
||||||
|
passCommand = "cat ${toString <secrets/backup/repo>}";
|
||||||
|
};
|
||||||
|
startAt = "0/3:00:00";
|
||||||
|
prune.keep = {
|
||||||
|
within = "2d"; # Keep all backups in the last 10 days.
|
||||||
|
daily = 10; # Keep 10 additional end of day archives
|
||||||
|
weekly = 8; # Keep 8 additional end of week archives.
|
||||||
|
month = 8; # Keep 8 additional end of month archives.
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,12 @@
|
||||||
|
|
||||||
# on media hard drive (not encrypted)
|
# on media hard drive (not encrypted)
|
||||||
# -----------------------------------
|
# -----------------------------------
|
||||||
|
borg-mirror = {
|
||||||
|
enable = true;
|
||||||
|
path = "/media/syncthing/borg";
|
||||||
|
rescanInterval = 36 * 3600;
|
||||||
|
type = "sendonly";
|
||||||
|
};
|
||||||
video-material = {
|
video-material = {
|
||||||
enable = true;
|
enable = true;
|
||||||
path = "/home/syncthing/video-material";
|
path = "/home/syncthing/video-material";
|
||||||
|
|
|
@ -109,7 +109,7 @@ def update_scene(client):
|
||||||
watcher.update("office1", Position.DOWN)
|
watcher.update("office1", Position.DOWN)
|
||||||
watcher.update("office2", Position.DOWN)
|
watcher.update("office2", Position.DOWN)
|
||||||
watcher.update("bedroom", Position.DOWN)
|
watcher.update("bedroom", Position.DOWN)
|
||||||
elif scene in ["default", "up-bright", "up-dark" "outside"]:
|
elif scene in ["default", "up-bright", "up-dark", "outside"]:
|
||||||
watcher.update("office1", Position.UP)
|
watcher.update("office1", Position.UP)
|
||||||
watcher.update("office2", Position.UP)
|
watcher.update("office2", Position.UP)
|
||||||
watcher.update("bedroom", Position.UP)
|
watcher.update("bedroom", Position.UP)
|
||||||
|
@ -118,9 +118,9 @@ def update_scene(client):
|
||||||
watcher.update("office2", Position.HALF)
|
watcher.update("office2", Position.HALF)
|
||||||
watcher.update("bedroom", Position.HALF)
|
watcher.update("bedroom", Position.HALF)
|
||||||
else:
|
else:
|
||||||
watcher.update("office1", Position.DOWN)
|
watcher.update("office1", Position.UP)
|
||||||
watcher.update("office2", Position.DOWN)
|
watcher.update("office2", Position.UP)
|
||||||
watcher.update("bedroom", Position.DOWN)
|
watcher.update("bedroom", Position.UP)
|
||||||
|
|
||||||
watcher.publish(client)
|
watcher.publish(client)
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ from typing import Dict
|
||||||
class Heater:
|
class Heater:
|
||||||
def __init__(self, topic):
|
def __init__(self, topic):
|
||||||
self.not_initialized_yet = True
|
self.not_initialized_yet = True
|
||||||
self.wanted_temperature = 10
|
self.wanted_temperature = 14
|
||||||
self.actual_temperature = 10
|
self.actual_temperature = 14
|
||||||
self.topic = topic
|
self.topic = topic
|
||||||
|
|
||||||
def needs_publish(self):
|
def needs_publish(self):
|
||||||
|
@ -124,17 +124,17 @@ def parse_message(msg):
|
||||||
|
|
||||||
def update_scene(client):
|
def update_scene(client):
|
||||||
if scene in ["night", "outside"]:
|
if scene in ["night", "outside"]:
|
||||||
watcher.update("office1", 10)
|
watcher.update("office1", 14)
|
||||||
watcher.update("office2", 10)
|
watcher.update("office2", 14)
|
||||||
watcher.update("bedroom", 10)
|
watcher.update("bedroom", 14)
|
||||||
elif scene in ["default", "up-bright", "up-dark", "half", "down"]:
|
elif scene in ["default", "up-bright", "up-dark", "half", "down"]:
|
||||||
watcher.update("office1", 26)
|
watcher.update("office1", 28)
|
||||||
watcher.update("office2", 26)
|
watcher.update("office2", 28)
|
||||||
watcher.update("bedroom", 18)
|
watcher.update("bedroom", 20)
|
||||||
else:
|
else:
|
||||||
watcher.update("office1", 10)
|
watcher.update("office1", 14)
|
||||||
watcher.update("office2", 10)
|
watcher.update("office2", 14)
|
||||||
watcher.update("bedroom", 10)
|
watcher.update("bedroom", 14)
|
||||||
|
|
||||||
watcher.publish(client)
|
watcher.publish(client)
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,11 @@ with lib; {
|
||||||
|
|
||||||
# no need to be stored on encrypted drives
|
# no need to be stored on encrypted drives
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
|
borg-mirror = {
|
||||||
|
enable = lib.mkDefault false;
|
||||||
|
watch = false;
|
||||||
|
devices = [ "workhorse" "pepe" ];
|
||||||
|
};
|
||||||
books = {
|
books = {
|
||||||
enable = lib.mkDefault false;
|
enable = lib.mkDefault false;
|
||||||
id = "wwbvs-5lfbh";
|
id = "wwbvs-5lfbh";
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
let
|
let
|
||||||
|
|
||||||
retiolum = pkgs.fetchgit {
|
retiolum = pkgs.fetchgit {
|
||||||
url = "https://github.com/krebs/retiolum.git";
|
url = "https://github.com/krebs/retiolum";
|
||||||
rev = "9dd1b68e9634b5e99650b33974f55d4ce384cab7";
|
rev = "5b067937a10ea43f88f14cc6e0a5485c2ddcc826";
|
||||||
sha256 = "019qyrxfw0a6jqa3pmhx6ghzdjxdrnf97r6mvsv42rpxc17vvdaz";
|
sha256 = "0kczrr6dr5dmhx2kbanw46w6ig2v3w42rqhjanv87xhwkgw81l08";
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
Loading…
Reference in a new issue