Эх сурвалжийг харах

NAS-123824 / 24.04 / add `piwigo` to `community` train (#1494)

* add `piwigo` to `community` train

* update keywords

* update readme

* typo

* add initial templtes

* add values

* add config and Ui

* add deployment

* simplify

* only on install

* hmm

* add some validation and update description
Stavros Kois 1 жил өмнө
parent
commit
ddcd308d34

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

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../common
+  version: 1.1.0
+digest: sha256:752ce76025f5b61094bd2b18ca11693eb9d26d0dde4eb2e63cd2330cbffe9e73
+generated: "2023-08-30T16:50:36.550048634+03:00"

+ 25 - 0
library/ix-dev/community/piwigo/Chart.yaml

@@ -0,0 +1,25 @@
+name: piwigo
+description: Piwigo is a photo gallery software for the web that comes with powerful features to publish and manage your collection of pictures.
+annotations:
+  title: Piwigo
+type: application
+version: 1.0.0
+apiVersion: v2
+appVersion: 13.8.0
+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.0
+home: https://piwigo.org
+icon: https://piwigo.org/plugins/piwigo-piwigodotorg/images/piwigo.org.svg
+sources:
+  - https://hub.docker.com/r/linuxserver/piwigo
+  - https://github.com/truenas/charts/tree/master/community/piwigo
+keywords:
+  - gallery
+  - photo

+ 13 - 0
library/ix-dev/community/piwigo/README.md

@@ -0,0 +1,13 @@
+# Piwigo
+
+[Piwigo](https://piwigo.org/) is a photo gallery software for the web that comes with powerful features to
+publish and manage your collection of pictures.
+
+> When application is installed, a container will be launched with **root** privileges.
+> This is required in order to apply the correct permissions to the `mariadb` directories.
+> Afterwards `mariadb` will start as a **non**-root user (`999`).>
+> On each upgrade, a container will be launched with **root** privileges in order to
+> apply the correct permissions to the `mariadb` **backups** directory.
+> Container that performs the backup will run as a **non**-root user (`999`) afterwards.
+> Keep in mind the permissions on the backup directory will be changed to `999:999` on **every** update.
+> But will only be changed once for the `mariadb` data directories.

+ 13 - 0
library/ix-dev/community/piwigo/app-readme.md

@@ -0,0 +1,13 @@
+# Piwigo
+
+[Piwigo](https://piwigo.org/) is a photo gallery software for the web that comes with powerful features to
+publish and manage your collection of pictures.
+
+> When application is installed, a container will be launched with **root** privileges.
+> This is required in order to apply the correct permissions to the `mariadb` directories.
+> Afterwards `mariadb` will start as a **non**-root user (`999`).>
+> On each upgrade, a container will be launched with **root** privileges in order to
+> apply the correct permissions to the `mariadb` **backups** directory.
+> Container that performs the backup will run as a **non**-root user (`999`) afterwards.
+> Keep in mind the permissions on the backup directory will be changed to `999:999` on **every** update.
+> But will only be changed once for the `mariadb` data directories.

BIN
library/ix-dev/community/piwigo/charts/common-1.1.0.tgz


+ 26 - 0
library/ix-dev/community/piwigo/ci/basic-values.yaml

@@ -0,0 +1,26 @@
+piwiNetwork:
+  webPort: 31000
+
+piwiConfig:
+  language: en_GB
+  adminName: admin
+  adminMail: admin@example.com
+  adminPass: admin
+
+piwiID:
+  user: 1000
+  group: 1000
+
+piwiStorage:
+  config:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/config
+  gallery:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/gallery
+  mariadbData:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbData
+  mariadbBackup:
+    type: hostPath
+    hostPath: /mnt/{{ .Release.Name }}/mariadbBackup

+ 9 - 0
library/ix-dev/community/piwigo/item.yaml

@@ -0,0 +1,9 @@
+icon_url: https://piwigo.org/plugins/piwigo-piwigodotorg/images/piwigo.org.svg
+categories:
+  - media
+screenshots:
+  - https://piwigo.org/plugins/piwigo-piwigodotorg/images/features/features-hosting.jpg
+  - https://piwigo.org/plugins/piwigo-piwigodotorg/images/features/piwigo-features-batch-manager.jpg
+tags:
+  - photo
+  - gallery

+ 20 - 0
library/ix-dev/community/piwigo/metadata.yaml

@@ -0,0 +1,20 @@
+runAsContext:
+  - userName: root
+    groupName: root
+    gid: 0
+    uid: 0
+    description: Piwigo run as root user
+capabilities:
+  - name: CHOWN
+    description: Piwigo is able to chown files.
+  - name: DAC_OVERRIDE
+    description: Piwigo is able to bypass permission checks.
+  - name: FOWNER
+    description: Piwigo is able bypass permission checks for it's sub-processes.
+  - name: NET_BIND_SERVICE
+    description: Piwigo requires this ability to bind to port 80 within the container.
+  - name: SETGID
+    description: Piwigo is able to set group ID for it's sub-processes.
+  - name: SETUID
+    description: Piwigo is able to set user ID for it's sub-processes.
+hostMounts: []

+ 526 - 0
library/ix-dev/community/piwigo/questions.yaml

@@ -0,0 +1,526 @@
+groups:
+  - name: Piwigo Configuration
+    description: Configure Piwigo
+  - name: User and Group Configuration
+    description: Configure User and Group for Piwigo
+  - name: Network Configuration
+    description: Configure Network for Piwigo
+  - name: Storage Configuration
+    description: Configure Storage for Piwigo
+  - name: Resources Configuration
+    description: Configure Resources for Piwigo
+
+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: piwiConfig
+    label: ""
+    group: Piwigo Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: adminName
+          label: Admin Name
+          description: |
+            The admin name for Piwigo.</br>
+            Only used when Piwigo is first installed.</br>
+            You can change it later in the Piwigo WebUI.
+          schema:
+            type: string
+            required: true
+            immutable: true
+            default: ""
+        - variable: adminMail
+          label: Admin Mail
+          description: |
+            The admin mail for Piwigo.</br>
+            Only used when Piwigo is first installed.</br>
+            You can change it later in the Piwigo WebUI.
+          schema:
+            type: string
+            required: true
+            immutable: true
+            default: ""
+        - variable: adminPass
+          label: Admin Password
+          description: |
+            The admin password for Piwigo.</br>
+            Only used when Piwigo is first installed.</br>
+            You can change it later in the Piwigo WebUI.
+          schema:
+            type: string
+            required: true
+            immutable: true
+            password: true
+            default: ""
+        - variable: language
+          label: Language
+          description: |
+            The language for Piwigo.</br>
+            Only used when Piwigo is first installed.
+          schema:
+            type: string
+            required: true
+            immutable: true
+            default: "en_UK"
+            enum:
+              - value: af_ZA
+                description: Afrikaans [ZA]
+              - value: es_AR
+                description: Argentina [AR]
+              - value: az_AZ
+                description: Azərbaycanca [AZ]
+              - value: id_ID
+                description: Bahasa Indonesia [ID]
+              - value: pt_BR
+                description: Brasil [BR]
+              - value: br_FR
+                description: Brezhoneg [FR]
+              - value: ca_ES
+                description: Català [CA]
+              - value: da_DK
+                description: Dansk [DK]
+              - value: de_DE
+                description: Deutsch [DE]
+              - value: dv_MV
+                description: Dhivehi [MV]
+              - value: en_GB
+                description: English [GB]
+              - value: en_UK
+                description: English [UK]
+              - value: en_US
+                description: English [US]
+              - value: es_ES
+                description: Español [ES]
+              - value: eo_EO
+                description: Esperanto [EO]
+              - value: et_EE
+                description: Estonian [EE]
+              - value: eu_ES
+                description: Euskara [ES]
+              - value: fi_FI
+                description: Finnish [FI]
+              - value: fr_FR
+                description: Français [FR]
+              - value: fr_CA
+                description: Français [QC]
+              - value: ga_IE
+                description: Gaeilge [IE]
+              - value: gl_ES
+                description: Galego [ES]
+              - value: hr_HR
+                description: Hrvatski [HR]
+              - value: it_IT
+                description: Italiano [IT]
+              - value: lv_LV
+                description: Latviešu [LV]
+              - value: lt_LT
+                description: Lietuviu [LT]
+              - value: lb_LU
+                description: Lëtzebuergesch [LU]
+              - value: hu_HU
+                description: Magyar [HU]
+              - value: ms_MY
+                description: Malay [MY]
+              - value: es_MX
+                description: México [MX]
+              - value: nl_NL
+                description: Nederlands [NL]
+              - value: nb_NO
+                description: Norsk bokmål [NO]
+              - value: nn_NO
+                description: Norwegian nynorsk [NO]
+              - value: pl_PL
+                description: Polski [PL]
+              - value: pt_PT
+                description: Português [PT]
+              - value: ro_RO
+                description: Română [RO]
+              - value: sk_SK
+                description: Slovensky [SK]
+              - value: sl_SI
+                description: Slovenšcina [SI]
+              - value: sh_RS
+                description: Srpski [SR]
+              - value: sv_SE
+                description: Svenska [SE]
+              - value: vi_VN
+                description: Tiếng Việt [VN]
+              - value: tr_TR
+                description: Türkçe [TR]
+              - value: wo_SN
+                description: Wolof [SN]
+              - value: is_IS
+                description: Íslenska [IS]
+              - value: cs_CZ
+                description: Česky [CZ]
+              - value: el_GR
+                description: Ελληνικά [GR]
+              - value: bg_BG
+                description: Български [BG]
+              - value: mk_MK
+                description: Македонски [MK]
+              - value: mn_MN
+                description: Монгол [MN]
+              - value: ru_RU
+                description: Русский [RU]
+              - value: sr_RS
+                description: Српски [SR]
+              - value: uk_UA
+                description: Українська [UA]
+              - value: he_IL
+                description: עברית [IL]
+              - value: ar_EG
+                description: العربية (مص
+              - value: ar_SA
+                description: العربية [AR]
+              - value: ar_MA
+                description: العربية [MA]
+              - value: fa_IR
+                description: پارسی [IR]
+              - value: kok_IN
+                description: कोंकणी [IN]
+              - value: bn_IN
+                description: বাংলা[IN]
+              - value: gu_IN
+                description: ગુજરાતી[IN]
+              - value: ta_IN
+                description: தமிழ் [IN]
+              - value: kn_IN
+                description: ಕನ್ನಡ [IN]
+              - value: th_TH
+                description: ภาษาไทย [TH]
+              - value: ka_GE
+                description: ქართული [GE]
+              - value: km_KH
+                description: ខ្មែរ [KH]
+              - value: zh_TW
+                description: 中文 (繁體) [TW]
+              - value: zh_HK
+                description: 中文 (香港) [HK]
+              - value: ja_JP
+                description: 日本語 [JP]
+              - value: zh_CN
+                description: 简体中文 [CN]
+              - value: ko_KR
+                description: 한국어 [KR]
+
+        - variable: additionalEnvs
+          label: Additional Environment Variables
+          description: Configure additional environment variables for Piwigo.
+          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: piwiID
+    label: ""
+    group: User and Group Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: user
+          label: User ID
+          description: The user id that Piwigo files will be owned by.
+          schema:
+            type: int
+            min: 2
+            default: 568
+            required: true
+        - variable: group
+          label: Group ID
+          description: The group id that Piwigo files will be owned by.
+          schema:
+            type: int
+            min: 2
+            default: 568
+            required: true
+
+  - variable: piwiNetwork
+    label: ""
+    group: Network Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: webPort
+          label: Web Port
+          description: The port for the Piwigo WebUI.
+          schema:
+            type: int
+            default: 30066
+            min: 9000
+            max: 65535
+            required: true
+
+  - variable: piwiStorage
+    label: ""
+    group: Storage Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: config
+          label: Piwigo Configuration Storage
+          description: The path to store Piwigo configuration.
+          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: config
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: gallery
+          label: Piwigo Gallery Storage
+          description: The path to store Piwigo gallery.
+          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: gallery
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: mariadbData
+          label: Piwigo MariaDB Data Storage
+          description: The path to store Piwigo MariaDB 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: mariadbData
+                  $ref:
+                    - "normalize/ixVolume"
+              - variable: hostPath
+                label: Host Path
+                schema:
+                  type: hostpath
+                  show_if: [["type", "=", "hostPath"]]
+                  immutable: true
+                  required: true
+        - variable: mariadbBackup
+          label: Piwigo MariaDB Backup Storage
+          description: The path to store Piwigo MariaDB 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: mariadbBackup
+                  $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 Piwigo.
+          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
+    label: ""
+    group: Resources Configuration
+    schema:
+      type: dict
+      attrs:
+        - variable: limits
+          label: Limits
+          schema:
+            type: dict
+            attrs:
+              - variable: cpu
+                label: CPU
+                description: CPU limit for Piwigo.
+                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 Piwigo.
+                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/piwigo/templates/NOTES.txt

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

+ 45 - 0
library/ix-dev/community/piwigo/templates/_configuration.tpl

@@ -0,0 +1,45 @@
+{{- define "piwigo.configuration" -}}
+
+  {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}}
+
+  {{- $dbHost := (printf "%s-mariadb" $fullname) -}}
+  {{- $dbUser := "piwigo" -}}
+  {{- $dbName := "piwigo" -}}
+
+  {{- $dbPass := (randAlphaNum 32) -}}
+  {{- $dbRootPass := (randAlphaNum 32) -}}
+  {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-mariadb-creds" $fullname)) -}}
+    {{- $dbPass = ((index .data "MARIADB_PASSWORD") | b64dec) -}}
+    {{- $dbRootPass = ((index .data "MARIADB_ROOT_PASSWORD") | b64dec) -}}
+  {{- end }}
+secret:
+  mariadb-creds:
+    enabled: true
+    data:
+      MARIADB_USER: {{ $dbUser }}
+      MARIADB_DATABASE: {{ $dbName }}
+      MARIADB_PASSWORD: {{ $dbPass }}
+      MARIADB_ROOT_PASSWORD: {{ $dbRootPass }}
+      MARIADB_HOST: {{ $dbHost }}
+
+  {{- if not (mustRegexMatch "^.+@.+\\..+$" .Values.piwiConfig.adminMail) -}}
+    {{- fail (printf "Piwigo - Mail [%s] is not valid." .Values.piwiConfig.adminMail) -}}
+  {{- end -}}
+  {{- $installArgs := (list
+      (printf "language=%s" .Values.piwiConfig.language)
+      (printf "dbhost=%s" $dbHost)
+      (printf "dbuser=%s" $dbUser)
+      (printf "dbpasswd=%s" $dbPass)
+      (printf "dbname=%s" $dbName)
+      "prefix=piwigo_"
+      (printf "admin_name=%s" .Values.piwiConfig.adminName)
+      (printf "admin_pass1=%s" .Values.piwiConfig.adminPass)
+      (printf "admin_pass2=%s" .Values.piwiConfig.adminPass)
+      (printf "admin_mail=%s" .Values.piwiConfig.adminMail)
+      "install=Start+installation"
+  ) }}
+  piwigo-creds:
+    enabled: true
+    data:
+      INSTALL_STRING: {{ join "&" $installArgs }}
+{{- end -}}

+ 6 - 0
library/ix-dev/community/piwigo/templates/_mariadb.tpl

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

+ 68 - 0
library/ix-dev/community/piwigo/templates/_persistance.tpl

@@ -0,0 +1,68 @@
+{{- define "piwigo.persistence" -}}
+persistence:
+  config:
+    enabled: true
+    type: {{ .Values.piwiStorage.config.type }}
+    datasetName: {{ .Values.piwiStorage.config.datasetName | default "" }}
+    hostPath: {{ .Values.piwiStorage.config.hostPath | default "" }}
+    targetSelector:
+      piwigo:
+        piwigo:
+          mountPath: /config
+  gallery:
+    enabled: true
+    type: {{ .Values.piwiStorage.gallery.type }}
+    datasetName: {{ .Values.piwiStorage.gallery.datasetName | default "" }}
+    hostPath: {{ .Values.piwiStorage.gallery.hostPath | default "" }}
+    targetSelector:
+      piwigo:
+        piwigo:
+          mountPath: /gallery
+  tmp:
+    enabled: true
+    type: emptyDir
+    targetSelector:
+      piwigo:
+        piwigo:
+          mountPath: /tmp
+  {{- range $idx, $storage := .Values.piwiStorage.additionalStorages }}
+  {{ printf "piwi-%v" (int $idx) }}:
+    enabled: true
+    type: {{ $storage.type }}
+    datasetName: {{ $storage.datasetName | default "" }}
+    hostPath: {{ $storage.hostPath | default "" }}
+    targetSelector:
+      piwigo:
+        piwigo:
+          mountPath: {{ $storage.mountPath }}
+  {{- end }}
+
+  mariadbdata:
+    enabled: true
+    type: {{ .Values.piwiStorage.mariadbData.type }}
+    datasetName: {{ .Values.piwiStorage.mariadbData.datasetName | default "" }}
+    hostPath: {{ .Values.piwiStorage.mariadbData.hostPath | default "" }}
+    targetSelector:
+      # MariaDB pod
+      mariadb:
+        # MariaDB container
+        mariadb:
+          mountPath: /var/lib/mysql
+        # MariaDB - Permissions container
+        permissions:
+          mountPath: /mnt/directories/mariadb_data
+  mariadbbackup:
+    enabled: true
+    type: {{ .Values.piwiStorage.mariadbBackup.type }}
+    datasetName: {{ .Values.piwiStorage.mariadbBackup.datasetName | default "" }}
+    hostPath: {{ .Values.piwiStorage.mariadbBackup.hostPath | default "" }}
+    targetSelector:
+      # MariaDB backup pod
+      mariadbbackup:
+        # MariaDB backup container
+        mariadbbackup:
+          mountPath: /mariadb_backup
+        # MariaDB - Permissions container
+        permissions:
+          mountPath: /mnt/directories/mariadb_backup
+{{- end -}}

+ 83 - 0
library/ix-dev/community/piwigo/templates/_piwigo.tpl

@@ -0,0 +1,83 @@
+{{- define "piwigo.workload" -}}
+workload:
+  piwigo:
+    enabled: true
+    primary: true
+    type: Deployment
+    podSpec:
+      hostNetwork: false
+      securityContext:
+        fsGroup: {{ .Values.piwiID.group }}
+      containers:
+        piwigo:
+          enabled: true
+          primary: true
+          imageSelector: image
+          securityContext:
+            runAsUser: 0
+            runAsGroup: 0
+            runAsNonRoot: false
+            readOnlyRootFilesystem: false
+            capabilities:
+              add:
+                - CHOWN
+                - DAC_OVERRIDE
+                - FOWNER
+                - NET_BIND_SERVICE
+                - SETGID
+                - SETUID
+          envFrom:
+            - secretRef:
+                name: piwigo-creds
+          fixedEnv:
+            PUID: {{ .Values.piwiID.user }}
+          {{ with .Values.piwiConfig.additionalEnvs }}
+          envList:
+            {{ range $env := . }}
+            - name: {{ $env.name }}
+              value: {{ $env.value }}
+            {{ end }}
+          {{ end }}
+          probes:
+            liveness:
+              enabled: true
+              type: http
+              # https://github.com/Piwigo/Piwigo/issues/1954
+              path: /ws.php?method=pwg.session.getStatus
+              port: 80
+            readiness:
+              enabled: true
+              type: http
+              path: /ws.php?method=pwg.session.getStatus
+              port: 80
+            startup:
+              enabled: true
+              type: http
+              path: /ws.php?method=pwg.session.getStatus
+              port: 80
+          lifecycle:
+            postStart:
+              type: exec
+              command:
+                - /bin/sh
+                - -c
+                - |
+                  until curl --silent --fail --output /dev/null http://localhost:80; do
+                    echo "Waiting for Piwigo to start..."
+                    sleep 1
+                  done
+                  if curl --silent --fail http://localhost:80/install.php | grep "Piwigo is already installed"; then
+                    echo "Piwigo is already installed, skipping installation"
+                    exit 0
+                  fi
+                  echo "Installing Piwigo..."
+                  curl -X POST -d "${INSTALL_STRING}" http://localhost:80/install.php
+                  if curl --silent --fail http://localhost:80/install.php | grep "Piwigo is already installed"; then
+                    echo "Piwigo is already installed, skipping installation"
+                    exit 0
+                  fi
+                  exit 1
+      initContainers:
+      {{- include "ix.v1.common.app.mariadbWait" (dict "name" "mariadb-wait"
+                                                       "secretName" "mariadb-creds") | nindent 8 }}
+{{- end -}}

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

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

+ 27 - 0
library/ix-dev/community/piwigo/templates/_service.tpl

@@ -0,0 +1,27 @@
+{{- define "piwigo.service" -}}
+service:
+  piwigo:
+    enabled: true
+    primary: true
+    type: NodePort
+    targetSelector: piwigo
+    ports:
+      webui:
+        enabled: true
+        primary: true
+        port: {{ .Values.piwiNetwork.webPort }}
+        nodePort: {{ .Values.piwiNetwork.webPort }}
+        targetPort: 80
+        targetSelector: piwigo
+  mariadb:
+    enabled: true
+    type: ClusterIP
+    targetSelector: mariadb
+    ports:
+      mariadb:
+        enabled: true
+        primary: true
+        port: 3306
+        targetPort: 3306
+        targetSelector: mariadb
+{{- end -}}

+ 13 - 0
library/ix-dev/community/piwigo/templates/common.yaml

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

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

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

+ 31 - 0
library/ix-dev/community/piwigo/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'[0-9]+\.[0-9]+\.[0-9]+')
+
+
+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)))

+ 38 - 0
library/ix-dev/community/piwigo/values.yaml

@@ -0,0 +1,38 @@
+image:
+  repository: linuxserver/piwigo
+  pullPolicy: IfNotPresent
+  tag: 13.8.0
+
+resources:
+  limits:
+    cpu: 4000m
+    memory: 8Gi
+
+piwiConfig:
+  language: ''
+  adminName: ''
+  adminMail: ''
+  adminPass: ''
+  additionalEnvs: []
+
+piwiNetwork:
+  webPort: 30066
+
+piwiID:
+  user: 568
+  group: 568
+
+piwiStorage:
+  config:
+    type: ixVolume
+    datasetName: config
+  gallery:
+    type: ixVolume
+    datasetName: gallery
+  mariadbData:
+    type: ixVolume
+    datasetName: mariadbData
+  mariadbBackup:
+    type: ixVolume
+    datasetName: mariadbBackup
+  additionalStorages: []