fix: resolve critical deployment issues across Helm charts, Dockerfile, and K8s fallback

- Add helm/kubectl binaries and chart directory to backend Dockerfile
- Extend Helm templates for MongoDB/MariaDB database support (env vars, probes, ports)
- Add Redis and RabbitMQ Helm templates (deployment, service, secret, PVC)
- Add generic app-storage PVC and Fluent Bit sidecar with ES authentication
- Fix imagePullSecrets in K8s API fallback, prevent secret regeneration on redeploy
- Clean up Redis/RabbitMQ/FluentBit resources on app deletion without removing shared secrets
- Fix HelmService chartPath resolution for production Docker builds

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-13 19:16:07 +03:30
parent 38748b0827
commit 9937ee457d
11 changed files with 665 additions and 55 deletions
@@ -54,6 +54,10 @@ Database image — auto-computed from type + version if not explicitly set
{{- .Values.database.image }}
{{- else if eq .Values.database.type "postgresql" }}
{{- printf "postgres:%s-alpine" .Values.database.version }}
{{- else if eq .Values.database.type "mariadb" }}
{{- printf "mariadb:%s" .Values.database.version }}
{{- else if eq .Values.database.type "mongodb" }}
{{- printf "mongo:%s" .Values.database.version }}
{{- else }}
{{- printf "mysql:%s" .Values.database.version }}
{{- end }}
@@ -63,14 +67,20 @@ Database image — auto-computed from type + version if not explicitly set
Database port
*/}}
{{- define "cloudhost-app.dbPort" -}}
{{- if eq .Values.database.type "postgresql" }}5432{{- else }}3306{{- end }}
{{- if eq .Values.database.type "postgresql" }}5432
{{- else if eq .Values.database.type "mongodb" }}27017
{{- else }}3306
{{- end }}
{{- end }}
{{/*
Database data mount path (volume mount target)
*/}}
{{- define "cloudhost-app.dbDataPath" -}}
{{- if eq .Values.database.type "postgresql" }}/var/lib/postgresql/data{{- else }}/var/lib/mysql{{- end }}
{{- if eq .Values.database.type "postgresql" }}/var/lib/postgresql/data
{{- else if eq .Values.database.type "mongodb" }}/data/db
{{- else }}/var/lib/mysql
{{- end }}
{{- end }}
{{/*
@@ -79,3 +89,25 @@ PostgreSQL PGDATA path — must be a subdirectory of the mount to avoid "initdb:
{{- define "cloudhost-app.pgDataDir" -}}
/var/lib/postgresql/data/pgdata
{{- end }}
{{/*
App storage mount path based on runtime
*/}}
{{- define "cloudhost-app.storageMountPath" -}}
{{- if eq .Values.app.runtime "wordpress" }}/var/www/html/wp-content
{{- else if or (eq .Values.app.runtime "laravel") (eq .Values.app.runtime "php") }}/var/www/html/storage
{{- else if eq .Values.app.runtime "django" }}/app/media
{{- else }}/app/data
{{- end }}
{{- end }}
{{/*
Default log paths based on runtime
*/}}
{{- define "cloudhost-app.defaultLogPaths" -}}
{{- if eq .Values.app.runtime "wordpress" }}/var/www/html/wp-content/debug.log,/var/log/app/*.log
{{- else if eq .Values.app.runtime "laravel" }}/var/www/html/storage/logs/*.log,/var/log/app/*.log
{{- else if or (eq .Values.app.runtime "php") }}/var/www/html/storage/logs/*.log,/var/log/php/*.log,/var/log/app/*.log
{{- else }}/var/log/app/*.log
{{- end }}
{{- end }}