diff --git a/kube/boost/templates/migration-job.yaml b/kube/boost/templates/migration-job.yaml new file mode 100644 index 00000000..8d863736 --- /dev/null +++ b/kube/boost/templates/migration-job.yaml @@ -0,0 +1,30 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: database-migrations-job + labels: + env: {{ .Values.deploymentEnvironment }} + app: boost + annotations: + "helm.sh/hook": pre-install,pre-upgrade + "helm.sh/hook-weight": "-1" +spec: + ttlSecondsAfterFinished: 3600 + backoffLimit: 4 + template: + spec: + restartPolicy: OnFailure + volumes: +{{ toYaml .Values.Volumes | indent 6 }} + imagePullSecrets: + - name: revsys-docker-registry + containers: + - name: database-migrations + image: {{ .Values.Image }}:{{ .Values.ImageTag }} + command: ["/bin/sh", "-c"] + args: + - "./manage.py migrate --noinput" + env: +{{ toYaml .Values.Env | indent 10 }} + volumeMounts: +{{ toYaml .Values.VolumeMounts | indent 10 }} diff --git a/kube/boost/values.yaml b/kube/boost/values.yaml index e16780bd..2b6a8dd9 100644 --- a/kube/boost/values.yaml +++ b/kube/boost/values.yaml @@ -15,8 +15,9 @@ replicaCount: "2" # where necessary initCommands: - - name: migrate - command: ./manage.py migrate --noinput + # migrate moved to a Job + # - name: migrate + # command: ./manage.py migrate --noinput - name: collectstatic command: ./manage.py collectstatic --noinput