2024-03-31 22:04:51 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
vars = import ../../vars.nix;
|
|
|
|
arionPath = "/home/${vars.user}/.setup/hosts/franz/arion";
|
2024-04-03 11:25:20 +02:00
|
|
|
cfg = config.virtualisation.arion;
|
2024-03-31 22:04:51 +02:00
|
|
|
in {
|
2024-04-03 11:25:20 +02:00
|
|
|
# systemd.timers."restic-cron" = {
|
|
|
|
# wantedBy = ["timers.target"];
|
|
|
|
# timerConfig = {
|
|
|
|
# OnBootSec = "1m";
|
|
|
|
# OnUnitActiveSec = "1m";
|
|
|
|
# Unit = "restic-cron.service";
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
#
|
|
|
|
# systemd.services."restic-cron" = {
|
|
|
|
# path = [
|
|
|
|
# cfg.docker.client.package
|
|
|
|
# cfg.package
|
|
|
|
# pkgs.nix
|
|
|
|
# pkgs.restic
|
|
|
|
# pkgs.autorestic
|
|
|
|
# ];
|
|
|
|
# script = ''
|
|
|
|
# source /etc/profile
|
|
|
|
# autorestic -c /home/ghoscht/.autorestic.yml --verbose cron >> /tmp/autorestic.log 2>&1
|
|
|
|
# '';
|
|
|
|
# serviceConfig = {
|
|
|
|
# Type = "oneshot";
|
|
|
|
# User = "root";
|
|
|
|
# };
|
|
|
|
# };
|
2024-03-31 22:04:51 +02:00
|
|
|
|
2024-04-03 11:25:20 +02:00
|
|
|
services.cron = {
|
|
|
|
enable = true;
|
|
|
|
systemCronJobs = [
|
2024-07-05 15:42:02 +02:00
|
|
|
"*/5 * * * * root . /etc/profile; autorestic -c /home/ghoscht/.autorestic.yml --ci cron > /var/log/autorestic-bin.log"
|
2024-04-03 11:25:20 +02:00
|
|
|
];
|
2024-03-31 22:04:51 +02:00
|
|
|
};
|
2024-04-03 11:25:20 +02:00
|
|
|
|
2024-03-31 22:04:51 +02:00
|
|
|
environment.systemPackages = with pkgs; [autorestic restic];
|
|
|
|
|
|
|
|
sops.secrets."autorestic/zfs_key" = {
|
|
|
|
owner = vars.user;
|
|
|
|
};
|
|
|
|
sops.secrets."autorestic/ssd_key" = {
|
|
|
|
owner = vars.user;
|
|
|
|
};
|
2024-04-13 16:12:08 +02:00
|
|
|
sops.secrets."autorestic/eustachius_key" = {
|
|
|
|
owner = vars.user;
|
|
|
|
};
|
2024-06-14 20:17:21 +02:00
|
|
|
sops.secrets."autorestic/ntfy_access_token" = {
|
|
|
|
owner = vars.user;
|
|
|
|
};
|
2024-03-31 22:04:51 +02:00
|
|
|
|
|
|
|
sops.templates.".autorestic.yml" = {
|
|
|
|
path = "/home/${vars.user}/.autorestic.yml";
|
|
|
|
owner = vars.user;
|
|
|
|
mode = "0775";
|
|
|
|
content = ''
|
|
|
|
version: 2
|
|
|
|
global:
|
|
|
|
forget:
|
|
|
|
keep-weekly: 7
|
|
|
|
keep-monthly: 12
|
2024-06-14 20:17:21 +02:00
|
|
|
|
|
|
|
extras:
|
|
|
|
default_hooks: &default_hooks
|
|
|
|
success:
|
2024-07-05 15:42:02 +02:00
|
|
|
- echo "Backup of $AUTORESTIC_LOCATION successful! Added $AUTORESTIC_FILES_ADDED_0 files and changed $AUTORESTIC_FILES_CHANGED_0 files with a total size of $AUTORESTIC_ADDED_SIZE_0. Processed $AUTORESTIC_PROCESSED_FILES_0 files with total size $AUTORESTIC_PROCESSED_SIZE_0 in $AUTORESTIC_PROCESSED_DURATION_0. Snapshot $AUTORESTIC_SNAPSHOT_ID_0" >> /var/log/autorestic-backup.log
|
2024-06-14 20:17:21 +02:00
|
|
|
failure:
|
2024-07-05 15:42:02 +02:00
|
|
|
- echo "Backup of $AUTORESTIC_LOCATION failed" >> /var/log/autorestic.log
|
2024-06-14 20:17:21 +02:00
|
|
|
- 'curl -H "Authorization: Bearer ${config.sops.placeholder."autorestic/ntfy_access_token"}" -H "X-Tags: warning" -H "X-Title: Backup Failure" -d "Backup of location $AUTORESTIC_LOCATION failed" https://push.ghoscht.com/autorestic'
|
|
|
|
|
2024-03-31 22:04:51 +02:00
|
|
|
locations:
|
|
|
|
dashboard:
|
|
|
|
from: /storage/dataset/docker/dashboard
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-08-09 15:16:10 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * 0' # Every Sunday at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
dns:
|
|
|
|
from: /storage/dataset/docker/dns
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-06-13 23:31:39 +02:00
|
|
|
- ssd
|
2024-07-05 15:42:02 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * 0' # Every Sunday at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
feed:
|
|
|
|
from: /storage/dataset/docker/feed
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-08-09 15:16:10 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * 0' # Every Sunday at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
git:
|
|
|
|
from: /storage/dataset/docker/git
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
2024-07-05 15:42:02 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * *' # Every Day at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
media:
|
|
|
|
from: /storage/dataset/docker/media
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-06-13 23:31:39 +02:00
|
|
|
- ssd
|
2024-08-09 15:16:10 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * *' # Every Day at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
nextcloud:
|
|
|
|
from: /storage/dataset/docker/nextcloud
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-06-13 23:31:39 +02:00
|
|
|
- ssd
|
2024-08-09 15:16:10 +02:00
|
|
|
- eustachius
|
2024-08-16 12:29:41 +02:00
|
|
|
cron: '0 4 * * *' # Every Day at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
smarthome:
|
|
|
|
from: /storage/dataset/docker/smarthome
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-08-09 15:16:10 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * 0' # Every Sunday at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix start
|
2024-03-31 22:04:51 +02:00
|
|
|
passwords:
|
|
|
|
from: /storage/dataset/docker/passwords
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
2024-07-05 15:42:02 +02:00
|
|
|
- eustachius
|
2024-04-20 20:15:29 +02:00
|
|
|
cron: '0 4 * * *' # Every Day at 4:00
|
2024-03-31 22:04:51 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
before:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix stop
|
2024-03-31 22:04:51 +02:00
|
|
|
after:
|
2024-04-03 11:25:20 +02:00
|
|
|
- arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix start
|
2024-04-20 20:12:58 +02:00
|
|
|
matrix:
|
|
|
|
from: /storage/dataset/docker/matrix
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-08-09 15:16:10 +02:00
|
|
|
- eustachius
|
2024-04-20 20:12:58 +02:00
|
|
|
cron: '0 4 * * 0' # Every Sunday at 4:00
|
2024-05-01 17:50:16 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-05-01 17:50:16 +02:00
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/matrix/arion-compose.nix -p ${arionPath}/matrix/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/matrix/arion-compose.nix -p ${arionPath}/matrix/arion-pkgs.nix start
|
2024-07-05 15:42:02 +02:00
|
|
|
music:
|
|
|
|
from: /storage/dataset/data/media/music
|
|
|
|
to:
|
|
|
|
- eustachius
|
|
|
|
cron: '0 4 * * 0' # Every Sunday at 4:00
|
|
|
|
hooks:
|
|
|
|
<<: *default_hooks
|
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix start
|
2024-05-01 17:50:16 +02:00
|
|
|
headscale:
|
|
|
|
from: /storage/dataset/docker/headscale
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-05-01 17:50:16 +02:00
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/headscale/arion-compose.nix -p ${arionPath}/headscale/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/headscale/arion-compose.nix -p ${arionPath}/headscale/arion-pkgs.nix start
|
2024-05-03 12:19:03 +02:00
|
|
|
auth:
|
|
|
|
from: /storage/dataset/docker/auth
|
|
|
|
to:
|
|
|
|
- zfs
|
2024-06-13 23:31:39 +02:00
|
|
|
- ssd
|
2024-07-05 15:42:02 +02:00
|
|
|
- eustachius
|
2024-05-06 19:48:38 +02:00
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
2024-05-03 12:19:03 +02:00
|
|
|
hooks:
|
2024-06-14 20:17:21 +02:00
|
|
|
<<: *default_hooks
|
2024-05-03 12:19:03 +02:00
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/auth/arion-compose.nix -p ${arionPath}/auth/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/auth/arion-compose.nix -p ${arionPath}/auth/arion-pkgs.nix start
|
2024-08-18 14:47:05 +02:00
|
|
|
infrastructure:
|
|
|
|
from: /storage/dataset/docker/infrastructure
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
- eustachius
|
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
|
|
|
hooks:
|
|
|
|
<<: *default_hooks
|
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/infrastructure/arion-compose.nix -p ${arionPath}/infrastructure/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/infrastructure/arion-compose.nix -p ${arionPath}/infrastructure/arion-pkgs.nix start
|
|
|
|
wiki:
|
|
|
|
from: /storage/dataset/docker/wiki
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
- eustachius
|
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
|
|
|
hooks:
|
|
|
|
<<: *default_hooks
|
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/wiki/arion-compose.nix -p ${arionPath}/wiki/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/wiki/arion-compose.nix -p ${arionPath}/wiki/arion-pkgs.nix start
|
|
|
|
stats:
|
|
|
|
from: /storage/dataset/docker/stats
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
- eustachius
|
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
|
|
|
hooks:
|
|
|
|
<<: *default_hooks
|
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/stats/arion-compose.nix -p ${arionPath}/stats/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/stats/arion-compose.nix -p ${arionPath}/stats/arion-pkgs.nix start
|
|
|
|
minio:
|
|
|
|
from: /storage/dataset/docker/stats
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
- eustachius
|
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
|
|
|
options:
|
|
|
|
backup:
|
|
|
|
exclude:
|
|
|
|
- '*.pmtiles'
|
|
|
|
hooks:
|
|
|
|
<<: *default_hooks
|
|
|
|
before:
|
|
|
|
- arion -f ${arionPath}/minio/arion-compose.nix -p ${arionPath}/minio/arion-pkgs.nix stop
|
|
|
|
after:
|
|
|
|
- arion -f ${arionPath}/minio/arion-compose.nix -p ${arionPath}/minio/arion-pkgs.nix start
|
2024-08-28 15:05:15 +02:00
|
|
|
nas:
|
|
|
|
from: /storage/dataset/nas
|
|
|
|
to:
|
|
|
|
- zfs
|
|
|
|
- ssd
|
|
|
|
- eustachius
|
|
|
|
cron: '55 3 * * *' # Every Day at 3:55
|
|
|
|
hooks:
|
|
|
|
<<: *default_hooks
|
2024-03-31 22:04:51 +02:00
|
|
|
backends:
|
|
|
|
zfs:
|
|
|
|
type: local
|
|
|
|
path: /storage/dataset/backups
|
|
|
|
key: '${config.sops.placeholder."autorestic/zfs_key"}'
|
|
|
|
ssd:
|
|
|
|
type: local
|
|
|
|
path: /home/ghoscht/Backups
|
|
|
|
key: '${config.sops.placeholder."autorestic/ssd_key"}'
|
2024-07-05 15:42:02 +02:00
|
|
|
eustachius:
|
|
|
|
type: rest
|
|
|
|
path: http://100.64.0.3:8000/franz
|
|
|
|
key: '${config.sops.placeholder."autorestic/eustachius_key"}'
|
2024-03-31 22:04:51 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|