From 1461dc41de8a532e2143f635a56370194642305c Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Wed, 23 Mar 2022 07:25:55 +0200 Subject: [PATCH] fix(projectsend): init db (#2248) --- charts/stable/projectsend/Chart.yaml | 7 ++- charts/stable/projectsend/questions.yaml | 14 ++++++ charts/stable/projectsend/values.yaml | 62 ++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/charts/stable/projectsend/Chart.yaml b/charts/stable/projectsend/Chart.yaml index e422a0ba9bc..f95a5bbc774 100644 --- a/charts/stable/projectsend/Chart.yaml +++ b/charts/stable/projectsend/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 kubeVersion: ">=1.16.0-0" name: projectsend -version: 1.0.4 +version: 1.0.5 appVersion: "2021.12.10" description: Projectsend is a self-hosted application that lets you upload files and assign them to specific clients that you create yourself. type: application @@ -15,7 +15,10 @@ dependencies: - name: common repository: https://truecharts.org version: 9.1.8 - # condition: +- condition: mariadb.enabled + name: mariadb + repository: https://truecharts.org/ + version: 2.0.7 maintainers: - email: info@truecharts.org name: TrueCharts diff --git a/charts/stable/projectsend/questions.yaml b/charts/stable/projectsend/questions.yaml index d200386c264..c73367088ed 100644 --- a/charts/stable/projectsend/questions.yaml +++ b/charts/stable/projectsend/questions.yaml @@ -90,6 +90,20 @@ questions: type: int required: true default: 5000 + - variable: PHP_MEMORY_LIMIT + label: "PHP_MEMORY_LIMIT" + description: "PHP_MEMORY_LIMIT" + schema: + type: string + required: true + default: "512M" + - variable: PHP_MAX_FILE_UPLOAD + label: "PHP_MAX_FILE_UPLOAD" + description: "PHP_MAX_FILE_UPLOAD" + schema: + type: int + required: true + default: 200 # Include{containerConfig} - variable: service diff --git a/charts/stable/projectsend/values.yaml b/charts/stable/projectsend/values.yaml index 6e025f7d592..59a1e510cfa 100644 --- a/charts/stable/projectsend/values.yaml +++ b/charts/stable/projectsend/values.yaml @@ -13,6 +13,8 @@ podSecurityContext: env: MAX_UPLOAD: 5000 + PHP_MEMORY_LIMIT: "512M" + PHP_MAX_FILE_UPLOAD: 200 service: main: @@ -25,5 +27,65 @@ persistence: config: enabled: true mountPath: "/config" + data: + enabled: true + mountPath: "/data" varrun: enabled: true + +mariadb: + enabled: true + mariadbUsername: projectsend + mariadbDatabase: projectsend + existingSecret: "mariadbcreds" + + +installContainers: + initconfig: + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + env: + - name: DBNAME + value: "{{ .Values.mariadb.mariadbDatabase }}" + - name: DBUSER + value: "{{ .Values.mariadb.mariadbUsername }}" + - name: DBPASS + valueFrom: + secretKeyRef: + name: mariadbcreds + key: mariadb-password + - name: DBHOST + valueFrom: + secretKeyRef: + name: mariadbcreds + key: plainhost + volumeMounts: + - name: config + mountPath: "/config" + command: ["/bin/sh", "-c"] + args: + - > + export configFile="/config/projectsend/sys.config.php"; + if [ ! -f $configFile ]; + then + echo "Creating initial config file..."; + mkdir -p /config/projectsend + touch $configFile; + echo "> $configFile + echo "# This is generated on initial setup of this TrueCharts App" >> $configFile; + echo "# Do not change below values, or DB connection will fail." >> $configFile + echo "define('DB_DRIVER', 'mysql');" >> $configFile; + echo "define('DB_NAME', '$DBNAME');" >> $configFile; + echo "define('DB_HOST', '$DBHOST');" >> $configFile; + echo "define('DB_USER', '$DBUSER');" >> $configFile; + echo "define('DB_PASSWORD', '$DBPASS');" >> $configFile; + echo "define('TABLES_PREFIX', 'tbl_');" >> $configFile; + echo "# You can manually change below values if you like." >> $configFile + echo "define('SITE_LANG', 'en');" >> $configFile; + echo "define('MAX_FILESIZE',2048);" >> $configFile; + echo "define('EMAIL_ENCODING', 'utf-8');" >> $configFile; + echo "define('DEBUG', false);" >> $configFile; + echo "# End of generated config values." >> $configFile; + echo "Done!"; + else + echo "Initial config file already exists. Skipping..."; + fi;