From 79325088a53e95850f043fe333117c89a58ea385 Mon Sep 17 00:00:00 2001 From: Robert Love Date: Tue, 7 Jan 2025 08:15:35 -0500 Subject: [PATCH] enable-paperless-ai --- .../kubernetes/paperless/app/helmrelease.yaml | 113 ------------------ .../kubernetes/paperless/app/nfs-pvc.yaml | 32 ----- .../main/apps/collab/kustomization.yaml | 1 + .../paperless-ai}/app/externalsecret.yaml | 0 .../collab/paperless-ai/app/helmrelease.yaml | 73 +++++++++++ .../paperless-ai}/app/kustomization.yaml | 3 +- .../collab/paperless-ai/app/longhorn-pvc.yaml | 42 +++++++ .../main/apps/collab/paperless-ai}/ks.yaml | 11 +- 8 files changed, 122 insertions(+), 153 deletions(-) delete mode 100644 .archive/kubernetes/paperless/app/helmrelease.yaml delete mode 100644 .archive/kubernetes/paperless/app/nfs-pvc.yaml rename {.archive/kubernetes/paperless => kubernetes/main/apps/collab/paperless-ai}/app/externalsecret.yaml (100%) create mode 100644 kubernetes/main/apps/collab/paperless-ai/app/helmrelease.yaml rename {.archive/kubernetes/paperless => kubernetes/main/apps/collab/paperless-ai}/app/kustomization.yaml (69%) create mode 100644 kubernetes/main/apps/collab/paperless-ai/app/longhorn-pvc.yaml rename {.archive/kubernetes/paperless => kubernetes/main/apps/collab/paperless-ai}/ks.yaml (62%) diff --git a/.archive/kubernetes/paperless/app/helmrelease.yaml b/.archive/kubernetes/paperless/app/helmrelease.yaml deleted file mode 100644 index 1fa65f06a0..0000000000 --- a/.archive/kubernetes/paperless/app/helmrelease.yaml +++ /dev/null @@ -1,113 +0,0 @@ ---- -# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/helmrelease-helm-v2beta2.json -apiVersion: helm.toolkit.fluxcd.io/v2 -kind: HelmRelease -metadata: - name: paperless -spec: - interval: 30m - chart: - spec: - chart: app-template - version: 3.3.2 - interval: 30m - sourceRef: - kind: HelmRepository - name: bjw-s-charts - namespace: flux-system - - values: - controllers: - main: - type: statefulset - - annotations: - reloader.stakater.com/auto: "true" - - initContainers: - init-db: - image: - repository: ghcr.io/onedr0p/postgres-init - tag: 16 - envFrom: &envFrom - - secretRef: - name: paperless-secret - - containers: - main: - image: - repository: ghcr.io/paperless-ngx/paperless-ngx - tag: 2.11.6 - env: - # Configure application - PAPERLESS_APPS: allauth.socialaccount.providers.openid_connect - #PAPERLESS_SECRET_KEY: - # valueFrom: - # secretKeyRef: - # name: paperless-secret - # key: PAPERLESS_SECRET_KEY - PAPERLESS_URL: https://paperless.${SECRET_DOMAIN} - PAPERLESS_PORT: "8000" - PAPERLESS_TIME_ZONE: ${TIMEZONE} - PAPERLESS_WEBSERVER_WORKERS: "2" - PAPERLESS_TASK_WORKERS: "2" - # Configure Remote User auth - PAPERLESS_ACCOUNT_ALLOW_SIGNUPS: "false" - PAPERLESS_SOCIALACCOUNT_ALLOW_SIGNUPS: "true" - PAPERLESS_SOCIALACCOUNT_PROVIDERS: - valueFrom: - secretKeyRef: - name: paperless-secret - key: PAPERLESS_SOCIALACCOUNT_PROVIDERS - # Configure folders - PAPERLESS_CONSUMPTION_DIR: /library/consume - PAPERLESS_DATA_DIR: /library/data - PAPERLESS_EXPORT_DIR: /library/export - PAPERLESS_MEDIA_ROOT: /library/media - # Configure folder importer - PAPERLESS_CONSUMER_POLLING: "60" - PAPERLESS_CONSUMER_RECURSIVE: "true" - PAPERLESS_CONSUMER_SUBDIRS_AS_TAGS: "true" - # Configure OCR - PAPERLESS_OCR_LANGUAGE: eng - # Configure redis integration - PAPERLESS_REDIS: redis://dragonfly.databases.svc.cluster.local:6379/0 - # DB - PAPERLESS_DBNAME: paperless - - envFrom: *envFrom - - resources: - requests: - cpu: 11m - memory: 2048Mi - limits: - memory: 2048Mi - - service: - main: - controller: main - ports: - http: - port: &httpPort 8000 - - ingress: - main: - className: internal - annotations: - hajimari.io/enable: "true" - hajimari.io/appName: "Paperless" - hajimari.io/icon: arcticons:paperless - hajimari.io/group: "collab" - hajimari.io/instance: "admin" - hosts: - - host: &host paperless.${SECRET_DOMAIN} - paths: - - path: / - service: - identifier: main - port: *httpPort - - persistence: - library: - existingClaim: paperless-library-pvc diff --git a/.archive/kubernetes/paperless/app/nfs-pvc.yaml b/.archive/kubernetes/paperless/app/nfs-pvc.yaml deleted file mode 100644 index 08a3d94118..0000000000 --- a/.archive/kubernetes/paperless/app/nfs-pvc.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: v1 -kind: PersistentVolume -metadata: - name: paperless-library-pv - labels: - type: nfs -spec: - storageClassName: paperless-library-storage-class - capacity: - storage: 15Gi - accessModes: - - ReadWriteOnce - nfs: - server: "${SECRET_NFS_HOST_0}" - path: /mnt/kubernetes/paperless - ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - namespace: collab - name: paperless-library-pvc -spec: - accessModes: - - ReadWriteOnce - volumeMode: Filesystem - resources: - requests: - storage: 15Gi - volumeName: paperless-library-pv - storageClassName: paperless-library-storage-class diff --git a/kubernetes/main/apps/collab/kustomization.yaml b/kubernetes/main/apps/collab/kustomization.yaml index 616776f7d3..5d14aa35f7 100644 --- a/kubernetes/main/apps/collab/kustomization.yaml +++ b/kubernetes/main/apps/collab/kustomization.yaml @@ -4,3 +4,4 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ./obsidian-couchdb/ks.yaml + - ./paperless-ai/ks.yaml diff --git a/.archive/kubernetes/paperless/app/externalsecret.yaml b/kubernetes/main/apps/collab/paperless-ai/app/externalsecret.yaml similarity index 100% rename from .archive/kubernetes/paperless/app/externalsecret.yaml rename to kubernetes/main/apps/collab/paperless-ai/app/externalsecret.yaml diff --git a/kubernetes/main/apps/collab/paperless-ai/app/helmrelease.yaml b/kubernetes/main/apps/collab/paperless-ai/app/helmrelease.yaml new file mode 100644 index 0000000000..2ba926b445 --- /dev/null +++ b/kubernetes/main/apps/collab/paperless-ai/app/helmrelease.yaml @@ -0,0 +1,73 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/fluxcd-community/flux2-schemas/main/helmrelease-helm-v2beta2.json +apiVersion: helm.toolkit.fluxcd.io/v2 +kind: HelmRelease +metadata: + name: paperless-ai +spec: + interval: 30m + chart: + spec: + chart: app-template + version: 3.3.2 + interval: 30m + sourceRef: + kind: HelmRepository + name: bjw-s-charts + namespace: flux-system + + values: + controllers: + main: + type: statefulset + + initContainers: + init-db: + image: + repository: clusterzx/paperless-ai + tag: 1.4.6@sha256:ed24b8aa1392cae598f376f1cc13074e58fa9913fd8594e45a640713f11c24c4 + + containers: + main: + image: + repository: ghcr.io/paperless-ngx/paperless-ngx + tag: 2.11.6 + + resources: + requests: + cpu: 11m + memory: 2048Mi + limits: + memory: 2048Mi + + service: + main: + controller: main + ports: + http: + port: &httpPort 8000 + + ingress: + main: + className: internal + annotations: + hajimari.io/enable: "true" + hajimari.io/appName: "Paperless" + hajimari.io/icon: arcticons:paperless + hajimari.io/group: "collab" + hajimari.io/instance: "admin" + hosts: + - host: &host paperless.${SECRET_DOMAIN} + paths: + - path: / + service: + identifier: main + port: *httpPort + + persistence: + library: + existingClaim: paperless-data-pvc + advancedMounts: + main: + main: + - path: /app/data diff --git a/.archive/kubernetes/paperless/app/kustomization.yaml b/kubernetes/main/apps/collab/paperless-ai/app/kustomization.yaml similarity index 69% rename from .archive/kubernetes/paperless/app/kustomization.yaml rename to kubernetes/main/apps/collab/paperless-ai/app/kustomization.yaml index 8704e9e6b1..b476397022 100644 --- a/.archive/kubernetes/paperless/app/kustomization.yaml +++ b/kubernetes/main/apps/collab/paperless-ai/app/kustomization.yaml @@ -2,6 +2,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - ./externalsecret.yaml - ./helmrelease.yaml - - ./nfs-pvc.yaml + - ./longhorn-pvc.yaml diff --git a/kubernetes/main/apps/collab/paperless-ai/app/longhorn-pvc.yaml b/kubernetes/main/apps/collab/paperless-ai/app/longhorn-pvc.yaml new file mode 100644 index 0000000000..64b6ea3b63 --- /dev/null +++ b/kubernetes/main/apps/collab/paperless-ai/app/longhorn-pvc.yaml @@ -0,0 +1,42 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: media + name: paperless-data-pvc + labels: + type: longhorn +spec: + accessModes: + - ReadWriteOnce + volumeMode: Filesystem + resources: + requests: + storage: 100Gi + volumeName: paperless-data-pv + storageClassName: paperless-data-storage-class + +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: paperless-data-pv + labels: + type: longhorn + recurring-job-group.longhorn.io/weekly-backup: enabled + recurring-job-group.longhorn.io/daily-snapshot: enabled +spec: + capacity: + storage: 100Gi + volumeMode: Filesystem + accessModes: + - ReadWriteOnce + persistentVolumeReclaimPolicy: Retain + storageClassName: paperless-data-storage-class + csi: + driver: driver.longhorn.io + fsType: xfs + volumeAttributes: + numberOfReplicas: "2" + staleReplicaTimeout: "2880" + volumeHandle: paperless-data-xfs diff --git a/.archive/kubernetes/paperless/ks.yaml b/kubernetes/main/apps/collab/paperless-ai/ks.yaml similarity index 62% rename from .archive/kubernetes/paperless/ks.yaml rename to kubernetes/main/apps/collab/paperless-ai/ks.yaml index dc548e3d60..5d4f452ced 100644 --- a/.archive/kubernetes/paperless/ks.yaml +++ b/kubernetes/main/apps/collab/paperless-ai/ks.yaml @@ -3,21 +3,20 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: - name: &appname collab-paperless + name: collab-paperless-ai namespace: flux-system spec: targetNamespace: collab commonMetadata: labels: - app.kubernetes.io/name: paperless + app.kubernetes.io/name: &appname paperless-ai interval: 30m - path: "./kubernetes/main/apps/collab/paperless/app" + path: "./kubernetes/main/apps/collab/paperless-ai/app" prune: true sourceRef: kind: GitRepository name: home-ops-kubernetes wait: false dependsOn: - - name: databases-dragonfly-cluster - - name: storage-rook-ceph-cluster - - name: system-external-secrets-stores + - name: storage-longhorn + - name: ai-ollama