Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running migrations in k8s-deployed container #728

Open
plaes opened this issue Oct 14, 2024 · 1 comment
Open

Running migrations in k8s-deployed container #728

plaes opened this issue Oct 14, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@plaes
Copy link
Contributor

plaes commented Oct 14, 2024

Although current documentation contains example on how to run migrations when running Part-DB inside docker, it's not a suitable way to run it inside container deployed in k8s (unless you do some nasty tricks).

In k8s, one should exec into container, and then invoke migrate command using sudo -E -u www-data like this:
sudo -E -u www-data php bin/console doctrine:migrations:migrate

I'm not sure where to add this in the documentation though (maybe add as alternative next to docker install).

Also, I can see that helm-chart uses initContainer as a solution (but this is nowadays considered inferior to using separate K8s Job triggered from Helm hook):
https://github.com/Part-DB/helm-charts/blob/b2514f3ae03f0d4a59047781260672bd01c433ec/charts/part-db/templates/statefulset.yaml#L38-L45

@plaes plaes added the enhancement New feature or request label Oct 14, 2024
@jbtronics
Copy link
Member

I plan to implement some automatic migration mechanism for the new docker image (#562), as this also makes upgrades much easier.

However, as it's possible that these fail, some automatic backup and recovery mechanism is required, which is not that trivial to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants