From 6c2a70e1afc859d4a86b3356bb0a664550e495e8 Mon Sep 17 00:00:00 2001 From: Olof Pettersson Date: Thu, 11 Dec 2025 20:56:32 +0100 Subject: [PATCH] Add init of db --- templates/deployment-app.yaml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/templates/deployment-app.yaml b/templates/deployment-app.yaml index f2ae114..3eeb191 100644 --- a/templates/deployment-app.yaml +++ b/templates/deployment-app.yaml @@ -12,6 +12,28 @@ spec: labels: {{- include "solidtime.selectorLabels" . | nindent 8 }} spec: + initContainers: + - name: migrate + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: ["php", "artisan", "migrate", "--force"] + env: + # 1. Loop through all variables in values.yaml "env" section + {{- range $key, $value := .Values.env }} + - name: {{ $key }} + value: {{ $value | quote }} + {{- end }} + # 2. Add Secrets explicitly + - name: DB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .Values.secret.existingSecret | default (printf "%s-secret" (include "solidtime.fullname" .)) }} + key: DB_PASSWORD + - name: APP_KEY + valueFrom: + secretKeyRef: + name: {{ .Values.secret.existingSecret | default (printf "%s-secret" (include "solidtime.fullname" .)) }} + key: APP_KEY containers: - name: solidtime image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"