Compare commits

...

2 commits

Author SHA1 Message Date
d632864cfc
Switch to linuxserver jellyfin image 2024-04-03 11:25:52 +02:00
65aa06c5f5
Fix automatic restic backup 2024-04-03 11:25:20 +02:00
2 changed files with 84 additions and 45 deletions

View file

@ -6,13 +6,42 @@
external = true; external = true;
}; };
docker-compose.volumes = {
jellyfin_cache = null;
};
services = { services = {
# jellyfin-old.service = {
# image = "jellyfin/jellyfin:2024032802";
# container_name = "jellyfin-old";
# ports = [
# "8097:8096"
# ];
# labels = {
# "traefik.enable" = "true";
# "traefik.http.routers.jellyfin.entrypoints" = "websecure";
# "traefik.http.routers.jellyfin.rule" = "Host(`jellyfin.ghoscht.com`)";
# "traefik.http.services.jellyfin.loadbalancer.server.port" = "8096";
# "traefik.http.services.jellyfin.loadbalancer.passHostHeader" = "true";
# "traefik.http.routers.jellyfin.tls" = "true";
# "traefik.http.routers.jellyfin.tls.certresolver" = "letsencrypt";
# };
# volumes = [
# # "jellyfin_cache:/cache"
# "/storage/dataset/docker/media/jellyfin_data:/config"
# "/storage/dataset/data/media/tv:/tv"
# "/storage/dataset/data/media/anime:/anime"
# "/storage/dataset/data/media/movies:/movies"
# ];
# environment = {
# PUID = 1000;
# PGID = 1000;
# TZ = "Europe/Berlin";
# };
# dns = ["1.1.1.1"];
# restart = "always";
# networks = [
# "dmz"
# ];
# };
jellyfin.service = { jellyfin.service = {
image = "jellyfin/jellyfin:2024032802"; image = "linuxserver/jellyfin:10.8.13";
container_name = "jellyfin"; container_name = "jellyfin";
ports = [ ports = [
"8096:8096" "8096:8096"
@ -27,7 +56,6 @@
"traefik.http.routers.jellyfin.tls.certresolver" = "letsencrypt"; "traefik.http.routers.jellyfin.tls.certresolver" = "letsencrypt";
}; };
volumes = [ volumes = [
"jellyfin_cache:/cache"
"/storage/dataset/docker/media/jellyfin_data:/config" "/storage/dataset/docker/media/jellyfin_data:/config"
"/storage/dataset/data/media/tv:/tv" "/storage/dataset/data/media/tv:/tv"
"/storage/dataset/data/media/anime:/anime" "/storage/dataset/data/media/anime:/anime"

View file

@ -5,26 +5,42 @@
}: let }: let
vars = import ../../vars.nix; vars = import ../../vars.nix;
arionPath = "/home/${vars.user}/.setup/hosts/franz/arion"; arionPath = "/home/${vars.user}/.setup/hosts/franz/arion";
cfg = config.virtualisation.arion;
in { in {
systemd.timers."restic-cron" = { # systemd.timers."restic-cron" = {
wantedBy = ["timers.target"]; # wantedBy = ["timers.target"];
timerConfig = { # timerConfig = {
OnBootSec = "5m"; # OnBootSec = "1m";
OnUnitActiveSec = "5m"; # OnUnitActiveSec = "1m";
Unit = "restic-cron.service"; # 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";
# };
# };
services.cron = {
enable = true;
systemCronJobs = [
"*/5 * * * * root . /etc/profile; autorestic -c /home/ghoscht/.autorestic.yml --ci cron"
];
}; };
systemd.services."restic-cron" = {
script = ''
set -eu
${pkgs.autorestic}/bin/autorestic -c /home/ghoscht/.autorestic.yml --restic-bin ${pkgs.restic}/bin/restic --ci cron > /tmp/autorestic.log 2>&1
'';
serviceConfig = {
Type = "oneshot";
User = "root";
};
};
environment.systemPackages = with pkgs; [autorestic restic]; environment.systemPackages = with pkgs; [autorestic restic];
sops.secrets."autorestic/zfs_key" = { sops.secrets."autorestic/zfs_key" = {
@ -49,35 +65,32 @@ in {
from: /storage/dataset/docker/dashboard from: /storage/dataset/docker/dashboard
to: to:
- zfs - zfs
- ssd
cron: '0 3 * * 0' # Every Sunday at 3:00 cron: '0 3 * * 0' # Every Sunday at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix stop - arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix start - arion -f ${arionPath}/dashboard/arion-compose.nix -p ${arionPath}/dashboard/arion-pkgs.nix start
dns: dns:
from: /storage/dataset/docker/dns from: /storage/dataset/docker/dns
to: to:
- zfs - zfs
- ssd
cron: '0 3 * * 0' # Every Sunday at 3:00 cron: '0 3 * * 0' # Every Sunday at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix stop - arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix start - arion -f ${arionPath}/dns/arion-compose.nix -p ${arionPath}/dns/arion-pkgs.nix start
feed: feed:
from: /storage/dataset/docker/feed from: /storage/dataset/docker/feed
to: to:
- zfs - zfs
- ssd
cron: '0 3 * * 0' # Every Sunday at 3:00 cron: '0 3 * * 0' # Every Sunday at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix stop - arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix start - arion -f ${arionPath}/feed/arion-compose.nix -p ${arionPath}/feed/arion-pkgs.nix start
git: git:
from: /storage/dataset/docker/git from: /storage/dataset/docker/git
to: to:
@ -86,20 +99,19 @@ in {
cron: '0 3 * * *' # Every Day at 3:00 cron: '0 3 * * *' # Every Day at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix stop - arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix start - arion -f ${arionPath}/git/arion-compose.nix -p ${arionPath}/git/arion-pkgs.nix start
media: media:
from: /storage/dataset/docker/media from: /storage/dataset/docker/media
to: to:
- zfs - zfs
- ssd cron: '0 3 * * *' # Every Day at 3:00
cron: '0 3 * * 0' # Every Sunday at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop - arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix start - arion -f ${arionPath}/media/arion-compose.nix -p ${arionPath}/media/arion-pkgs.nix start
nextcloud: nextcloud:
from: /storage/dataset/docker/nextcloud from: /storage/dataset/docker/nextcloud
to: to:
@ -108,20 +120,19 @@ in {
cron: '0 3 * * *' # Every Day at 3:00 cron: '0 3 * * *' # Every Day at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix stop - arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix start - arion -f ${arionPath}/nextcloud/arion-compose.nix -p ${arionPath}/nextcloud/arion-pkgs.nix start
smarthome: smarthome:
from: /storage/dataset/docker/smarthome from: /storage/dataset/docker/smarthome
to: to:
- zfs - zfs
- ssd
cron: '0 3 * * 0' # Every Sunday at 3:00 cron: '0 3 * * 0' # Every Sunday at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix stop - arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix start - arion -f ${arionPath}/smarthome/arion-compose.nix -p ${arionPath}/smarthome/arion-pkgs.nix start
passwords: passwords:
from: /storage/dataset/docker/passwords from: /storage/dataset/docker/passwords
to: to:
@ -130,9 +141,9 @@ in {
cron: '0 3 * * *' # Every Day at 3:00 cron: '0 3 * * *' # Every Day at 3:00
hooks: hooks:
before: before:
- sudo arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix stop - arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix stop
after: after:
- sudo arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix start - arion -f ${arionPath}/passwords/arion-compose.nix -p ${arionPath}/passwords/arion-pkgs.nix start
backends: backends:
zfs: zfs:
type: local type: local