Run database migrations in pre-install,pre-upgrade hook#121
Run database migrations in pre-install,pre-upgrade hook#121andydennehy wants to merge 6 commits intolightdash:mainfrom
Conversation
45c19e0 to
106a60b
Compare
ae33a8c to
63b0a51
Compare
almeidabbm
left a comment
There was a problem hiding this comment.
Hey hey!! Thank you for you contribution 🚀
This looks mostly good although I do have a couple suggestions
Also, in the PR description you mention changing the entrypoint to node dist/index.js, this change isn't here but I do think it should be kept out so that pods still run migrations if they just get their new version via a kubectl command (not upgraded via helm)
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| serviceAccountName: {{ include "lightdash.serviceAccountName" . }} | ||
| containers: |
There was a problem hiding this comment.
Can this also include initContainers?
Some infra's might be using them as side car containers serving as proxy for the db which would be necessary to run migrations 😄
a2fd74b to
3888edb
Compare
Yes, that was my initial idea but we can leave it like this. It shouldn't matter as long as the migration runs before the backend pods starts... |
c976ed1 to
2da6b40
Compare
Description
Link to issue.
This solves issue #98 by adding a
pre-upgradehook which runspnpm -F backend migrate-production, without being constrained bystartupProbeorlivenessProbe.Also, this job runs on
pre-installwhen using an external database. To make sure all necessary environment variables are available to the migrationJob, the chart creates ephemeralpre-installConfigMap and Secret objects that are mounted into the migration container.