nixos-servers/kubenix-modules/paperless.nix
Pim Kunis 2c0a60097a chore: Update Paperless 2.3 -> 2.11.2
chore: Update Nextcloud 28 -> 29.0.4
chore: Update Syncthing 1.23.6 -> 1.27.9
chore: Update Forgejo 7.0.5 -> 8.0.0
chore: Update Immich 1.108.0 -> 1.111.0
chore: Update Kitchenowl 0.5.1 -> 0.5.2
chore: Pin Pihole to 2024.07.0
fix: Disallow rolling updates for immich ML
fix: Use tailscale host as domain
2024-07-30 22:29:10 +02:00

236 lines
5.7 KiB
Nix

{ myLib, ... }: {
kubernetes.resources = {
secrets = {
database.stringData.password = "ref+sops://secrets/kubernetes.yaml#/paperless/databasePassword";
server.stringData.secretKey = "ref+sops://secrets/kubernetes.yaml#/paperless/secretKey";
};
deployments = {
server.spec = {
selector.matchLabels = {
app = "paperless";
component = "web";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "paperless";
component = "web";
};
spec = {
volumes.data.persistentVolumeClaim.claimName = "data";
containers.paperless = {
image = myLib.globals.images.paperless;
imagePullPolicy = "IfNotPresent";
ports.web.containerPort = 8000;
env = {
PAPERLESS_REDIS.value = "redis://redis.paperless.svc.cluster.local:6379";
PAPERLESS_DBENGINE.value = "postgresql";
PAPERLESS_DBHOST.value = "database.paperless.svc.cluster.local";
PAPERLESS_DBNAME.value = "paperless";
PAPERLESS_DBUSER.value = "paperless";
PAPERLESS_DATA_DIR.value = "/data/";
PAPERLESS_MEDIA_ROOT.value = "/data/";
PAPERLESS_OCR_LANGUAGES.value = "nld eng";
PAPERLESS_URL.value = "https://paperless.griffin-mermaid.ts.net";
PAPERLESS_TIME_ZONE.value = "Europe/Amsterdam";
PAPERLESS_OCR_LANGUAGE.value = "nld";
USERMAP_UID.value = "33";
USERMAP_GID.value = "33";
PAPERLESS_DBPASS.valueFrom.secretKeyRef = {
name = "database";
key = "password";
};
PAPERLESS_SECRET_KEY.valueFrom.secretKeyRef = {
name = "server";
key = "secretKey";
};
};
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
securityContext = {
fsGroup = 33;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
redis.spec = {
selector.matchLabels = {
app = "paperless";
component = "redis";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "paperless";
component = "redis";
};
spec = {
volumes.data.persistentVolumeClaim.claimName = "redisdata";
containers.redis = {
image = myLib.globals.images.paperlessRedis;
ports.redis.containerPort = 6379;
imagePullPolicy = "IfNotPresent";
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
securityContext = {
fsGroup = 999;
fsGroupChangePolicy = "OnRootMismatch";
};
};
};
};
database.spec = {
selector.matchLabels = {
app = "paperless";
component = "database";
};
strategy = {
type = "RollingUpdate";
rollingUpdate = {
maxSurge = 0;
maxUnavailable = 1;
};
};
template = {
metadata.labels = {
app = "paperless";
component = "database";
};
spec = {
containers.postgres = {
image = myLib.globals.images.paperlessPostgres;
ports.postgres.containerPort = 5432;
imagePullPolicy = "IfNotPresent";
env = {
POSTGRES_DB.value = "paperless";
POSTGRES_USER.value = "paperless";
PGDATA.value = "/pgdata/data";
POSTGRES_PASSWORD.valueFrom.secretKeyRef = {
name = "database";
key = "password";
};
};
volumeMounts = [{
name = "data";
mountPath = "/pgdata";
}];
};
volumes.data.persistentVolumeClaim.claimName = "database";
};
};
};
};
services = {
web.spec = {
type = "LoadBalancer";
loadBalancerIP = myLib.globals.paperlessIPv4;
selector = {
app = "paperless";
component = "web";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
redis.spec = {
selector = {
app = "paperless";
component = "redis";
};
ports.redis = {
port = 6379;
targetPort = "redis";
};
};
database.spec = {
selector = {
app = "paperless";
component = "database";
};
ports.postgres = {
port = 5432;
targetPort = "postgres";
};
};
};
};
lab = {
tailscaleIngresses.tailscale = {
host = "paperless";
service.name = "web";
};
longhorn.persistentVolumeClaim = {
data = {
volumeName = "paperless-data";
storage = "10Gi";
};
redisdata = {
volumeName = "paperless-redisdata";
storage = "20Mi";
};
database = {
volumeName = "paperless-db";
storage = "150Mi";
};
};
};
}