satoshipay / stellar-helm-charts

Helm charts for Stellar applications (Core, Horizon, Friendbot, ...)
Apache License 2.0
10 stars 11 forks source link

Use init container for database migration #3

Open andrenarchy opened 5 years ago

andrenarchy commented 5 years ago

Currently, migrations are run as a job in the Stellar Horizon chart, see https://github.com/satoshipay/stellar-helm-charts/blob/539fa9624783efbc391a266cfa3e1a7afc1d25fd/stellar-horizon/templates/job-migrate.yaml#L25. It might make sense to also use an init container for this, see #1 and #2.

@todkap Do you think an init container or a job is better suited for this?

todkap commented 5 years ago

I think init container makes the most sense here.
https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#what-can-init-containers-be-used-for

There are benefits where the init container will restart if failed as well as block the starting of the app container until the migration is complete.

I agree with this article https://medium.com/@pliutau/database-migrations-with-go-and-kubernetes-2831d43a8f9c

andrenarchy commented 5 years ago

Great, I also had the feeling that this is better. I think it should be configurable but enabling migrations by default is probably what most people would expect.