nixos-servers/kubenix-modules/media.nix

635 lines
14 KiB
Nix
Raw Normal View History

{ myLib, ... }: {
2024-04-06 14:15:01 +00:00
kubernetes.resources = {
2024-04-06 14:45:10 +00:00
deployments = {
jellyfin.spec = {
selector.matchLabels = {
2024-04-06 14:15:01 +00:00
app = "media";
component = "jellyfin";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
2024-04-06 14:15:01 +00:00
app = "media";
component = "jellyfin";
};
spec = {
containers.jellyfin = {
image = "jellyfin/jellyfin:10.9.7";
ports.web.containerPort = 8096;
imagePullPolicy = "Always";
2024-06-15 10:49:31 +00:00
env.JELLYFIN_PublishedServerUrl.value = "https://media.kun.is";
2024-06-15 10:49:31 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
{
name = "cache";
mountPath = "/config/transcodes";
}
];
2024-04-06 14:45:10 +00:00
};
volumes = {
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:45:10 +00:00
};
};
};
transmission.spec = {
selector.matchLabels = {
2024-04-06 14:45:10 +00:00
app = "media";
component = "transmission";
};
strategy = {
type = "RollingUpdate";
2024-04-06 14:45:10 +00:00
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";
2024-04-06 14:45:10 +00:00
ports = {
web.containerPort = 9091;
bittorrent.containerPort = 31780;
2024-04-06 14:45:10 +00:00
};
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
2024-04-14 19:00:15 +00:00
};
2024-05-23 20:30:30 +00:00
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = {
config.persistentVolumeClaim.claimName = "transmission";
media.persistentVolumeClaim.claimName = "media";
};
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.spec = {
selector.matchLabels = {
2024-04-06 15:10:34 +00:00
app = "media";
component = "jellyseerr";
};
strategy = {
type = "RollingUpdate";
2024-07-12 13:53:01 +00:00
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
2024-07-12 13:53:01 +00:00
};
};
2024-07-12 13:53:01 +00:00
template = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
2024-04-06 15:10:34 +00:00
spec = {
volumes.config.persistentVolumeClaim.claimName = "jellyseerr";
2024-04-14 19:00:15 +00:00
containers.jellyseerr = {
image = "fallenbagel/jellyseerr:1.9.2";
ports.web.containerPort = 5055;
imagePullPolicy = "Always";
2024-04-06 15:10:34 +00:00
env = {
LOG_LEVEL.value = "debug";
TZ.value = "Europe/Amsterdam";
2024-04-06 15:10:34 +00:00
};
2024-05-23 20:30:30 +00:00
volumeMounts = [{
name = "config";
mountPath = "/app/config";
}];
};
securityContext = {
fsGroup = 0;
fsGroupChangePolicy = "OnRootMismatch";
2024-04-06 15:10:34 +00:00
};
};
};
};
2024-04-06 15:26:31 +00:00
radarr.spec = {
selector.matchLabels = {
2024-04-06 15:26:31 +00:00
app = "media";
component = "radarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
2024-04-06 15:26:31 +00:00
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";
}
];
2024-04-06 15:26:31 +00:00
};
volumes = {
config.persistentVolumeClaim.claimName = "radarr";
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.spec = {
selector.matchLabels = {
2024-04-06 15:36:29 +00:00
app = "media";
component = "prowlarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "media";
component = "prowlarr";
};
2024-04-06 15:36:29 +00:00
spec = {
volumes.config.persistentVolumeClaim.claimName = "prowlarr";
2024-04-14 19:00:15 +00:00
containers.prowlarr = {
image = "lscr.io/linuxserver/prowlarr:1.20.1";
ports.web.containerPort = 9696;
imagePullPolicy = "Always";
2024-04-06 15:36:29 +00:00
env = {
PUID.value = "1000";
PGID.value = "1000";
TZ.value = "Europe/Amsterdam";
2024-04-06 15:36:29 +00:00
};
2024-05-23 20:30:30 +00:00
volumeMounts = [{
name = "config";
mountPath = "/config";
}];
};
securityContext = {
fsGroup = 1000;
fsGroupChangePolicy = "OnRootMismatch";
2024-04-06 15:36:29 +00:00
};
};
};
};
2024-04-06 15:47:49 +00:00
sonarr.spec = {
selector.matchLabels = {
2024-04-06 15:47:49 +00:00
app = "media";
component = "sonarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
2024-04-06 15:47:49 +00:00
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";
}
];
2024-04-06 15:47:49 +00:00
};
volumes = {
config.persistentVolumeClaim.claimName = "sonarr";
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.spec = {
selector.matchLabels = {
2024-04-06 15:55:27 +00:00
app = "media";
component = "bazarr";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
2024-04-06 15:55:27 +00:00
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";
}
];
2024-04-06 15:55:27 +00:00
};
volumes = {
config.persistentVolumeClaim.claimName = "bazarr";
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";
};
media.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "media-media";
};
};
};
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
};
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";
};
};
2024-04-06 14:15:01 +00:00
};
}