migrate bazarr to kubernetes

This commit is contained in:
Pim Kunis 2024-04-06 17:55:27 +02:00
parent 81eacbcfcb
commit 2853895822
6 changed files with 115 additions and 87 deletions

View file

@ -4,4 +4,3 @@
roles:
- {role: traefik, tags: traefik}
- {role: swarm_dashboard, tags: swarm_dashboard}
- {role: media, tags: media}

View file

@ -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

View file

@ -1,5 +0,0 @@
- name: Deploy Docker stack
docker_stack:
name: media
compose:
- "{{ lookup('template', '{{ role_path }}/docker-stack.yml.j2') | from_yaml }}"

View file

@ -1 +0,0 @@
bittorrent_port: 31780

View file

@ -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

View file

@ -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;
};
}];
}];
};
};
};
}