refactor(deploy): mount database_url.txt as file and run migrate command in shell under /bin/ash -c
This commit is contained in:
parent
11cc2027b8
commit
0904448966
1 changed files with 13 additions and 8 deletions
|
|
@ -25,17 +25,22 @@ spec:
|
|||
containers:
|
||||
- name: migrations
|
||||
image: "{{ .Values.migrations.image.repository }}:{{ .Values.migrations.image.tag }}"
|
||||
command: ["/usr/local/bin/migrate"]
|
||||
args: ["-path", "/srv/migrations/", "-database", "$MIGRATE_DATABASE_URL", "up"]
|
||||
env:
|
||||
- name: MIGRATE_DATABASE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Release.Name }}
|
||||
key: "database_url.txt"
|
||||
command: ["/bin/ash"]
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
migrate -path /srv/migrations -database $(cat /etc/yggdrasil/secrets/database_url.txt) up
|
||||
{{- with .Values.migrations.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /etc/yggdrasil/secrets
|
||||
name: secrets
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: secrets
|
||||
secret:
|
||||
secretName: {{ .Release.Name }}
|
||||
restartPolicy: Never
|
||||
backoffLimit: 0
|
||||
|
|
|
|||
Reference in a new issue