nixos-servers/nix/flake/kubenix/media.nix

365 lines
8.3 KiB
Nix

{
kubernetes.resources = {
configMaps = {
jellyfin-env.data.JELLYFIN_PublishedServerUrl = "https://media.kun.is";
transmission-env.data = {
PUID = "1000";
PGID = "1000";
TZ = "Europe/Amsterdam";
};
jellyseerr-env.data = {
LOG_LEVEL = "debug";
TZ = "Europe/Amsterdam";
};
};
deployments = {
jellyfin = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
selector.matchLabels = {
app = "media";
component = "jellyfin";
};
template = {
metadata.labels = {
app = "media";
component = "jellyfin";
};
spec = {
containers.jellyfin = {
image = "jellyfin/jellyfin:10.8.13-1";
envFrom = [{ configMapRef.name = "jellyfin-env"; }];
ports = [{
containerPort = 8096;
protocol = "TCP";
}];
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = [
{
name = "config";
persistentVolumeClaim.claimName = "jellyfin-config";
}
{
name = "media";
persistentVolumeClaim.claimName = "media";
}
];
};
};
};
};
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"; }];
ports = [
{
containerPort = 9091;
protocol = "TCP";
}
# TODO: Only use TCP, as Kubernetes does not support multiple protocols for a port number.
# Should see if this works as correctly though.
{
containerPort = 31780;
protocol = "TCP";
}
];
volumeMounts = [
{
name = "config";
mountPath = "/config";
}
{
name = "media";
mountPath = "/media";
}
];
};
volumes = [
{
name = "config";
persistentVolumeClaim.claimName = "transmission-config";
}
{
name = "media";
persistentVolumeClaim.claimName = "media";
}
];
};
};
};
};
jellyseerr = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
selector.matchLabels = {
app = "media";
component = "jellyseerr";
};
template = {
metadata.labels = {
app = "media";
component = "jellyseerr";
};
spec = {
containers.jellyseerr = {
image = "fallenbagel/jellyseerr:1.7.0";
envFrom = [{ configMapRef.name = "jellyseerr-env"; }];
ports = [{
containerPort = 5055;
protocol = "TCP";
}];
volumeMounts = [{
name = "config";
mountPath = "/app/config";
}];
};
volumes = [{
name = "config";
persistentVolumeClaim.claimName = "jellyseerr-config";
}];
};
};
};
};
};
persistentVolumes = {
jellyfin-config.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/jellyfin/config";
};
};
media.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/media";
};
};
transmission-config.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/transmission/config";
};
};
jellyseerr-config.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/jellyseerr/config";
};
};
};
persistentVolumeClaims = {
jellyfin-config.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "jellyfin-config";
};
media.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "media";
};
transmission-config.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "transmission-config";
};
jellyseerr-config.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "jellyseerr-config";
};
};
services = {
jellyfin.spec = {
selector = {
app = "media";
component = "jellyfin";
};
ports = [{
protocol = "TCP";
port = 80;
targetPort = 8096;
}];
};
transmission-web.spec = {
selector = {
app = "media";
component = "transmission";
};
ports = [{
protocol = "TCP";
port = 80;
targetPort = 9091;
}];
};
transmission-bittorrent.spec = {
type = "LoadBalancer";
loadBalancerIP = "192.168.30.133";
selector = {
app = "media";
component = "transmission";
};
ports = [{
protocol = "TCP";
port = 31780;
targetPort = 31780;
}];
};
jellyseerr.spec = {
selector = {
app = "media";
component = "jellyseerr";
};
ports = [{
protocol = "TCP";
port = 80;
targetPort = 5055;
}];
};
};
ingresses = {
jellyfin.spec = {
ingressClassName = "traefik";
rules = [{
host = "media.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "jellyfin";
port.number = 80;
};
}];
}];
};
transmission.spec = {
ingressClassName = "traefik";
rules = [{
host = "transmission.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "transmission-web";
port.number = 80;
};
}];
}];
};
jellyseerr.spec = {
ingressClassName = "traefik";
rules = [{
host = "jellyseerr.kun.is";
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "jellyseerr";
port.number = 80;
};
}];
}];
};
};
};
}