From db4132275deb87176a1ac85f63b46b0875935d12 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Mon, 3 Jul 2023 16:26:49 -0400 Subject: [PATCH] migrate(photoview) migrate photoview to new common (#10086) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** clean up the gui, migrated to new common, added the cache storage option to the gui. ⚒️ Fixes # **⚙️ 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._ --- charts/incubator/photoview/Chart.yaml | 8 +--- .../photoview/docs/installation_notes.md | 1 - charts/incubator/photoview/questions.yaml | 30 ++++++++---- .../incubator/photoview/templates/NOTES.txt | 1 + .../photoview/templates/_secrets.tpl | 6 +++ .../incubator/photoview/templates/common.yaml | 12 ++++- charts/incubator/photoview/values.yaml | 46 +++++++++++-------- 7 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 charts/incubator/photoview/templates/NOTES.txt create mode 100644 charts/incubator/photoview/templates/_secrets.tpl diff --git a/charts/incubator/photoview/Chart.yaml b/charts/incubator/photoview/Chart.yaml index 0c47af3bbfd..a1ffb9921cd 100644 --- a/charts/incubator/photoview/Chart.yaml +++ b/charts/incubator/photoview/Chart.yaml @@ -3,11 +3,7 @@ appVersion: "2.3.13" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 - - condition: postgresql.enabled - name: postgresql - repository: https://deps.truecharts.org/ - version: 11.0.31 + version: 12.14.6 description: Photoview is a simple and user-friendly photo gallery. home: https://truecharts.org/charts/incubator/photoview icon: https://truecharts.org/img/hotlink-ok/chart-icons/photoview.png @@ -23,7 +19,7 @@ name: photoview sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/photoview - https://github.com/photoview/photoview -version: 8.0.0 +version: 9.0.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/photoview/docs/installation_notes.md b/charts/incubator/photoview/docs/installation_notes.md index 00ff131e580..e0c23938eda 100644 --- a/charts/incubator/photoview/docs/installation_notes.md +++ b/charts/incubator/photoview/docs/installation_notes.md @@ -7,7 +7,6 @@ Under `Security and Permissions` - Check `Show Advanced Security Settings` - Uncheck `ReadOnly Root Filesystem` - - Uncheck `runAsNonRoot` Under `Pod Security Context` diff --git a/charts/incubator/photoview/questions.yaml b/charts/incubator/photoview/questions.yaml index ea8ca1d83ab..060a193e867 100644 --- a/charts/incubator/photoview/questions.yaml +++ b/charts/incubator/photoview/questions.yaml @@ -11,8 +11,6 @@ questions: # Include{podSpec} # Include{containerMain} - - # Docker specific env - variable: env group: "App Configuration" label: "Image Environment" @@ -26,6 +24,7 @@ questions: schema: type: string default: "" + private: true - variable: PHOTOVIEW_DISABLE_FACE_RECOGNITION label: "Disable Face Recognition" description: "Completely disable face recognition and hide the icon from the side menu." @@ -44,18 +43,21 @@ questions: schema: type: boolean default: false + - variable: PHOTOVIEW_LISTEN_IP + label: PhotoView Listen IP + schema: + type: string + required: true + $ref: + - definitions/nodeIP + # Include{containerBasic} # Include{containerAdvanced} + # Include{containerConfig} # Include{podOptions} # Include{serviceRoot} - - variable: main - label: "Main Service" - description: "The Primary service on which the healthcheck runs, often the webUI" - schema: - additional_attrs: true - type: dict - attrs: +# Include{serviceMain} # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: main @@ -75,8 +77,16 @@ questions: # Include{serviceExpert} # Include{serviceList} # Include{persistenceRoot} + - variable: cache + label: "App Cache Storage" + description: "Stores the Application Cache." + schema: + additional_attrs: true + type: dict + attrs: +# Include{persistenceBasic} - variable: photos - label: "Photos Storage" + label: "App Photos Storage" description: "Stores the Application Photos." schema: additional_attrs: true diff --git a/charts/incubator/photoview/templates/NOTES.txt b/charts/incubator/photoview/templates/NOTES.txt new file mode 100644 index 00000000000..efcb74cb772 --- /dev/null +++ b/charts/incubator/photoview/templates/NOTES.txt @@ -0,0 +1 @@ +{{- include "tc.v1.common.lib.chart.notes" $ -}} diff --git a/charts/incubator/photoview/templates/_secrets.tpl b/charts/incubator/photoview/templates/_secrets.tpl new file mode 100644 index 00000000000..85d0784fcf7 --- /dev/null +++ b/charts/incubator/photoview/templates/_secrets.tpl @@ -0,0 +1,6 @@ +{{/* Define the secrets */}} +{{- define "photoview.secrets" -}} +enabled: true +data: + PHOTOVIEW_POSTGRES_URL: {{ (printf "%s?client_encoding=utf8" (.Values.cnpg.main.creds.std | trimAll "\"")) | quote }} +{{- end -}} diff --git a/charts/incubator/photoview/templates/common.yaml b/charts/incubator/photoview/templates/common.yaml index c1a366e1cf0..aa1c92cea2f 100644 --- a/charts/incubator/photoview/templates/common.yaml +++ b/charts/incubator/photoview/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . }} + +{{/* Render secrets for photoview */}} +{{- $secrets := include "photoview.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "secrets" $secrets -}} +{{- end -}} + +{{/* Render the templates */}} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/photoview/values.yaml b/charts/incubator/photoview/values.yaml index 907317c6df1..b3baa711ff7 100644 --- a/charts/incubator/photoview/values.yaml +++ b/charts/incubator/photoview/values.yaml @@ -3,25 +3,30 @@ image: tag: 2.3.13@sha256:2df4e8e7a7f9b15e7d4af8d3b85d20c37434cb8503f04f48c50d30f1982a757b pullPolicy: IfNotPresent -env: - PHOTOVIEW_DATABASE_DRIVER: "postgres" - PHOTOVIEW_LISTEN_PORT: "{{ .Values.service.main.ports.main.targetPort }}" - PHOTOVIEW_MEDIA_CACHE: "/cache" - MAPBOX_TOKEN: "" - PHOTOVIEW_DISABLE_FACE_RECOGNITION: false - PHOTOVIEW_DISABLE_VIDEO_ENCODING: false - PHOTOVIEW_DISABLE_RAW_PROCESSING: false - PHOTOVIEW_POSTGRES_URL: - secretKeyRef: - name: dbcreds - key: url - service: main: ports: main: port: 10159 - targetPort: 10159 + +workload: + main: + podSpec: + containers: + main: + env: + PHOTOVIEW_LISTEN_PORT: "{{ .Values.service.main.ports.main.port }}" + PHOTOVIEW_LISTEN_IP: "127.0.0.1" + PHOTOVIEW_DATABASE_DRIVER: "postgres" + PHOTOVIEW_MEDIA_CACHE: "/cache" + MAPBOX_TOKEN: "" + PHOTOVIEW_DISABLE_FACE_RECOGNITION: false + PHOTOVIEW_DISABLE_VIDEO_ENCODING: false + PHOTOVIEW_DISABLE_RAW_PROCESSING: false + PHOTOVIEW_POSTGRES_URL: + secretKeyRef: + name: secrets + key: PHOTOVIEW_POSTGRES_URL persistence: # Don't use emptyDir, it stores, thumbnails and optimized media @@ -32,11 +37,12 @@ persistence: enabled: true mountPath: "/photos" -postgresql: - enabled: true - existingSecret: "dbcreds" - postgresqlUsername: photoview - postgresqlDatabase: photoview +cnpg: + main: + enabled: true + user: photoview + database: photoview portal: - enabled: true + open: + enabled: true