Ver Fonte

NAS-124059 / 24.04 / Add `paperless-ngx` to `community` train (#1533)

Stavros Kois há 1 ano atrás
pai
commit
35aba1aa71
23 ficheiros alterados com 1066 adições e 0 exclusões
  1. 6 0
      library/ix-dev/community/paperless-ngx/Chart.lock
  2. 26 0
      library/ix-dev/community/paperless-ngx/Chart.yaml
  3. 3 0
      library/ix-dev/community/paperless-ngx/README.md
  4. 3 0
      library/ix-dev/community/paperless-ngx/app-readme.md
  5. BIN
      library/ix-dev/community/paperless-ngx/charts/common-1.1.1.tgz
  6. 31 0
      library/ix-dev/community/paperless-ngx/ci/basic-values.yaml
  7. 44 0
      library/ix-dev/community/paperless-ngx/ci/extra-values.yaml
  8. 28 0
      library/ix-dev/community/paperless-ngx/ci/hostNet-values.yaml
  9. 15 0
      library/ix-dev/community/paperless-ngx/item.yaml
  10. 28 0
      library/ix-dev/community/paperless-ngx/metadata.yaml
  11. 476 0
      library/ix-dev/community/paperless-ngx/questions.yaml
  12. 1 0
      library/ix-dev/community/paperless-ngx/templates/NOTES.txt
  13. 77 0
      library/ix-dev/community/paperless-ngx/templates/_configuration.tpl
  14. 67 0
      library/ix-dev/community/paperless-ngx/templates/_paperless.tpl
  15. 90 0
      library/ix-dev/community/paperless-ngx/templates/_persistence.tpl
  16. 12 0
      library/ix-dev/community/paperless-ngx/templates/_portal.tpl
  17. 6 0
      library/ix-dev/community/paperless-ngx/templates/_postgres.tpl
  18. 5 0
      library/ix-dev/community/paperless-ngx/templates/_redis.tpl
  19. 39 0
      library/ix-dev/community/paperless-ngx/templates/_service.tpl
  20. 14 0
      library/ix-dev/community/paperless-ngx/templates/common.yaml
  21. 1 0
      library/ix-dev/community/paperless-ngx/upgrade_info.json
  22. 31 0
      library/ix-dev/community/paperless-ngx/upgrade_strategy
  23. 63 0
      library/ix-dev/community/paperless-ngx/values.yaml

+ 6 - 0
library/ix-dev/community/paperless-ngx/Chart.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../common
+  version: 1.1.1
+digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7
+generated: "2023-09-12T16:52:35.658245695+03:00"

+ 26 - 0
library/ix-dev/community/paperless-ngx/Chart.yaml

@@ -0,0 +1,26 @@
+name: paperless-ngx
+description: Paperless-ngx is a document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper.
+annotations:
+  title: Paperless-ngx
+type: application
+version: 1.0.0
+apiVersion: v2
+appVersion: 1.17.4
+kubeVersion: '>=1.16.0-0'
+maintainers:
+  - name: truenas
+    url: https://www.truenas.com/
+    email: dev@ixsystems.com
+dependencies:
+  - name: common
+    repository: file://../../../common
+    version: 1.1.1
+home: https://docs.paperless-ngx.com
+icon: https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/9a0e44a731d25524b2525d5316b53eee21dad682/docs/assets/logo_full_black.svg
+sources:
+  - https://hub.docker.com/r/paperlessngx/paperless-ngx
+  - https://github.com/truenas/charts/tree/master/library/ix-dev/community/paperless-ngx
+  - https://github.com/paperless-ngx/paperless-ngx
+keywords:
+  - document
+  - management

+ 3 - 0
library/ix-dev/community/paperless-ngx/README.md

@@ -0,0 +1,3 @@
+# Paperless-ngx
+
+[Paperless-ngx](https://docs.paperless-ngx.com) is a document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper.

+ 3 - 0
library/ix-dev/community/paperless-ngx/app-readme.md

@@ -0,0 +1,3 @@
+# Paperless-ngx
+
+[Paperless-ngx](https://docs.paperless-ngx.com) is a document management system that transforms your physical documents into a searchable online archive so you can keep, well, less paper.

BIN
library/ix-dev/community/paperless-ngx/charts/common-1.1.1.tgz


+ 31 - 0
library/ix-dev/community/paperless-ngx/ci/basic-values.yaml

@@ -0,0 +1,31 @@
+paperlessNetwork:
+  webPort: 31000
+
+paperlessConfig:
+  adminUser: admin
+  adminPassword: supersecretpassword
+  adminMail: admin@example.com
+
+paperlessID:
+  user: 1001
+  group: 1001
+
+paperlessStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data
+  media:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/media
+  consume:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/consume
+  trash:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/trash
+  pgData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/pgData
+  pgBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/pgBackup

+ 44 - 0
library/ix-dev/community/paperless-ngx/ci/extra-values.yaml

@@ -0,0 +1,44 @@
+paperlessNetwork:
+  webPort: 31000
+
+paperlessConfig:
+  adminUser: admin
+  adminPassword: supersecretpassword
+  adminMail: admin@example.com
+  enableTrash: false
+  additionalEnvs:
+    - name: PAPERLESS_OCR_LANGUAGES
+      value: deu+eng
+    - name: PAPERLESS_OCR_MODE
+      value: redo
+
+paperlessID:
+  user: 1001
+  group: 1001
+
+paperlessStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data
+  media:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/media
+  consume:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/consume
+  trash:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/trash
+  pgData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/pgData
+  pgBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/pgBackup
+  additionalStorages:
+  - type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data1
+    mountPath: /data1
+  - type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data2
+    mountPath: /data2

+ 28 - 0
library/ix-dev/community/paperless-ngx/ci/hostNet-values.yaml

@@ -0,0 +1,28 @@
+paperlessNetwork:
+  webPort: 31000
+  hostNetwork: true
+
+paperlessConfig:
+  adminUser: admin
+  adminPassword: supersecretpassword
+  adminMail: admin@example.com
+
+paperlessStorage:
+  data:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/data
+  media:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/media
+  consume:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/consume
+  trash:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/trash
+  pgData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/pgData
+  pgBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Namespace }}/pgBackup

+ 15 - 0
library/ix-dev/community/paperless-ngx/item.yaml

@@ -0,0 +1,15 @@
+icon_url: https://raw.githubusercontent.com/paperless-ngx/paperless-ngx/9a0e44a731d25524b2525d5316b53eee21dad682/docs/assets/logo_full_black.svg
+categories:
+  - productivity
+screenshots:
+  - https://docs.paperless-ngx.com/assets/screenshots/dashboard.png
+  - https://docs.paperless-ngx.com/assets/screenshots/documents-table.png
+  - https://docs.paperless-ngx.com/assets/screenshots/documents-smallcards.png
+  - https://docs.paperless-ngx.com/assets/screenshots/documents-largecards.png
+  - https://docs.paperless-ngx.com/assets/screenshots/documents-smallcards-dark.png
+  - https://docs.paperless-ngx.com/assets/screenshots/documents-filter.png
+  - https://docs.paperless-ngx.com/assets/screenshots/bulk-edit.png
+  - https://docs.paperless-ngx.com/assets/screenshots/editing.png
+tags:
+  - document
+  - management

+ 28 - 0
library/ix-dev/community/paperless-ngx/metadata.yaml

@@ -0,0 +1,28 @@
+runAsContext:
+  - userName: root
+    groupName: root
+    gid: 0
+    uid: 0
+    description: Paperless-ngx can runs as root user.
+  - userName: postgres
+    groupName: postgres
+    gid: 999
+    uid: 999
+    description: Postgres runs as a non-root user.
+  - userName: redis
+    groupName: redis
+    gid: 1001
+    uid: 0
+    description: Redis runs as a non-root user and root group.
+capabilities:
+  - name: CHOWN
+    description: Paperless-ngx is able to chown files.
+  - name: DAC_OVERRIDE
+    description: Paperless-ngx is able to bypass permission checks.
+  - name: FOWNER
+    description: Paperless-ngx is able bypass permission checks for it's sub-processes.
+  - name: SETGID
+    description: Paperless-ngx is able to set group ID for it's sub-processes.
+  - name: SETUID
+    description: Paperless-ngx is able to set user ID for it's sub-processes.
+hostMounts: []

+ 476 - 0
library/ix-dev/community/paperless-ngx/questions.yaml

@@ -0,0 +1,476 @@
+groups:
+  - name: Paperless-ngx Configuration
+    description: Configure Paperless-ngx
+  - name: User and Group Configuration
+    description: Configure User and Group for Paperless-ngx
+  - name: Network Configuration
+    description: Configure Network for Paperless-ngx
+  - name: Storage Configuration
+    description: Configure Storage for Paperless-ngx
+  - name: Resources Configuration
+    description: Configure Resources for Paperless-ngx
+
+portals:
+  web_portal:
+    protocols:
+      - "$kubernetes-resource_configmap_portal_protocol"
+    host:
+      - "$kubernetes-resource_configmap_portal_host"
+    ports:
+      - "$kubernetes-resource_configmap_portal_port"
+    path: "$kubernetes-resource_configmap_portal_path"
+
+questions:
+  - variable: TZ
+    group: Paperless-ngx Configuration
+    label: Timezone
+    schema:
+      type: string
+      default: Etc/UTC
+      required: true
+      $ref:
+        - definitions/timezone
+
+  - variable: paperlessConfig
+    label: ""
+    group: Paperless-ngx Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: adminUser
+          label: Admin User
+          description: |
+            The admin user for Paperless-ngx.</br>
+            It is only used for the initial installation.
+          schema:
+            type: string
+            default: ""
+            immutable: true
+            required: true
+        - variable: adminPassword
+          label: Admin Password
+          description: |
+            The admin password for Paperless-ngx.</br>
+            It is only used for the initial installation.
+          schema:
+            type: string
+            default: ""
+            immutable: true
+            required: true
+            private: true
+        - variable: adminMail
+          label: Admin Mail
+          description: |
+            The admin mail for Paperless-ngx.</br>
+            It is only used for the initial installation.
+          schema:
+            type: string
+            default: ""
+            immutable: true
+            required: true
+        - variable: enableTrash
+          label: Enable Trash
+          description: |
+            Enable the trash feature for Paperless-ngx.</br>
+            When enabled, documents will be moved to the trash instead of being deleted.
+          schema:
+            type: boolean
+            default: true
+        - variable: additionalEnvs
+          label: Additional Environment Variables
+          description: Configure additional environment variables for Paperless-ngx.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: env
+                label: Environment Variable
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: Name
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: Value
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: paperlessID
+    label: ""
+    group: User and Group Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: user
+          label: User ID
+          description: The user id that Paperless-ngx files will be owned by.
+          schema:
+            type: int
+            min: 568
+            default: 568
+            required: true
+        - variable: group
+          label: Group ID
+          description: The group id that Paperless-ngx files will be owned by.
+          schema:
+            type: int
+            min: 568
+            default: 568
+            required: true
+
+  - variable: paperlessNetwork
+    label: ""
+    group: Network Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: webPort
+          label: Web Port
+          description: The port for the Paperless-ngx Web UI.
+          schema:
+            type: int
+            default: 30070
+            min: 9000
+            max: 65535
+            required: true
+        - variable: hostNetwork
+          label: Host Network
+          description: |
+            Bind to the host network. It's recommended to keep this disabled.</br>
+          schema:
+            type: boolean
+            default: false
+
+  - variable: paperlessStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: data
+          label: Paperless-ngx Data Storage
+          description: The path to store Paperless-ngx Data.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "data"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: media
+          label: Paperless-ngx Media Storage
+          description: The path to store Paperless-ngx Media.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "media"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: consume
+          label: Paperless-ngx Consumption Storage
+          description: The path to store Paperless-ngx Data for Consumption.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "consume"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: trash
+          label: Paperless-ngx Trash Storage
+          description: |
+            The path to store Paperless-ngx Trash.</br>
+            This is only used when the trash feature is enabled.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: "ixVolume"
+                  enum:
+                    - value: "hostPath"
+                      description: Host Path (Path that already exists on the system)
+                    - value: "ixVolume"
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: "trash"
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+
+        - variable: pgData
+          label: Paperless-ngx Postgres Data Storage
+          description: The path to store Paperless-ngx Postgres Data.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: ixVolume
+                  enum:
+                    - value: hostPath
+                      description: Host Path (Path that already exists on the system)
+                    - value: ixVolume
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: pgData
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: pgBackup
+          label: Paperless-ngx Postgres Backup Storage
+          description: The path to store Paperless-ngx Postgres Backup.
+          schema:
+            type: dict
+            attrs:
+              - variable: type
+                label: Type
+                description: |
+                  ixVolume: Is dataset created automatically by the system.</br>
+                  Host Path: Is a path that already exists on the system.
+                schema:
+                  type: string
+                  required: true
+                  default: ixVolume
+                  enum:
+                    - value: hostPath
+                      description: Host Path (Path that already exists on the system)
+                    - value: ixVolume
+                      description: ixVolume (Dataset created automatically by the system)
+              - variable: datasetName
+                label: Dataset Name
+                schema:
+                  type: string
+                  show_if: [["type", "=", "ixVolume"]]
+                  required: true
+                  hidden: true
+                  immutable: true
+                  default: pgBackup
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+
+        - variable: additionalStorages
+          label: Additional Storage
+          description: Additional storage for Paperless-ngx.
+          schema:
+            type: list
+            default: []
+            items:
+              - variable: storageEntry
+                label: Storage Entry
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: type
+                      label: Type
+                      description: |
+                        ixVolume: Is dataset created automatically by the system.</br>
+                        Host Path: Is a path that already exists on the system.
+                      schema:
+                        type: string
+                        required: true
+                        default: "ixVolume"
+                        enum:
+                          - value: "hostPath"
+                            description: Host Path (Path that already exists on the system)
+                          - value: "ixVolume"
+                            description: ixVolume (Dataset created automatically by the system)
+                    - variable: mountPath
+                      label: Mount Path
+                      description: The path inside the container to mount the storage.
+                      schema:
+                        type: path
+                        required: true
+                    - variable: hostPath
+                      label: Host Path
+                      description: The host path to use for storage.
+                      schema:
+                        type: hostpath
+                        show_if: [["type", "=", "hostPath"]]
+                        required: true
+                    - variable: datasetName
+                      label: Dataset Name
+                      description: The name of the dataset to use for storage.
+                      schema:
+                        type: string
+                        show_if: [["type", "=", "ixVolume"]]
+                        required: true
+                        immutable: true
+                        default: "storage_entry"
+                        $ref:
+                          - "normalize/ixVolume"
+
+  - variable: resources
+    group: Resources Configuration
+    label: ""
+    schema:
+      type: dict
+      attrs:
+        - variable: limits
+          label: Limits
+          schema:
+            type: dict
+            attrs:
+              - variable: cpu
+                label: CPU
+                description: CPU limit for Paperless-ngx.
+                schema:
+                  type: string
+                  max_length: 6
+                  valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$'
+                  valid_chars_error: |
+                    Valid CPU limit formats are</br>
+                    - Plain Integer - eg. 1</br>
+                    - Float - eg. 0.5</br>
+                    - Milicpu - eg. 500m
+                  default: "4000m"
+                  required: true
+              - variable: memory
+                label: Memory
+                description: Memory limit for Paperless-ngx.
+                schema:
+                  type: string
+                  max_length: 12
+                  valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$'
+                  valid_chars_error: |
+                    Valid Memory limit formats are</br>
+                    - Suffixed with E/P/T/G/M/K - eg. 1G</br>
+                    - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi</br>
+                    - Plain Integer in bytes - eg. 1024</br>
+                    - Exponent - eg. 134e6
+                  default: "8Gi"
+                  required: true

+ 1 - 0
library/ix-dev/community/paperless-ngx/templates/NOTES.txt

@@ -0,0 +1 @@
+{{ include "ix.v1.common.lib.chart.notes" $ }}

+ 77 - 0
library/ix-dev/community/paperless-ngx/templates/_configuration.tpl

@@ -0,0 +1,77 @@
+{{- define "paperless.configuration" -}}
+  {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
+
+  {{- $dbHost := (printf "%s-postgres" $fullname) -}}
+  {{- $dbUser := "paperless" -}}
+  {{- $dbName := "paperless" -}}
+
+  {{- $dbPass := randAlphaNum 32 -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-postgres-creds" $fullname)) -}}
+    {{- $dbPass = ((index .data "POSTGRES_PASSWORD") | b64dec) -}}
+  {{- end -}}
+
+  {{/* Temporary set dynamic db details on values,
+  so we can print them on the notes */}}
+  {{- $_ := set .Values "paperlessDbPass" $dbPass -}}
+  {{- $_ := set .Values "paperlessDbHost" $dbHost -}}
+
+  {{- $redisHost := (printf "%s-redis" $fullname) -}}
+
+  {{- $redisPass := randAlphaNum 32 -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-redis-creds" $fullname)) -}}
+    {{- $redisPass = ((index .data "REDIS_PASSWORD") | b64dec) -}}
+  {{- end -}}
+
+  {{- $dbURL := (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" $dbUser $dbPass $dbHost $dbName) -}}
+
+  {{- $secretKey := randAlphaNum 32 -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-paperless-creds" $fullname)) -}}
+    {{- $secretKey = ((index .data "PAPERLESS_SECRET_KEY") | b64dec) -}}
+  {{- end }}
+
+configmap:
+  paperless-config:
+    enabled: true
+    data:
+      PAPERLESS_TIME_ZONE: {{ .Values.TZ }}
+      PAPERLESS_BIND_ADDR: "0.0.0.0"
+      PAPERLESS_PORT: {{ .Values.paperlessNetwork.webPort | quote }}
+      USERMAP_UID: {{ .Values.paperlessID.user | quote }}
+      USERMAP_GID: {{ .Values.paperlessID.group | quote }}
+      PAPERLESS_DATA_DIR: /usr/src/paperless/data
+      PAPERLESS_MEDIA_ROOT: /usr/src/paperless/media
+      PAPERLESS_CONSUMPTION_DIR: /usr/src/paperless/consume
+      PAPERLESS_TRASH_DIR: {{ ternary "/usr/src/paperless/trash" nil .Values.paperlessConfig.enableTrash }}
+
+secret:
+  postgres-creds:
+    enabled: true
+    data:
+      POSTGRES_USER: {{ $dbUser }}
+      POSTGRES_DB: {{ $dbName }}
+      POSTGRES_PASSWORD: {{ $dbPass }}
+      POSTGRES_HOST: {{ $dbHost }}
+      POSTGRES_URL: {{ $dbURL }}
+
+  redis-creds:
+    enabled: true
+    data:
+      ALLOW_EMPTY_PASSWORD: "no"
+      REDIS_PASSWORD: {{ $redisPass }}
+      REDIS_HOST: {{ $redisHost }}
+
+  paperless-creds:
+    enabled: true
+    data:
+      PAPERLESS_SECRET_KEY: {{ $secretKey }}
+      PAPERLESS_ADMIN_USER: {{ .Values.paperlessConfig.adminUser }}
+      PAPERLESS_ADMIN_MAIL: {{ .Values.paperlessConfig.adminMail }}
+      PAPERLESS_ADMIN_PASSWORD: {{ .Values.paperlessConfig.adminPassword }}
+      PAPERLESS_DBENGINE: postgresql
+      PAPERLESS_DBHOST: {{ $dbHost }}
+      PAPERLESS_DBPORT: "5432"
+      PAPERLESS_DBNAME: {{ $dbName }}
+      PAPERLESS_DBUSER: {{ $dbUser }}
+      PAPERLESS_DBPASS: {{ $dbPass }}
+      PAPERLESS_REDIS:  {{ printf "redis://default:%s@%s:6379" $redisPass $redisHost }}
+{{- end -}}

+ 67 - 0
library/ix-dev/community/paperless-ngx/templates/_paperless.tpl

@@ -0,0 +1,67 @@
+{{- define "paperless.workload" -}}
+workload:
+  paperless:
+    enabled: true
+    primary: true
+    type: Deployment
+    podSpec:
+      hostNetwork: {{ .Values.paperlessNetwork.hostNetwork }}
+      containers:
+        paperless:
+          enabled: true
+          primary: true
+          imageSelector: image
+          securityContext:
+            runAsUser: 0
+            runAsGroup: 0
+            runAsNonRoot: false
+            readOnlyRootFilesystem: false
+            capabilities:
+              add:
+                - CHOWN
+                - DAC_OVERRIDE
+                - FOWNER
+                - SETGID
+                - SETUID
+          envFrom:
+            - secretRef:
+                name: paperless-creds
+            - configMapRef:
+                name: paperless-config
+          {{ with .Values.paperlessConfig.additionalEnvs }}
+          envList:
+            {{ range $env := . }}
+            - name: {{ $env.name }}
+              value: {{ $env.value }}
+            {{ end }}
+          {{ end }}
+          probes:
+            liveness:
+              enabled: true
+              type: http
+              port: {{ .Values.paperlessNetwork.webPort }}
+              path: /
+            readiness:
+              enabled: true
+              type: http
+              port: {{ .Values.paperlessNetwork.webPort }}
+              path: /
+            startup:
+              enabled: true
+              type: http
+              port: {{ .Values.paperlessNetwork.webPort }}
+              path: /
+      initContainers:
+      {{- if .Values.paperlessConfig.enableTrash }}
+        {{/* Paperless entrypoint never chowns the trash and fails if the permissions are wrong */}}
+        {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
+                                                          "UID" .Values.paperlessID.user
+                                                          "GID" .Values.paperlessID.group
+                                                          "mode" "check"
+                                                          "type" "init") | nindent 8 }}
+      {{- end }}
+      {{- include "ix.v1.common.app.redisWait" (dict  "name" "02-redis-wait"
+                                                      "secretName" "redis-creds") | nindent 8 }}
+      {{- include "ix.v1.common.app.postgresWait" (dict "name" "03-postgres-wait"
+                                                        "secretName" "postgres-creds") | nindent 8 }}
+{{- end -}}

+ 90 - 0
library/ix-dev/community/paperless-ngx/templates/_persistence.tpl

@@ -0,0 +1,90 @@
+{{- define "paperless.persistence" -}}
+persistence:
+  data:
+    enabled: true
+    type: {{ .Values.paperlessStorage.data.type }}
+    datasetName: {{ .Values.paperlessStorage.data.datasetName | default "" }}
+    hostPath: {{ .Values.paperlessStorage.data.hostPath | default "" }}
+    targetSelector:
+      paperless:
+        paperless:
+          mountPath: /usr/src/paperless/data
+  media:
+    enabled: true
+    type: {{ .Values.paperlessStorage.media.type }}
+    datasetName: {{ .Values.paperlessStorage.media.datasetName | default "" }}
+    hostPath: {{ .Values.paperlessStorage.media.hostPath | default "" }}
+    targetSelector:
+      paperless:
+        paperless:
+          mountPath: /usr/src/paperless/media
+  consume:
+    enabled: true
+    type: {{ .Values.paperlessStorage.consume.type }}
+    datasetName: {{ .Values.paperlessStorage.consume.datasetName | default "" }}
+    hostPath: {{ .Values.paperlessStorage.consume.hostPath | default "" }}
+    targetSelector:
+      paperless:
+        paperless:
+          mountPath: /usr/src/paperless/consume
+  trash:
+    enabled: true
+    type: {{ .Values.paperlessStorage.trash.type }}
+    datasetName: {{ .Values.paperlessStorage.trash.datasetName | default "" }}
+    hostPath: {{ .Values.paperlessStorage.trash.hostPath | default "" }}
+    targetSelector:
+      paperless:
+        paperless:
+          mountPath: /usr/src/paperless/trash
+        01-permissions:
+          mountPath: /mnt/directories/trash
+  tmp:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      paperless:
+        paperless:
+          mountPath: /tmp
+  {{- range $idx, $storage := .Values.paperlessStorage.additionalStorages }}
+  {{ printf "paperless-%v" (int $idx) }}:
+    enabled: true
+    type: {{ $storage.type }}
+    datasetName: {{ $storage.datasetName | default "" }}
+    hostPath: {{ $storage.hostPath | default "" }}
+    targetSelector:
+      paperless:
+        paperless:
+          mountPath: {{ $storage.mountPath }}
+  {{- end }}
+
+  postgresdata:
+    enabled: true
+    type: {{ .Values.paperlessStorage.pgData.type }}
+    datasetName: {{ .Values.paperlessStorage.pgData.datasetName | default "" }}
+    hostPath: {{ .Values.paperlessStorage.pgData.hostPath | default "" }}
+    targetSelector:
+      # Postgres pod
+      postgres:
+        # Postgres container
+        postgres:
+          mountPath: /var/lib/postgresql/data
+        # Postgres - Permissions container
+        # Different than the 01-permissions
+        permissions:
+          mountPath: /mnt/directories/postgres_data
+  postgresbackup:
+    enabled: true
+    type: {{ .Values.paperlessStorage.pgBackup.type }}
+    datasetName: {{ .Values.paperlessStorage.pgBackup.datasetName | default "" }}
+    hostPath: {{ .Values.paperlessStorage.pgBackup.hostPath | default "" }}
+    targetSelector:
+      # Postgres backup pod
+      postgresbackup:
+        # Postgres backup container
+        postgresbackup:
+          mountPath: /postgres_backup
+        # Postgres - Permissions container
+        # Different than the 01-permissions
+        permissions:
+          mountPath: /mnt/directories/postgres_backup
+{{- end -}}

+ 12 - 0
library/ix-dev/community/paperless-ngx/templates/_portal.tpl

@@ -0,0 +1,12 @@
+{{- define "paperless.portal" -}}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: portal
+data:
+  path: "/"
+  port: {{ .Values.paperlessNetwork.webPort | quote }}
+  protocol: http
+  host: $node_ip
+{{- end -}}

+ 6 - 0
library/ix-dev/community/paperless-ngx/templates/_postgres.tpl

@@ -0,0 +1,6 @@
+{{- define "postgres.workload" -}}
+workload:
+{{- include "ix.v1.common.app.postgres" (dict "secretName" "postgres-creds"
+                                              "resources" .Values.resources
+                                              "ixChartContext" .Values.ixChartContext) | nindent 2 }}
+{{- end -}}

+ 5 - 0
library/ix-dev/community/paperless-ngx/templates/_redis.tpl

@@ -0,0 +1,5 @@
+{{- define "redis.workload" -}}
+workload:
+{{- include "ix.v1.common.app.redis" (dict  "secretName" "redis-creds"
+                                            "resources" .Values.resources) | nindent 2 }}
+{{- end -}}

+ 39 - 0
library/ix-dev/community/paperless-ngx/templates/_service.tpl

@@ -0,0 +1,39 @@
+{{- define "paperless.service" -}}
+service:
+  paperless:
+    enabled: true
+    primary: true
+    type: NodePort
+    targetSelector: paperless
+    ports:
+      webui:
+        enabled: true
+        primary: true
+        port: {{ .Values.paperlessNetwork.webPort }}
+        nodePort: {{ .Values.paperlessNetwork.webPort }}
+        targetSelector: paperless
+
+  redis:
+    enabled: true
+    type: ClusterIP
+    targetSelector: redis
+    ports:
+      redis:
+        enabled: true
+        primary: true
+        port: 6379
+        targetPort: 6379
+        targetSelector: redis
+
+  postgres:
+    enabled: true
+    type: ClusterIP
+    targetSelector: postgres
+    ports:
+      postgres:
+        enabled: true
+        primary: true
+        port: 5432
+        targetPort: 5432
+        targetSelector: postgres
+{{- end -}}

+ 14 - 0
library/ix-dev/community/paperless-ngx/templates/common.yaml

@@ -0,0 +1,14 @@
+{{- include "ix.v1.common.loader.init" . -}}
+
+{{/* Merge the templates with Values */}}
+{{- $_ := mustMergeOverwrite .Values (include "paperless.service" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "paperless.configuration" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "paperless.persistence" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "paperless.workload" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "postgres.workload" $ | fromYaml) -}}
+{{- $_ := mustMergeOverwrite .Values (include "redis.workload" $ | fromYaml) -}}
+
+{{/* Create the configmap for portal manually*/}}
+{{- include "paperless.portal" $ -}}
+
+{{- include "ix.v1.common.loader.apply" . -}}

+ 1 - 0
library/ix-dev/community/paperless-ngx/upgrade_info.json

@@ -0,0 +1 @@
+{"filename": "values.yaml", "keys": ["image"]}

+ 31 - 0
library/ix-dev/community/paperless-ngx/upgrade_strategy

@@ -0,0 +1,31 @@
+#!/usr/bin/python3
+import json
+import re
+import sys
+
+from catalog_update.upgrade_strategy import semantic_versioning
+
+
+RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+')
+
+
+def newer_mapping(image_tags):
+    key = list(image_tags.keys())[0]
+    tags = {t: t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)}
+    version = semantic_versioning(list(tags))
+    if not version:
+        return {}
+
+    return {
+        'tags': {key: tags[version]},
+        'app_version': version,
+    }
+
+
+if __name__ == '__main__':
+    try:
+        versions_json = json.loads(sys.stdin.read())
+    except ValueError:
+        raise ValueError('Invalid json specified')
+
+    print(json.dumps(newer_mapping(versions_json)))

+ 63 - 0
library/ix-dev/community/paperless-ngx/values.yaml

@@ -0,0 +1,63 @@
+image:
+  repository: paperlessngx/paperless-ngx
+  pullPolicy: IfNotPresent
+  tag: 1.17.4
+
+resources:
+  limits:
+    cpu: 4000m
+    memory: 8Gi
+
+paperlessConfig:
+  adminUser: ''
+  adminPassword: ''
+  adminMail: ''
+  enableTrash: true
+  additionalEnvs: []
+
+paperlessNetwork:
+  webPort: 30070
+  hostNetwork: false
+
+paperlessID:
+  user: 568
+  group: 568
+
+paperlessStorage:
+  data:
+    type: ixVolume
+    datasetName: data
+  media:
+    type: ixVolume
+    datasetName: media
+  consume:
+    type: ixVolume
+    datasetName: consume
+  trash:
+    type: ixVolume
+    datasetName: trash
+  pgData:
+    type: ixVolume
+    datasetName: pgData
+  pgBackup:
+    type: ixVolume
+    datasetName: pgBackup
+  additionalStorages: []
+
+notes:
+  custom: |
+    ## Database
+    You can connect to the database using the pgAdmin App from the catalog
+
+    <details>
+      <summary>Database Details</summary>
+
+      - Database: `paperless`
+      - Username: `paperless`
+      - Password: `{{ .Values.paperlessDbPass }}`
+      - Host:     `{{ .Values.paperlessDbHost }}.{{ .Release.Namespace }}.svc.cluster.local`
+      - Port:     `5432`
+
+    </details>
+    {{- $_ := unset .Values "paperlessDbPass" }}
+    {{- $_ := unset .Values "paperlessDbHost" }}