nixos-servers/kubenix-modules/media.nix

586 lines
13 KiB
Nix
Raw Permalink Normal View History

{ myLib, ... }: {
2024-04-06 14:15:01 +00:00
kubernetes.resources = {
2024-04-06 14:45:10 +00:00
configMaps = {
jellyfin-env.data.JELLYFIN_PublishedServerUrl = "https://media.kun.is";
transmission-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
2024-04-06 14:15:01 +00:00
};
2024-04-06 15:10:34 +00:00
jellyseerr-env.data = {
LOG_LEVEL = "debug";
TZ = "Europe/Amsterdam";
};
2024-04-06 15:26:31 +00:00
radarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
2024-04-06 15:36:29 +00:00
prowlarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
2024-04-06 15:47:49 +00:00
sonarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
2024-04-06 15:55:27 +00:00
bazarr-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
2024-04-06 14:45:10 +00:00
};
2024-04-06 14:15:01 +00:00
2024-04-06 14:45:10 +00:00
deployments = {
jellyfin = {
metadata.labels = {
2024-04-06 14:15:01 +00:00
app = "media";
component = "jellyfin";
};
2024-04-06 14:45:10 +00:00
spec = {
selector.matchLabels = {
2024-04-06 14:15:01 +00:00
app = "media";
component = "jellyfin";
};
2024-06-15 10:49:31 +00:00
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
2024-04-06 14:45:10 +00:00
template = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
containers.jellyfin = {
2024-06-15 10:49:31 +00:00
image = "jellyfin/jellyfin:10.9.6";
2024-04-06 14:45:10 +00:00
envFrom = [{ configMapRef.name = "jellyfin-env"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 8096;
imagePullPolicy = "Always";
2024-04-06 14:15:01 +00:00
2024-04-06 14:45:10 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
{
name = "cache";
mountPath = "/config/transcodes";
}
2024-04-06 14:45:10 +00:00
];
};
2024-04-06 14:15:01 +00:00
2024-04-14 19:00:15 +00:00
volumes = {
2024-05-23 20:30:30 +00:00
config.persistentVolumeClaim.claimName = "jellyfin";
cache.persistentVolumeClaim.claimName = "jellyfin-cache";
media.hostPath = {
path = "/mnt/longhorn/persistent/media";
type = "Directory";
};
2024-04-14 19:00:15 +00:00
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 0;
fsGroupChangePolicy = "OnRootMismatch";
};
affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms = [{
matchExpressions = [{
key = "hasMedia";
operator = "In";
values = [ "true" ];
}];
}];
2024-04-06 14:15:01 +00:00
};
2024-04-06 14:45:10 +00:00
};
};
};
transmission = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
selector.matchLabels = {
app = "media";
component = "transmission";
};
template = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
containers.transmission = {
image = "lscr.io/linuxserver/transmission:latest";
envFrom = [{ configMapRef.name = "transmission-env"; }];
2024-04-06 14:15:01 +00:00
2024-04-14 19:43:31 +00:00
ports = {
web.containerPort = 9091;
bittorrent.containerPort = 31780;
};
2024-04-06 14:45:10 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
2024-04-14 19:00:15 +00:00
volumes = {
2024-05-23 20:30:30 +00:00
config.persistentVolumeClaim.claimName = "transmission";
2024-04-14 19:00:15 +00:00
media.persistentVolumeClaim.claimName = "media";
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
2024-04-06 14:45:10 +00:00
};
2024-04-06 14:15:01 +00:00
};
};
};
2024-04-06 15:10:34 +00:00
jellyseerr = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
selector.matchLabels = {
app = "media";
component = "jellyseerr";
};
template = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
2024-05-23 20:30:30 +00:00
volumes.config.persistentVolumeClaim.claimName = "jellyseerr";
2024-04-14 19:00:15 +00:00
2024-04-06 15:10:34 +00:00
containers.jellyseerr = {
image = "fallenbagel/jellyseerr:1.7.0";
envFrom = [{ configMapRef.name = "jellyseerr-env"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 5055;
2024-04-06 15:10:34 +00:00
volumeMounts = [{
name = "config";
mountPath = "/app/config";
}];
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 0;
fsGroupChangePolicy = "OnRootMismatch";
};
2024-04-06 15:10:34 +00:00
};
};
};
};
2024-04-06 15:26:31 +00:00
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"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 7878;
2024-04-06 15:26:31 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
2024-04-14 19:00:15 +00:00
volumes = {
2024-05-23 20:30:30 +00:00
config.persistentVolumeClaim.claimName = "radarr";
2024-04-14 19:00:15 +00:00
media.persistentVolumeClaim.claimName = "media";
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
2024-04-06 15:26:31 +00:00
};
};
};
};
2024-04-06 15:36:29 +00:00
prowlarr = {
metadata.labels = {
app = "media";
component = "prowlarr";
};
spec = {
selector.matchLabels = {
app = "media";
component = "prowlarr";
};
template = {
metadata.labels = {
app = "media";
component = "prowlarr";
};
spec = {
2024-05-23 20:30:30 +00:00
volumes.config.persistentVolumeClaim.claimName = "prowlarr";
2024-04-14 19:00:15 +00:00
2024-04-06 15:36:29 +00:00
containers.prowlarr = {
image = "lscr.io/linuxserver/prowlarr:latest";
envFrom = [{ configMapRef.name = "prowlarr-env"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 9696;
2024-04-06 15:36:29 +00:00
volumeMounts = [{
name = "config";
mountPath = "/config";
}];
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
2024-04-06 15:36:29 +00:00
};
};
};
};
2024-04-06 15:47:49 +00:00
sonarr = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
selector.matchLabels = {
app = "media";
component = "sonarr";
};
template = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
containers.sonarr = {
image = "lscr.io/linuxserver/sonarr:latest";
envFrom = [{ configMapRef.name = "sonarr-env"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 8989;
2024-04-06 15:47:49 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
2024-04-14 19:00:15 +00:00
volumes = {
2024-05-23 20:30:30 +00:00
config.persistentVolumeClaim.claimName = "sonarr";
2024-04-14 19:00:15 +00:00
media.persistentVolumeClaim.claimName = "media";
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
2024-04-06 15:47:49 +00:00
};
};
};
};
2024-04-06 15:55:27 +00:00
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"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 6767;
2024-04-06 15:55:27 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
2024-04-14 19:00:15 +00:00
volumes = {
2024-05-23 20:30:30 +00:00
config.persistentVolumeClaim.claimName = "bazarr";
2024-04-14 19:00:15 +00:00
media.persistentVolumeClaim.claimName = "media";
};
2024-05-23 20:30:30 +00:00
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
2024-04-06 15:55:27 +00:00
};
};
};
};
2024-04-06 14:15:01 +00:00
};
2024-04-06 14:45:10 +00:00
services = {
jellyfin.spec = {
selector = {
app = "media";
component = "jellyfin";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 14:45:10 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 14:45:10 +00:00
};
transmission-web.spec = {
selector = {
app = "media";
component = "transmission";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 14:45:10 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 14:15:01 +00:00
};
2024-04-06 14:45:10 +00:00
transmission-bittorrent.spec = {
type = "LoadBalancer";
loadBalancerIP = myLib.globals.bittorrentIPv4;
2024-04-06 14:45:10 +00:00
selector = {
app = "media";
component = "transmission";
};
2024-04-14 19:43:31 +00:00
ports.bittorrent = {
2024-04-06 14:45:10 +00:00
port = 31780;
2024-04-14 19:43:31 +00:00
targetPort = "bittorrent";
};
2024-04-06 14:45:10 +00:00
};
2024-04-06 15:10:34 +00:00
jellyseerr.spec = {
selector = {
app = "media";
component = "jellyseerr";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 15:10:34 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 15:10:34 +00:00
};
2024-04-06 15:26:31 +00:00
radarr.spec = {
selector = {
app = "media";
component = "radarr";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 15:26:31 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 15:26:31 +00:00
};
2024-04-06 15:36:29 +00:00
prowlarr.spec = {
selector = {
app = "media";
component = "prowlarr";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 15:36:29 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 15:36:29 +00:00
};
2024-04-06 15:47:49 +00:00
sonarr.spec = {
selector = {
app = "media";
component = "sonarr";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 15:47:49 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 15:47:49 +00:00
};
2024-04-06 15:55:27 +00:00
bazarr.spec = {
selector = {
app = "media";
component = "bazarr";
};
2024-04-14 19:43:31 +00:00
ports.web = {
2024-04-06 15:55:27 +00:00
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
2024-04-06 15:55:27 +00:00
};
2024-04-06 14:15:01 +00:00
};
persistentVolumeClaims.jellyfin-cache.spec = {
accessModes = [ "ReadWriteOnce" ];
resources.requests.storage = "20Gi";
};
};
2024-04-06 14:15:01 +00:00
lab = {
ingresses = {
jellyfin = {
host = "media.kun.is";
2024-04-06 15:47:49 +00:00
service = {
name = "jellyfin";
portName = "web";
};
2024-04-06 15:47:49 +00:00
};
2024-04-06 15:55:27 +00:00
transmission = {
host = "transmission.kun.is";
entrypoint = "localsecure";
service = {
name = "transmission-web";
portName = "web";
};
};
jellyseerr = {
host = "jellyseerr.kun.is";
entrypoint = "localsecure";
service = {
name = "jellyseerr";
portName = "web";
};
};
radarr = {
host = "radarr.kun.is";
entrypoint = "localsecure";
service = {
name = "radarr";
portName = "web";
};
};
prowlarr = {
host = "prowlarr.kun.is";
entrypoint = "localsecure";
service = {
name = "prowlarr";
portName = "web";
};
};
sonarr = {
host = "sonarr.kun.is";
entrypoint = "localsecure";
service = {
name = "sonarr";
portName = "web";
};
};
bazarr = {
host = "bazarr.kun.is";
entrypoint = "localsecure";
service = {
name = "bazarr";
portName = "web";
};
};
2024-04-06 14:15:01 +00:00
};
};
}