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

150 lines
3.7 KiB
Nix

{
kubernetes.resources = {
configMaps.paperless-ngx.data = {
PAPERLESS_REDIS = "redis://paperless-ngx-redis.default.svc.cluster.local:6379";
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+sops://secrets/sops.yaml#/paperless-ngx/databasePassword";
secretKey = "ref+sops://secrets/sops.yaml#/paperless-ngx/secretKey";
};
deployments = {
paperless-ngx-web = {
metadata.labels = {
app = "paperless-ngx";
component = "web";
};
spec = {
selector.matchLabels = {
app = "paperless-ngx";
component = "web";
};
template = {
metadata.labels = {
app = "paperless-ngx";
component = "web";
};
spec = {
volumes.data.persistentVolumeClaim.claimName = "paperless-ngx-data";
containers.paperless-ngx = {
image = "ghcr.io/paperless-ngx/paperless-ngx:2.3";
envFrom = [{ configMapRef.name = "paperless-ngx"; }];
ports.web.containerPort = 8000;
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";
}];
};
};
};
};
};
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";
};
spec = {
volumes.data.persistentVolumeClaim.claimName = "paperless-ngx-redisdata";
containers.redis = {
image = "docker.io/library/redis:7";
ports.redis.containerPort = 6379;
volumeMounts = [{
name = "data";
mountPath = "/data";
}];
};
};
};
};
};
};
services = {
paperless-ngx-web.spec = {
selector = {
app = "paperless-ngx";
component = "web";
};
ports.web = {
port = 80;
targetPort = "web";
};
};
paperless-ngx-redis.spec = {
selector = {
app = "paperless-ngx";
component = "redis";
};
ports.redis = {
port = 6379;
targetPort = "redis";
};
};
};
};
lab = {
ingresses.paperless-ngx = {
host = "paperless.kun.is";
service = {
name = "paperless-ngx-web";
portName = "web";
};
};
nfsVolumes = {
paperless-ngx-redisdata.path = "paperless-ngx/redisdata";
paperless-ngx-data.path = "paperless-ngx/data";
};
};
}