infra/homelab/changedetection.nix

98 lines
2.5 KiB
Nix

let
appName = "changedetection";
changedetection-Image = "dgtlmoon/changedetection.io:latest";
browserless-Image = "browserless/chrome:latest";
in
{...}: {
kubernetes.resources.services.changedetection = {
spec = {
selector.app = appName;
ports.http = {
port = 5000;
targetPort = 5000;
};
};
};
kubernetes.resources.statefulSets.changedetection.spec = {
selector.matchLabels.app = appName;
serviceName = appName;
template = {
metadata.labels.app = appName;
spec = {
volumes = {
config.configMap.name = appName;
};
containers = {
changedetection = {
image = changedetection-Image;
imagePullPolicy = "Always";
ports.http.containerPort = 5000;
env = [
{
name = "PLAYWRIGHT_DRIVER_URL";
value = "ws://localhost:3000";
}
];
volumeMounts = [
{
name = "data";
mountPath = "/datastore";
}
];
};
browserless = {
image = browserless-Image;
imagePullPolicy = "Always";
ports.webdriver.containerPort = 3000;
resources = {
requests.memory = "768Mi";
limits.memory = "2Gi";
};
};
};
};
};
volumeClaimTemplates = [
{
metadata.name = "data";
spec = {
storageClassName = "nfs-client";
accessModes = ["ReadWriteOnce"];
resources.requests.storage = "1Gi";
};
}
];
};
kubernetes.resources.ingresses.changedetection = {
metadata = {
name = appName;
annotations = {
"cert-manager.io/issuer" = "le-issuer";
};
};
spec = {
tls = [
{
hosts = ["changedetect.gmem.ca"];
secretName = "gmem-ca-wildcard";
}
];
rules = [
{
host = "changedetect.gmem.ca";
http.paths = [
{
path = "/";
pathType = "Prefix";
backend.service = {
name = appName;
port.name = "http";
};
}
];
}
];
};
};
}