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

200 lines
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 = {
2024-04-14 12:48:27 +00:00
databasePassword = "ref+sops://secrets/sops.yaml#/paperless-ngx/databasePassword";
secretKey = "ref+sops://secrets/sops.yaml#/paperless-ngx/secretKey";
2024-03-29 12:50:51 +00:00
};
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 = {
2024-04-14 19:00:15 +00:00
volumes.data.persistentVolumeClaim.claimName = "paperless-ngx-data";
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"; }];
2024-04-14 19:43:31 +00:00
ports.web.containerPort = 8000;
2024-03-29 12:50:51 +00:00
2024-04-14 19:00:15 +00:00
env = {
PAPERLESS_DBPASS.valueFrom.secretKeyRef = {
name = "paperless-ngx";
key = "databasePassword";
};
PAPERLESS_SECRET_KEY.valueFrom.secretKeyRef = {
name = "paperless-ngx";
key = "secretKey";
};
};
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
2024-03-29 12:50:51 +00:00
};
};
};
};
};
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 = {
2024-04-14 19:00:15 +00:00
volumes.data.persistentVolumeClaim.claimName = "paperless-ngx-redisdata";
containers.redis = {
image = "docker.io/library/redis:7";
2024-04-14 19:43:31 +00:00
ports.redis.containerPort = 6379;
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
};
2024-03-29 12:50:51 +00:00
};
};
};
};
persistentVolumes = {
paperless-ngx-redisdata.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
2024-04-12 21:31:10 +00:00
server = "lewis.dmz";
2024-03-29 12:50:51 +00:00
path = "/mnt/data/nfs/paperless-ngx/redisdata";
};
};
paperless-ngx-data.spec = {
capacity.storage = "1Mi";
accessModes = [ "ReadWriteMany" ];
nfs = {
2024-04-12 21:31:10 +00:00
server = "lewis.dmz";
2024-03-29 12:50:51 +00:00
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
2024-04-14 19:43:31 +00:00
ports.web = {
port = 80;
2024-04-14 19:43:31 +00:00
targetPort = "web";
};
};
paperless-ngx-redis.spec = {
selector = {
app = "paperless-ngx";
component = "redis";
};
2024-04-14 19:43:31 +00:00
ports.redis = {
port = 6379;
2024-04-14 19:43:31 +00:00
targetPort = "redis";
};
};
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";
2024-04-14 19:43:31 +00:00
port.name = "web";
};
}];
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
};
};
}