fix(papermerge) fix papermerge secret key and added cnpg **BREAKING CHANGES** (#10901)

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?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ 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>
This commit is contained in:
Xstar97TheNoob
2023-08-30 16:25:29 -04:00
committed by GitHub
parent 6e06d67a08
commit 385db67dce
5 changed files with 122 additions and 37 deletions

View File

@@ -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"

View File

@@ -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}

View File

@@ -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 -}}

View File

@@ -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" . }}

View File

@@ -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