Skip to content

Commit

Permalink
Merge pull request #181 from amplication/task/helm-chart-prisma-migra…
Browse files Browse the repository at this point in the history
…tion-init-container

feat(deployment-helm-chart): add init-container for prisma migration on start-up
  • Loading branch information
levivannoort authored Oct 3, 2023
2 parents bcd1e01 + 011d1a3 commit 37a0e91
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugins/deployment-helm-chart/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion plugins/deployment-helm-chart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@amplication/plugin-deployment-helm-chart",
"version": "1.0.2",
"version": "1.0.3",
"description": "Add helm chart for deployment of the service",
"main": "dist/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ spec:
serviceAccountName: {{ include "${{ SERVICE_NAME }}.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if or .Values.variables.configmap.DB_URL .Values.variables.secret.DB_URL }}
initContainers:
- name: {{ .Chart.Name }}-prisma-migrate
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
command: ["sh", "-c", "npx prisma migrate deploy; exit 0"]
{{- if .Values.variables.configmap.DB_URL }}
env:
- name: DATABASE_URL
value: {{ required ".Values.variables.configmap.DB_URL is required" .Values.variables.configmap.DB_URL }}
{{- else if .Values.variables.secret.DB_URL }}
env:
- name: DATABASE_URL
value: {{ required ".Values.variables.configmap.DB_URL is required" .Values.variables.configmap.DB_URL }}
{{- end }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down

0 comments on commit 37a0e91

Please sign in to comment.