fix(laravel): apply runtime DB config and startup entrypoint
Laravel images no longer bake config:cache at build time, which ignored K8s DB env vars. Add DB_CONNECTION, clear config on boot, generate APP_KEY when missing, run migrations, and rebuild caches at container start. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -90,6 +90,25 @@ PostgreSQL PGDATA path — must be a subdirectory of the mount to avoid "initdb:
|
||||
/var/lib/postgresql/data/pgdata
|
||||
{{- end }}
|
||||
|
||||
{{- define "cloudhost-app.laravelDbConnection" -}}
|
||||
{{- if eq .Values.database.type "postgresql" }}pgsql{{- else if eq .Values.database.type "mongodb" }}mongodb{{- else }}mysql{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Laravel-specific DB env vars (DB_CONNECTION, DB_DATABASE, DB_USERNAME)
|
||||
*/}}
|
||||
{{- define "cloudhost-app.laravelDbEnv" -}}
|
||||
- name: DB_CONNECTION
|
||||
value: {{ include "cloudhost-app.laravelDbConnection" . | quote }}
|
||||
- name: DB_DATABASE
|
||||
value: {{ include "cloudhost-app.dbName" . }}
|
||||
- name: DB_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "cloudhost-app.name" . }}-db-secret
|
||||
key: username
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
App storage mount path based on runtime
|
||||
*/}}
|
||||
|
||||
Reference in New Issue
Block a user