From d46e187abf8a26c5104d4cbbd3dc41ed6cd1c8d8 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Sat, 6 Apr 2024 17:10:34 +0200 Subject: [PATCH] migrate jellyseerr to kubernetes --- docker_swarm/roles/media/docker-stack.yml.j2 | 25 ----- .../roles/traefik/docker-stack.yml.j2 | 6 ++ nix/flake/kubenix/media.nix | 96 +++++++++++++++++++ 3 files changed, 102 insertions(+), 25 deletions(-) diff --git a/docker_swarm/roles/media/docker-stack.yml.j2 b/docker_swarm/roles/media/docker-stack.yml.j2 index c0b5205..ab9fe50 100644 --- a/docker_swarm/roles/media/docker-stack.yml.j2 +++ b/docker_swarm/roles/media/docker-stack.yml.j2 @@ -49,31 +49,6 @@ volumes: jellyfin_cache: services: - jellyseerr: - image: fallenbagel/jellyseerr:1.7.0 - environment: - # TODO: fix log level - - LOG_LEVEL=debug - - TZ=Europe/Amsterdam - volumes: - - type: volume - source: jellyseerr_config - target: /app/config - volume: - nocopy: true - networks: - - traefik - deploy: - labels: - - traefik.enable=true - - traefik.http.routers.jellyseerr.entrypoints=localsecure - - 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.jellyseerr.service=jellyseerr - - traefik.http.services.jellyseerr.loadbalancer.server.port=5055 - - traefik.docker.network=traefik - radarr: image: lscr.io/linuxserver/radarr:latest environment: diff --git a/docker_swarm/roles/traefik/docker-stack.yml.j2 b/docker_swarm/roles/traefik/docker-stack.yml.j2 index ff9c4c3..8963dc1 100644 --- a/docker_swarm/roles/traefik/docker-stack.yml.j2 +++ b/docker_swarm/roles/traefik/docker-stack.yml.j2 @@ -132,6 +132,12 @@ services: - traefik.http.routers.transmission.rule=Host(`transmission.kun.is`) - traefik.http.routers.transmission.tls=true - traefik.http.routers.transmission.tls.certresolver=letsencrypt + + - traefik.http.routers.jellyseerr.entrypoints=localsecure + - traefik.http.routers.jellyseerr.service=k3s@file + - traefik.http.routers.jellyseerr.rule=Host(`jellyseerr.kun.is`) + - traefik.http.routers.jellyseerr.tls=true + - traefik.http.routers.jellyseerr.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 13d2e4a..509364d 100644 --- a/nix/flake/kubenix/media.nix +++ b/nix/flake/kubenix/media.nix @@ -7,6 +7,11 @@ PGID = "1000"; TZ = "Europe/Amsterdam"; }; + + jellyseerr-env.data = { + LOG_LEVEL = "debug"; + TZ = "Europe/Amsterdam"; + }; }; deployments = { @@ -127,6 +132,49 @@ }; }; }; + + jellyseerr = { + metadata.labels = { + app = "media"; + component = "jellyseerr"; + }; + + spec = { + selector.matchLabels = { + app = "media"; + component = "jellyseerr"; + }; + + template = { + metadata.labels = { + app = "media"; + component = "jellyseerr"; + }; + + spec = { + containers.jellyseerr = { + image = "fallenbagel/jellyseerr:1.7.0"; + envFrom = [{ configMapRef.name = "jellyseerr-env"; }]; + + ports = [{ + containerPort = 5055; + protocol = "TCP"; + }]; + + volumeMounts = [{ + name = "config"; + mountPath = "/app/config"; + }]; + }; + + volumes = [{ + name = "config"; + persistentVolumeClaim.claimName = "jellyseerr-config"; + }]; + }; + }; + }; + }; }; persistentVolumes = { @@ -159,6 +207,16 @@ path = "/mnt/data/nfs/transmission/config"; }; }; + + jellyseerr-config.spec = { + capacity.storage = "1Mi"; + accessModes = [ "ReadWriteMany" ]; + + nfs = { + server = "lewis.hyp"; + path = "/mnt/data/nfs/jellyseerr/config"; + }; + }; }; persistentVolumeClaims = { @@ -182,6 +240,13 @@ resources.requests.storage = "1Mi"; volumeName = "transmission-config"; }; + + jellyseerr-config.spec = { + accessModes = [ "ReadWriteMany" ]; + storageClassName = ""; + resources.requests.storage = "1Mi"; + volumeName = "jellyseerr-config"; + }; }; services = { @@ -226,6 +291,19 @@ targetPort = 31780; }]; }; + + jellyseerr.spec = { + selector = { + app = "media"; + component = "jellyseerr"; + }; + + ports = [{ + protocol = "TCP"; + port = 80; + targetPort = 5055; + }]; + }; }; ingresses = { @@ -264,6 +342,24 @@ }]; }]; }; + + jellyseerr.spec = { + ingressClassName = "traefik"; + + rules = [{ + host = "jellyseerr.kun.is"; + + http.paths = [{ + path = "/"; + pathType = "Prefix"; + + backend.service = { + name = "jellyseerr"; + port.number = 80; + }; + }]; + }]; + }; }; }; }