From 385db67dcef67fa258b8a8749213f359ea943a11 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Wed, 30 Aug 2023 16:25:29 -0400 Subject: [PATCH] fix(papermerge) fix papermerge secret key and added cnpg **BREAKING CHANGES** (#10901) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the missing Secret key and added postgres/cnpg support. added super email, user, and password. ⚒️ Fixes #10894 **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [X] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/stable/papermerge/Chart.yaml | 33 ++++----- charts/stable/papermerge/questions.yaml | 29 ++++++++ .../stable/papermerge/templates/_secrets.tpl | 13 ++++ .../stable/papermerge/templates/common.yaml | 12 +++- charts/stable/papermerge/values.yaml | 72 +++++++++++++------ 5 files changed, 122 insertions(+), 37 deletions(-) create mode 100644 charts/stable/papermerge/templates/_secrets.tpl diff --git a/charts/stable/papermerge/Chart.yaml b/charts/stable/papermerge/Chart.yaml index 6bf69f89571..1a334d37e38 100644 --- a/charts/stable/papermerge/Chart.yaml +++ b/charts/stable/papermerge/Chart.yaml @@ -1,30 +1,31 @@ apiVersion: v2 -kubeVersion: ">=1.16.0-0" -name: papermerge -version: 8.0.0 appVersion: "2.1.9" -description: Papermerge is an open source document management system (DMS) primarily designed for archiving and retrieving your digital documents. -type: application +dependencies: + - name: common + repository: https://library-charts.truecharts.org + version: 14.0.3 + - condition: redis.enabled + name: redis + repository: https://deps.truecharts.org + version: 7.0.6 deprecated: false +description: Papermerge is an open source document management system (DMS) primarily designed for archiving and retrieving your digital documents. home: https://truecharts.org/charts/stable/papermerge icon: https://truecharts.org/img/hotlink-ok/chart-icons/papermerge.png keywords: - papermerge -sources: - - https://github.com/truecharts/charts/tree/master/charts/stable/papermerge -dependencies: - - name: common - repository: https://library-charts.truecharts.org - version: 14.0.1 - - condition: redis.enabled - name: redis - repository: https://deps.truecharts.org - version: 6.0.66 +kubeVersion: ">=1.16.0-0" maintainers: - email: info@truecharts.org name: TrueCharts url: https://truecharts.org +name: papermerge +sources: + - https://github.com/truecharts/charts/tree/master/charts/stable/papermerge + - https://github.com/ciur/papermerge +type: application +version: 8.0.0 annotations: truecharts.org/catagories: | - - incubator + - media truecharts.org/SCALE-support: "true" diff --git a/charts/stable/papermerge/questions.yaml b/charts/stable/papermerge/questions.yaml index 263d3cbf653..bebeb1b202c 100644 --- a/charts/stable/papermerge/questions.yaml +++ b/charts/stable/papermerge/questions.yaml @@ -11,6 +11,35 @@ questions: # Include{podSpec} # Include{containerMain} + - variable: env + group: App Configuration + label: Image Environment + schema: + additional_attrs: true + type: dict + attrs: + - variable: DJANGO_SUPERUSER_EMAIL + label: SuperUser Email + description: Admin email + schema: + type: string + required: true + default: "" + - variable: DJANGO_SUPERUSER_USENAME + label: SuperUser UserName + description: Admin user + schema: + type: string + required: true + default: "" + - variable: DJANGO_SUPERUSER_PASSWORD + label: SuperUser Password + description: Admin Password + schema: + type: string + required: true + private: true + default: "" # Include{containerBasic} # Include{containerAdvanced} diff --git a/charts/stable/papermerge/templates/_secrets.tpl b/charts/stable/papermerge/templates/_secrets.tpl new file mode 100644 index 00000000000..fd487f1756a --- /dev/null +++ b/charts/stable/papermerge/templates/_secrets.tpl @@ -0,0 +1,13 @@ +{{/* Define the secrets */}} +{{- define "papermerge.secrets" -}} + +{{- $secretName := (printf "%s-papermerge-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) -}} + +{{- $pass_key := randAlphaNum 32 -}} +{{- with (lookup "v1" "Secret" .Release.Namespace $secretName) -}} + {{- $pass_key = index .data "PAPERMERGE__MAIN__SECRET_KEY" | b64dec -}} +{{- end }} +enabled: true +data: + PAPERMERGE__MAIN__SECRET_KEY: {{ $pass_key }} +{{- end -}} diff --git a/charts/stable/papermerge/templates/common.yaml b/charts/stable/papermerge/templates/common.yaml index b51394e00a4..160e3605390 100644 --- a/charts/stable/papermerge/templates/common.yaml +++ b/charts/stable/papermerge/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . }} + +{{/* Render secrets for papermerge */}} +{{- $secrets := include "papermerge.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "papermerge-secrets" $secrets -}} +{{- end -}} + +{{/* Render the templates */}} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/stable/papermerge/values.yaml b/charts/stable/papermerge/values.yaml index 6918640db47..6c80e8feef3 100644 --- a/charts/stable/papermerge/values.yaml +++ b/charts/stable/papermerge/values.yaml @@ -2,39 +2,71 @@ image: repository: tccr.io/truecharts/papermerge pullPolicy: IfNotPresent tag: v2.1.9@sha256:b87fe0209a685badebab23d678ea8c9a5aba799df413c73f3c4ad40ade629574 -service: - main: - ports: - main: - targetPort: 8000 - port: 10141 -persistence: - config: - enabled: true - mountPath: "/config" - varrun: - enabled: true -redis: - enabled: true - redisUsername: papermerge -portal: - open: - enabled: true securityContext: container: runAsNonRoot: false readOnlyRootFilesystem: false runAsUser: 0 runAsGroup: 0 + +service: + main: + ports: + main: + targetPort: 8000 + port: 10141 + workload: main: podSpec: containers: main: env: - REDIS_URL: + PAPERMERGE__MAIN__TIMEZONE: "{{ .Values.TZ }}" + DJANGO_SUPERUSER_EMAIL: admin@example.com + DJANGO_SUPERUSER_USENAME: admin + DJANGO_SUPERUSER_PASSWORD: my_admin_password123 + PAPERMERGE__MAIN__SECRET_KEY: + secretKeyRef: + name: papermerge-secrets + key: PAPERMERGE__MAIN__SECRET_KEY + PAPERMERGE__DATABASE__TYPE: postgres + PAPERMERGE__DATABASE__NAME: "{{ .Values.cnpg.main.database }}" + PAPERMERGE__DATABASE__USER: "{{ .Values.cnpg.main.user }}" + PAPERMERGE__DATABASE__PORT: 5432 + PAPERMERGE__DATABASE__HOST: + secretKeyRef: + name: cnpg-main-urls + key: host + PAPERMERGE__DATABASE__PASSWORD: + secretKeyRef: + name: cnpg-main-user + key: password + PAPERMERGE__REDIS__PORT: 6379 + PAPERMERGE__REDIS__HOST: secretKeyRef: expandObjectName: false name: '{{ printf "%s-%s" .Release.Name "rediscreds" }}' - key: url + key: plainhost + +persistence: + config: + enabled: true + mountPath: "/config" + varrun: + enabled: true + +redis: + enabled: true + redisUsername: papermerge + +cnpg: + main: + enabled: true + user: papermerge + database: papermerge + +portal: + open: + enabled: true