nixos-servers/kubenix-modules/media.nix

634 lines
14 KiB
Nix

{ myLib, ... }: {
kubernetes.resources = {
deployments = {
jellyfin.spec = {
selector.matchLabels = {
app = "media";
component = "jellyfin";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
containers.jellyfin = {
image = "jellyfin/jellyfin:10.9.7";
ports.web.containerPort = 8096;
imagePullPolicy = "Always";
env.JELLYFIN_PublishedServerUrl.value = "https://media.kun.is";
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
{
name = "cache";
mountPath = "/config/transcodes";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "jellyfin";
cache.persistentVolumeClaim.claimName = "jellyfin-cache";
media.hostPath = {
path = "/mnt/longhorn/persistent/media";
type = "Directory";
};
};
securityContext = {
fsGroup = 0;
fsGroupChangePolicy = "OnRootMismatch";
};
affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms = [{
matchExpressions = [{
key = "hasMedia";
operator = "In";
values = [ "true" ];
}];
}];
};
};
};
transmission.spec = {
selector.matchLabels = {
app = "media";
component = "transmission";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "transmission";
};
spec = {
containers.transmission = {
image = "lscr.io/linuxserver/transmission:4.0.6";
imagePullPolicy = "Always";
ports = {
web.containerPort = 9091;
bittorrent.containerPort = 31780;
};
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "transmission";
media.persistentVolumeClaim.claimName = "media";
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
jellyseerr.spec = {
selector.matchLabels = {
app = "media";
component = "jellyseerr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
volumes.config.persistentVolumeClaim.claimName = "jellyseerr";
containers.jellyseerr = {
image = "fallenbagel/jellyseerr:1.9.2";
ports.web.containerPort = 5055;
imagePullPolicy = "Always";
env = {
LOG_LEVEL.value = "debug";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [{
name = "config";
mountPath = "/app/config";
}];
};
securityContext = {
fsGroup = 0;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
radarr.spec = {
selector.matchLabels = {
app = "media";
component = "radarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "radarr";
};
spec = {
containers.radarr = {
image = "lscr.io/linuxserver/radarr:5.7.0";
ports.web.containerPort = 7878;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "radarr";
media.persistentVolumeClaim.claimName = "media";
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
prowlarr.spec = {
selector.matchLabels = {
app = "media";
component = "prowlarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "prowlarr";
};
spec = {
volumes.config.persistentVolumeClaim.claimName = "prowlarr";
containers.prowlarr = {
image = "lscr.io/linuxserver/prowlarr:1.20.1";
ports.web.containerPort = 9696;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [{
name = "config";
mountPath = "/config";
}];
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
sonarr.spec = {
selector.matchLabels = {
app = "media";
component = "sonarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "sonarr";
};
spec = {
containers.sonarr = {
image = "lscr.io/linuxserver/sonarr:4.0.6";
ports.web.containerPort = 8989;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "sonarr";
media.persistentVolumeClaim.claimName = "media";
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
bazarr.spec = {
selector.matchLabels = {
app = "media";
component = "bazarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "bazarr";
};
spec = {
containers.bazarr = {
image = "lscr.io/linuxserver/bazarr:1.4.3";
ports.web.containerPort = 6767;
imagePullPolicy = "Always";
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
};
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "bazarr";
media.persistentVolumeClaim.claimName = "media";
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
};
services = {
jellyfin.spec = {
selector = {
app = "media";
component = "jellyfin";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
transmission-web.spec = {
selector = {
app = "media";
component = "transmission";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
transmission-bittorrent.spec = {
type = "LoadBalancer";
loadBalancerIP = myLib.globals.bittorrentIPv4;
selector = {
app = "media";
component = "transmission";
};
ports.bittorrent = {
port = 31780;
targetPort = "bittorrent";
};
};
jellyseerr.spec = {
selector = {
app = "media";
component = "jellyseerr";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
radarr.spec = {
selector = {
app = "media";
component = "radarr";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
prowlarr.spec = {
selector = {
app = "media";
component = "prowlarr";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
sonarr.spec = {
selector = {
app = "media";
component = "sonarr";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
bazarr.spec = {
selector = {
app = "media";
component = "bazarr";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
};
persistentVolumeClaims = {
jellyfin-cache.spec = {
accessModes = [ "ReadWriteOnce" ];
resources.requests.storage = "20Gi";
};
media.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "media-media";
};
};
};
lab = {
ingresses = {
jellyfin = {
host = "media.kun.is";
service = {
name = "jellyfin";
portName = "web";
};
};
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";
};
};
};
longhorn.persistentVolumeClaim = {
jellyfin = {
volumeName = "jellyfin";
storage = "5Gi";
};
transmission = {
volumeName = "transmission";
storage = "25Mi";
};
jellyseerr = {
volumeName = "jellyseerr";
storage = "75Mi";
};
radarr = {
volumeName = "radarr";
storage = "300Mi";
};
prowlarr = {
volumeName = "prowlarr";
storage = "150Mi";
};
sonarr = {
volumeName = "sonarr";
storage = "150Mi";
};
bazarr = {
volumeName = "bazarr";
storage = "25Mi";
};
};
};
}