Repository navigation
|
Is there any guidance on how to handle/perform database migrations when using Docker? For example, if upgrading from images on version 15.0.2 to 20.0.1 in the context of a Kubernetes-based deployment. The server guide talks about passing in a property such as "--spi-connections-jpa-legacy-migration-strategy=update", but it's not clear to me how to do this in a Docker-based environment. Additionally, I'm wondering if the update would then have to be done in such a way that essentially introduces downtime or something if the start of the newer version container updates the database which would then cause running Pods on the older version to start failing. |
Replies: 2 comments
|
No matter which mechanism you use to run Keycloak, it currently does not support zero-downtime updates. So you will have to bring down the old version and then start the new version. You can optionally perform the migration manually during the downtime or just use the automatic update strategy. In the latter case, the first Keycloak process coming up will lock the database and perform the migration before releasing the lock and continuing to run. |
|
Thanks @sschu -- I kinda figured that might be the case regarding zero-downtime updates but thanks for confirming. I'll give the automatic update strategy a try first I think. Still getting up to speed w/ the latest version but am thinking I can just add it to the entrypoint/cmd of my Dockerfile or the pod's container spec. |
No matter which mechanism you use to run Keycloak, it currently does not support zero-downtime updates. So you will have to bring down the old version and then start the new version. You can optionally perform the migration manually during the downtime or just use the automatic update strategy. In the latter case, the first Keycloak process coming up will lock the database and perform the migration before releasing the lock and continuing to run.