diff --git a/docker_swarm/roles/media/docker-stack.yml.j2 b/docker_swarm/roles/media/docker-stack.yml.j2 index ab9fe50..76a1ded 100644 --- a/docker_swarm/roles/media/docker-stack.yml.j2 +++ b/docker_swarm/roles/media/docker-stack.yml.j2 @@ -49,36 +49,6 @@ volumes: jellyfin_cache: services: - radarr: - image: lscr.io/linuxserver/radarr:latest - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Amsterdam - volumes: - - type: volume - source: radarr_config - target: /config - volume: - nocopy: true - - type: volume - source: media - target: /media - volume: - nocopy: true - networks: - - traefik - deploy: - labels: - - traefik.enable=true - - traefik.http.routers.radarr.entrypoints=localsecure - - traefik.http.routers.radarr.rule=Host(`radarr.kun.is`) - - traefik.http.routers.radarr.tls=true - - traefik.http.routers.radarr.tls.certresolver=letsencrypt - - traefik.http.routers.radarr.service=radarr - - traefik.http.services.radarr.loadbalancer.server.port=7878 - - traefik.docker.network=traefik - prowlarr: image: lscr.io/linuxserver/prowlarr:latest environment: diff --git a/docker_swarm/roles/traefik/docker-stack.yml.j2 b/docker_swarm/roles/traefik/docker-stack.yml.j2 index 8963dc1..fc9e32a 100644 --- a/docker_swarm/roles/traefik/docker-stack.yml.j2 +++ b/docker_swarm/roles/traefik/docker-stack.yml.j2 @@ -138,6 +138,12 @@ services: - traefik.http.routers.jellyseerr.rule=Host(`jellyseerr.kun.is`) - traefik.http.routers.jellyseerr.tls=true - traefik.http.routers.jellyseerr.tls.certresolver=letsencrypt + + - traefik.http.routers.radarr.entrypoints=localsecure + - traefik.http.routers.radarr.service=k3s@file + - traefik.http.routers.radarr.rule=Host(`radarr.kun.is`) + - traefik.http.routers.radarr.tls=true + - traefik.http.routers.radarr.tls.certresolver=letsencrypt volumes: - type: bind source: /var/run/docker.sock diff --git a/nix/flake/kubenix/media.nix b/nix/flake/kubenix/media.nix index 509364d..53a409f 100644 --- a/nix/flake/kubenix/media.nix +++ b/nix/flake/kubenix/media.nix @@ -12,6 +12,12 @@ LOG_LEVEL = "debug"; TZ = "Europe/Amsterdam"; }; + + radarr-env.data = { + PUID = "1000"; + PGID = "1000"; + TZ = "Europe/Amsterdam"; + }; }; deployments = { @@ -175,6 +181,61 @@ }; }; }; + + radarr = { + metadata.labels = { + app = "media"; + component = "radarr"; + }; + + spec = { + selector.matchLabels = { + app = "media"; + component = "radarr"; + }; + + template = { + metadata.labels = { + app = "media"; + component = "radarr"; + }; + + spec = { + containers.radarr = { + image = "lscr.io/linuxserver/radarr:latest"; + envFrom = [{ configMapRef.name = "radarr-env"; }]; + + ports = [{ + containerPort = 7878; + protocol = "TCP"; + }]; + + volumeMounts = [ + { + name = "config"; + mountPath = "/config"; + } + { + name = "media"; + mountPath = "/media"; + } + ]; + }; + + volumes = [ + { + name = "config"; + persistentVolumeClaim.claimName = "radarr-config"; + } + { + name = "media"; + persistentVolumeClaim.claimName = "media"; + } + ]; + }; + }; + }; + }; }; persistentVolumes = { @@ -217,6 +278,16 @@ path = "/mnt/data/nfs/jellyseerr/config"; }; }; + + radarr-config.spec = { + capacity.storage = "1Mi"; + accessModes = [ "ReadWriteMany" ]; + + nfs = { + server = "lewis.hyp"; + path = "/mnt/data/nfs/radarr/config"; + }; + }; }; persistentVolumeClaims = { @@ -247,6 +318,13 @@ resources.requests.storage = "1Mi"; volumeName = "jellyseerr-config"; }; + + radarr-config.spec = { + accessModes = [ "ReadWriteMany" ]; + storageClassName = ""; + resources.requests.storage = "1Mi"; + volumeName = "radarr-config"; + }; }; services = { @@ -304,6 +382,19 @@ targetPort = 5055; }]; }; + + radarr.spec = { + selector = { + app = "media"; + component = "radarr"; + }; + + ports = [{ + protocol = "TCP"; + port = 80; + targetPort = 7878; + }]; + }; }; ingresses = { @@ -360,6 +451,24 @@ }]; }]; }; + + radarr.spec = { + ingressClassName = "traefik"; + + rules = [{ + host = "radarr.kun.is"; + + http.paths = [{ + path = "/"; + pathType = "Prefix"; + + backend.service = { + name = "radarr"; + port.number = 80; + }; + }]; + }]; + }; }; }; }