From b51fbb0f0c86455d0732d664355e5a7de805d93f Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Sat, 15 Jul 2023 13:29:18 -0400 Subject: [PATCH] feat(piwigo) configure piwigo mariadb and admin credentials (#10444) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Configure admin credentials and mariadb sidecar ⚒️ Fixes # **⚙️ Type of change** - [X] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ 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/piwigo/Chart.yaml | 6 ++++- charts/incubator/piwigo/questions.yaml | 36 ++++++++++++++++++++++++++ charts/incubator/piwigo/values.yaml | 27 ++++++++++++++++++- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/charts/incubator/piwigo/Chart.yaml b/charts/incubator/piwigo/Chart.yaml index 62feaaec6fa..b54309d72ad 100644 --- a/charts/incubator/piwigo/Chart.yaml +++ b/charts/incubator/piwigo/Chart.yaml @@ -4,6 +4,10 @@ dependencies: - name: common repository: https://library-charts.truecharts.org version: 12.14.6 + - condition: mariadb.enabled + name: mariadb + repository: https://deps.truecharts.org/ + version: 7.0.62 description: A photo gallery software for the web. home: https://truecharts.org/charts/incubator/piwigo icon: https://truecharts.org/img/hotlink-ok/chart-icons/piwigo.png @@ -23,7 +27,7 @@ sources: - http://piwigo.org/ - https://github.com/linuxserver/docker-piwigo type: application -version: 6.0.0 +version: 6.1.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/piwigo/questions.yaml b/charts/incubator/piwigo/questions.yaml index 2872da3b3b0..348a9475b94 100644 --- a/charts/incubator/piwigo/questions.yaml +++ b/charts/incubator/piwigo/questions.yaml @@ -14,6 +14,42 @@ questions: # Include{containerBasic} # Include{containerAdvanced} + - variable: piwigo + group: App Configuration + label: Piwigo Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: language + label: Language + description: Set the initial Language + schema: + type: string + default: "en_US" + - variable: admin_user + label: Admin user + description: Set the initial admin user + schema: + type: string + required: true + default: "" + - variable: admin_pass + label: Admin Password + description: Set the initial admin password + schema: + type: string + required: true + private: true + default: "" + - variable: admin_email + label: Admin Email + description: Set the initial admin email + schema: + type: string + required: true + default: "" + # Include{containerConfig} # Include{serviceRoot} - variable: main diff --git a/charts/incubator/piwigo/values.yaml b/charts/incubator/piwigo/values.yaml index c4e098d50d2..08bc56d3ec4 100644 --- a/charts/incubator/piwigo/values.yaml +++ b/charts/incubator/piwigo/values.yaml @@ -17,12 +17,32 @@ service: targetPort: 80 port: 10027 +piwigo: + language: en_US + admin_user: admin + admin_pass: admin123 + admin_email: admin@email.com + workload: main: podSpec: containers: main: - env: {} + lifecycle: + postStart: + type: exec + command: + - /bin/sh + - -c + - | + if [ -f "/config/POSTSETUP" ]; then + echo "POSTSETUP exists, no further action is needed." + else + while ! curl -s -o -v /dev/null http://localhost/install.php; do sleep 1; done && \ + curl -v -X POST -d "language={{ .Values.piwigo.language }}&dbhost={{ .Values.mariadb.creds.plainhost | trimAll "\"" }}:3306&dbuser={{ .Values.mariadb.mariadbUsername }}&dbpasswd={{ .Values.mariadb.creds.mariadbPassword | trimAll "\"" }}&dbname={{ .Values.mariadb.mariadbDatabase }}&prefix=piwigo_&admin_name={{ .Values.piwigo.admin_user }}&admin_pass1={{ .Values.piwigo.admin_pass }}&admin_pass2={{ .Values.piwigo.admin_pass }}&admin_mail={{ .Values.piwigo.admin_email }}&install=Start+installation" http://localhost/install.php && \ + ( touch "/config/POSTSETUP" && echo "Created POSTSETUP!") || \ + ( echo "Failed to create POSTSETUP file..." && exit 1 ) + fi persistence: config: @@ -36,6 +56,11 @@ persistence: varrun: enabled: true +mariadb: + enabled: true + mariadbUsername: piwigo + mariadbDatabase: piwigo + portal: open: enabled: true