diff --git a/docker_swarm/playbooks/stacks.yml b/docker_swarm/playbooks/stacks.yml index 13f0fad..2c3f60f 100644 --- a/docker_swarm/playbooks/stacks.yml +++ b/docker_swarm/playbooks/stacks.yml @@ -4,4 +4,3 @@ roles: - {role: traefik, tags: traefik} - {role: swarm_dashboard, tags: swarm_dashboard} - - {role: media, tags: media} diff --git a/docker_swarm/roles/media/docker-stack.yml.j2 b/docker_swarm/roles/media/docker-stack.yml.j2 deleted file mode 100644 index 63eb7f2..0000000 --- a/docker_swarm/roles/media/docker-stack.yml.j2 +++ /dev/null @@ -1,80 +0,0 @@ -# vi: ft=yaml -version: '3.5' - -networks: - traefik: - external: true - -volumes: - media: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/media" - jellyfin_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/jellyfin/config" - transmission_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/transmission/config" - jellyseerr_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/jellyseerr/config" - radarr_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/radarr/config" - sonarr_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/sonarr/config" - prowlarr_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/prowlarr/config" - bazarr_config: - driver_opts: - type: "nfs" - o: "addr=lewis.dmz,nolock,soft,rw" - device: ":/mnt/data/nfs/bazarr/config" - jellyfin_cache: - -services: - bazarr: - image: lscr.io/linuxserver/bazarr:latest - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Amsterdam - volumes: - - type: volume - source: bazarr_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.bazarr.entrypoints=localsecure - - traefik.http.routers.bazarr.rule=Host(`bazarr.kun.is`) - - traefik.http.routers.bazarr.tls=true - - traefik.http.routers.bazarr.tls.certresolver=letsencrypt - - traefik.http.routers.bazarr.service=bazarr - - traefik.http.services.bazarr.loadbalancer.server.port=6767 - - traefik.docker.network=traefik diff --git a/docker_swarm/roles/media/tasks/main.yml b/docker_swarm/roles/media/tasks/main.yml deleted file mode 100644 index e95449b..0000000 --- a/docker_swarm/roles/media/tasks/main.yml +++ /dev/null @@ -1,5 +0,0 @@ -- name: Deploy Docker stack - docker_stack: - name: media - compose: - - "{{ lookup('template', '{{ role_path }}/docker-stack.yml.j2') | from_yaml }}" diff --git a/docker_swarm/roles/media/vars/main.yml b/docker_swarm/roles/media/vars/main.yml deleted file mode 100644 index 2d75cdc..0000000 --- a/docker_swarm/roles/media/vars/main.yml +++ /dev/null @@ -1 +0,0 @@ -bittorrent_port: 31780 diff --git a/docker_swarm/roles/traefik/docker-stack.yml.j2 b/docker_swarm/roles/traefik/docker-stack.yml.j2 index 75bc5b0..75c3e2f 100644 --- a/docker_swarm/roles/traefik/docker-stack.yml.j2 +++ b/docker_swarm/roles/traefik/docker-stack.yml.j2 @@ -156,6 +156,12 @@ services: - traefik.http.routers.sonarr.rule=Host(`sonarr.kun.is`) - traefik.http.routers.sonarr.tls=true - traefik.http.routers.sonarr.tls.certresolver=letsencrypt + + - traefik.http.routers.bazarr.entrypoints=localsecure + - traefik.http.routers.bazarr.service=k3s@file + - traefik.http.routers.bazarr.rule=Host(`bazarr.kun.is`) + - traefik.http.routers.bazarr.tls=true + - traefik.http.routers.bazarr.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 c8e2596..9c15d13 100644 --- a/nix/flake/kubenix/media.nix +++ b/nix/flake/kubenix/media.nix @@ -30,6 +30,12 @@ PGID = "1000"; TZ = "Europe/Amsterdam"; }; + + bazarr-env.data = { + PUID = "1000"; + PGID = "1000"; + TZ = "Europe/Amsterdam"; + }; }; deployments = { @@ -346,6 +352,61 @@ }; }; }; + + bazarr = { + metadata.labels = { + app = "media"; + component = "bazarr"; + }; + + spec = { + selector.matchLabels = { + app = "media"; + component = "bazarr"; + }; + + template = { + metadata.labels = { + app = "media"; + component = "bazarr"; + }; + + spec = { + containers.bazarr = { + image = "lscr.io/linuxserver/bazarr:latest"; + envFrom = [{ configMapRef.name = "bazarr-env"; }]; + + ports = [{ + containerPort = 6767; + protocol = "TCP"; + }]; + + volumeMounts = [ + { + name = "config"; + mountPath = "/config"; + } + { + name = "media"; + mountPath = "/media"; + } + ]; + }; + + volumes = [ + { + name = "config"; + persistentVolumeClaim.claimName = "bazarr-config"; + } + { + name = "media"; + persistentVolumeClaim.claimName = "media"; + } + ]; + }; + }; + }; + }; }; persistentVolumes = { @@ -418,6 +479,16 @@ path = "/mnt/data/nfs/sonarr/config"; }; }; + + bazarr-config.spec = { + capacity.storage = "1Mi"; + accessModes = [ "ReadWriteMany" ]; + + nfs = { + server = "lewis.hyp"; + path = "/mnt/data/nfs/bazarr/config"; + }; + }; }; persistentVolumeClaims = { @@ -469,6 +540,13 @@ resources.requests.storage = "1Mi"; volumeName = "sonarr-config"; }; + + bazarr-config.spec = { + accessModes = [ "ReadWriteMany" ]; + storageClassName = ""; + resources.requests.storage = "1Mi"; + volumeName = "bazarr-config"; + }; }; services = { @@ -565,6 +643,19 @@ targetPort = 8989; }]; }; + + bazarr.spec = { + selector = { + app = "media"; + component = "bazarr"; + }; + + ports = [{ + protocol = "TCP"; + port = 80; + targetPort = 6767; + }]; + }; }; ingresses = { @@ -675,6 +766,24 @@ }]; }]; }; + + bazarr.spec = { + ingressClassName = "traefik"; + + rules = [{ + host = "bazarr.kun.is"; + + http.paths = [{ + path = "/"; + pathType = "Prefix"; + + backend.service = { + name = "bazarr"; + port.number = 80; + }; + }]; + }]; + }; }; }; }