mirror of
https://github.com/TheWanderingCrow/CrOS.git
synced 2026-01-11 17:54:08 -05:00
refactor overseer backup solution
This commit is contained in:
parent
3cfa86c8b8
commit
11ba348a58
7 changed files with 34 additions and 103 deletions
33
modules/users/overseer/backups.nix
Normal file
33
modules/users/overseer/backups.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
let
|
||||
volumePath = "/overseer/services";
|
||||
in
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
lib.mkIf config.user.overseer.enable {
|
||||
services.restic.backups.borg-base = {
|
||||
user = "root";
|
||||
timerConfig = {
|
||||
OnCalendar = "hourly";
|
||||
Persistent = true;
|
||||
};
|
||||
paths = [
|
||||
# bar-assistant.nix
|
||||
"${volumePath}/bar-assistant"
|
||||
"${volumePath}/meilisearch"
|
||||
|
||||
# homebox.nix
|
||||
"/var/lib/homebox/data"
|
||||
|
||||
# lubelogger.nix
|
||||
"${volumePath}/lubelogger"
|
||||
|
||||
# trilium.nix
|
||||
"/var/lib/trilium/backup"
|
||||
];
|
||||
repositoryFile = config.sops.secrets."restic/url".path;
|
||||
passwordFile = config.sops.secrets."restic/key".path;
|
||||
};
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
./setup.nix
|
||||
./secrets.nix
|
||||
./acme.nix
|
||||
./backups.nix
|
||||
./services
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,23 +63,6 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
##########
|
||||
# Backup #
|
||||
##########
|
||||
services.restic.backups.bar-assistant = {
|
||||
user = "root";
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
paths = [
|
||||
"${volumePath}/bar-assistant"
|
||||
"${volumePath}/meilisearch"
|
||||
];
|
||||
repositoryFile = config.sops.secrets."restic/url".path;
|
||||
passwordFile = config.sops.secrets."restic/key".path;
|
||||
};
|
||||
|
||||
###########
|
||||
# Service #
|
||||
###########
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
let
|
||||
volumePath = "/overseer/services";
|
||||
in
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
lib.mkIf config.user.overseer.enable {
|
||||
sops.secrets."bookstack/key" = {
|
||||
owner = "bookstack";
|
||||
};
|
||||
|
||||
services.restic.backups.bookstack = {
|
||||
user = "root";
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
backupPrepareCommand = "${pkgs.mariadb}/bin/mysqldump -u root bookstack > ${volumePath}/tmp/bookstack.sql";
|
||||
backupCleanupCommand = "rm ${volumePath}/tmp/bookstack.sql";
|
||||
paths = [
|
||||
"/var/lib/bookstack"
|
||||
"${volumePath}/tmp/bookstack.sql"
|
||||
];
|
||||
repositoryFile = config.sops.secrets."restic/url".path;
|
||||
passwordFile = config.sops.secrets."restic/key".path;
|
||||
};
|
||||
|
||||
services.bookstack = {
|
||||
enable = true;
|
||||
hostname = "bookstack.wanderingcrow.net";
|
||||
database.createLocally = true;
|
||||
appKeyFile = config.sops.secrets."bookstack/key".path;
|
||||
nginx = {
|
||||
forceSSL = true;
|
||||
extraConfig = ''
|
||||
allow 192.168.0.0/16;
|
||||
allow 10.8.0.0/24;
|
||||
allow 24.179.20.202;
|
||||
deny all;
|
||||
'';
|
||||
useACMEHost = "bookstack.wanderingcrow.net";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -5,19 +5,6 @@
|
|||
}:
|
||||
lib.mkIf config.user.overseer.enable {
|
||||
services = {
|
||||
restic.backups.homebox = {
|
||||
user = "root";
|
||||
timerConfig = {
|
||||
OnCalendar = "hourly";
|
||||
Persistent = true;
|
||||
};
|
||||
paths = [
|
||||
"/var/lib/homebox/data"
|
||||
];
|
||||
repositoryFile = config.sops.secrets."restic/url".path;
|
||||
passwordFile = config.sops.secrets."restic/key".path;
|
||||
};
|
||||
|
||||
nginx = {
|
||||
enable = true;
|
||||
recommendedProxySettings = true;
|
||||
|
|
|
|||
|
|
@ -16,19 +16,6 @@ in
|
|||
# Service #
|
||||
###########
|
||||
|
||||
services.restic.backups.bar-assistant = {
|
||||
user = "root";
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
paths = [
|
||||
"${volumePath}/lubelogger"
|
||||
];
|
||||
repositoryFile = config.sops.secrets."restic/url".path;
|
||||
passwordFile = config.sops.secrets."restic/key".path;
|
||||
};
|
||||
|
||||
sops = {
|
||||
secrets = {
|
||||
"lubelogger/user_hash" = {};
|
||||
|
|
|
|||
|
|
@ -6,19 +6,6 @@
|
|||
}:
|
||||
lib.mkIf config.user.overseer.enable {
|
||||
services = {
|
||||
restic.backups.notes = {
|
||||
user = "root";
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
};
|
||||
paths = [
|
||||
"/var/lib/trilium/backup"
|
||||
];
|
||||
repositoryFile = config.sops.secrets."restic/url".path;
|
||||
passwordFile = config.sops.secrets."restic/key".path;
|
||||
};
|
||||
|
||||
trilium-server = {
|
||||
enable = true;
|
||||
package = pkgs.trilium-next-server;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue