nixos-servers/nix/flake/kubenix/paperless-ngx.nix

224 lines
5.5 KiB
Nix
Raw Normal View History

2024-03-29 12:50:51 +00:00
{
kubernetes.resources = {
configMaps.paperless-ngx.data = {
PAPERLESS_REDIS = "redis://paperless-ngx-redis.default.svc.cluster.local:6379";
2024-03-29 12:50:51 +00:00
PAPERLESS_DBENGINE = "postgresql";
PAPERLESS_DBHOST = "lewis.dmz";
PAPERLESS_DBNAME = "paperless";
PAPERLESS_DBUSER = "paperless";
PAPERLESS_DATA_DIR = "/data/";
PAPERLESS_MEDIA_ROOT = "/data/";
PAPERLESS_OCR_LANGUAGES = "nld eng";
PAPERLESS_URL = "https://paperless.kun.is";
PAPERLESS_TIME_ZONE = "Europe/Amsterdam";
PAPERLESS_OCR_LANGUAGE = "nld";
USERMAP_UID = "33";
USERMAP_GID = "33";
};
secrets.paperless-ngx.stringData = {
databasePassword = "ref+file:///home/pim/.config/home/vals.yaml#/paperless-ngx/databasePassword";
secretKey = "ref+file:///home/pim/.config/home/vals.yaml#/paperless-ngx/secretKey";
};
deployments = {
paperless-ngx-web = {
metadata.labels = {
app = "paperless-ngx";
component = "web";
};
2024-03-29 12:50:51 +00:00
spec = {
selector.matchLabels = {
app = "paperless-ngx";
component = "web";
};
2024-03-29 12:50:51 +00:00
template = {
metadata.labels = {
app = "paperless-ngx";
component = "web";
};
2024-03-29 12:50:51 +00:00
spec = {
containers.paperless-ngx = {
2024-03-29 12:50:51 +00:00
image = "ghcr.io/paperless-ngx/paperless-ngx:2.3";
envFrom = [{ configMapRef.name = "paperless-ngx"; }];
ports = [{
containerPort = 8000;
protocol = "TCP";
}];
env = [
{
name = "PAPERLESS_DBPASS";
valueFrom.secretKeyRef = {
name = "paperless-ngx";
key = "databasePassword";
};
}
{
name = "PAPERLESS_SECRET_KEY";
valueFrom.secretKeyRef = {
name = "paperless-ngx";
key = "secretKey";
};
}
];
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
2024-03-29 12:50:51 +00:00
};
volumes = [{
name = "data";
persistentVolumeClaim.claimName = "paperless-ngx-data";
}];
};
};
};
};
paperless-ngx-redis = {
metadata.labels = {
app = "paperless-ngx";
component = "redis";
};
spec = {
selector.matchLabels = {
app = "paperless-ngx";
component = "redis";
};
template = {
metadata.labels = {
app = "paperless-ngx";
component = "redis";
2024-03-29 12:50:51 +00:00
};
spec = {
containers.redis = {
image = "docker.io/library/redis:7";
ports = [{
containerPort = 6379;
protocol = "TCP";
}];
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
volumes = [{
name = "data";
persistentVolumeClaim.claimName = "paperless-ngx-redisdata";
}];
};
2024-03-29 12:50:51 +00:00
};
};
};
};
persistentVolumes = {
paperless-ngx-redisdata.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/paperless-ngx/redisdata";
};
};
paperless-ngx-data.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
server = "lewis.hyp";
path = "/mnt/data/nfs/paperless-ngx/data";
};
};
};
persistentVolumeClaims = {
paperless-ngx-redisdata.spec = {
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "paperless-ngx-redisdata";
};
paperless-ngx-data.spec = {
2024-03-29 12:50:51 +00:00
accessModes = [ "ReadWriteMany" ];
storageClassName = "";
resources.requests.storage = "1Mi";
volumeName = "paperless-ngx-data";
};
};
services = {
paperless-ngx-web.spec = {
selector = {
app = "paperless-ngx";
component = "web";
};
2024-03-29 12:50:51 +00:00
ports = [{
protocol = "TCP";
port = 80;
targetPort = 8000;
}];
};
paperless-ngx-redis.spec = {
selector = {
app = "paperless-ngx";
component = "redis";
};
ports = [{
protocol = "TCP";
port = 6379;
targetPort = 6379;
}];
};
2024-03-29 12:50:51 +00:00
};
ingresses.paperless-ngx = {
metadata.annotations."cert-manager.io/cluster-issuer" = "letsencrypt";
2024-03-29 12:50:51 +00:00
spec = {
ingressClassName = "traefik";
2024-03-29 12:50:51 +00:00
rules = [{
host = "paperless.kun.is";
2024-03-29 12:50:51 +00:00
http.paths = [{
path = "/";
pathType = "Prefix";
backend.service = {
name = "paperless-ngx-web";
port.number = 80;
};
}];
2024-03-29 12:50:51 +00:00
}];
tls = [{
secretName = "paperless-ngx-tls";
hosts = [ "paperless.kun.is" ];
}];
};
2024-03-29 12:50:51 +00:00
};
};
}