From 68b5b72417b1525e5c5f10a3cb6fe0a5e78fef1a Mon Sep 17 00:00:00 2001 From: psytester Date: Tue, 5 Apr 2022 10:49:50 +0200 Subject: [PATCH 1/4] JPA spi example added Added: how to configure JPA migration --- .../main/server/configuration-provider.adoc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/guides/src/main/server/configuration-provider.adoc b/docs/guides/src/main/server/configuration-provider.adoc index 8cc58f14733..e74b0f8ff77 100644 --- a/docs/guides/src/main/server/configuration-provider.adoc +++ b/docs/guides/src/main/server/configuration-provider.adoc @@ -42,6 +42,8 @@ Provider configuration options are provided when starting the server, as shown i .Setting the `connection-pool-size` for the `default` provider of the `connections-http-client` SPI <@kc.start parameters="--spi-connections-http-client-default-connection-pool-size=10"/> +As usual, the configuration options can also be set in `conf/keycloak.conf` with follow-up start `build` option. + == Configuring a default provider Depending on the SPI, multiple provider implementations can co-exist but only one of them is going to be used at runtime. @@ -79,6 +81,23 @@ When implementing a provider you might need to use some third-party dependency t In this case, you should copy any additional dependency to the `providers` directory and run the `build` command. Once you do that, the server is going to make these additional dependencies available at runtime for any provider that depends on them. +== Setting JPA provider configuration option for migrationStrategy + +To setup the JPA migrationStrategy you should run the `build` command as follows: + +.Setting the `migration-strategy` for the `quarkus` provider of the `connections-jpa` SPI +<@kc.build parameters="--spi-connections-jpa-quarkus-migration-strategy=manual"/> + +If you want to get a SQL file for DB initialization, too, you have to add this additional initializeEmpty SPI: + +.Setting the `initialize-empty` for the `quarkus` provider of the `connections-jpa` SPI +<@kc.start parameters="--spi-connections-jpa-quarkus-initialize-empty=false"/> + +In the same way the migrationExport to point to a specific file and location: + +.Setting the `migration-export` for the `quarkus` provider of the `connections-jpa` SPI +<@kc.start parameters="--spi-connections-jpa-quarkus-migration-export=/path_to_file/my_sql_file.sql"/> + == References * https://www.keycloak.org/server/configuration[Configuring Keycloak] From 1ae76e45be6008c0e6d6130380840d2c06681d91 Mon Sep 17 00:00:00 2001 From: psytester Date: Wed, 27 Apr 2022 14:42:18 +0200 Subject: [PATCH 2/4] Update db.adoc --- docs/guides/src/main/server/db.adoc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/guides/src/main/server/db.adoc b/docs/guides/src/main/server/db.adoc index 1c155f300b4..e7b0d5c52ff 100644 --- a/docs/guides/src/main/server/db.adoc +++ b/docs/guides/src/main/server/db.adoc @@ -126,4 +126,21 @@ Keycloak uses XA transactions and the appropriate database drivers by default. T Keycloak will automatically choose the appropriate jdbc driver for your vendor. +== Setting JPA provider configuration option for migrationStrategy + +To setup the JPA migrationStrategy (manual/update/validate) you should setup JPA provider as follows: + +.Setting the `migration-strategy` for the `quarkus` provider of the `connections-jpa` SPI +<@kc.start parameters="--spi-connections-jpa-quarkus-migration-strategy=manual"/> + +If you want to get a SQL file for DB initialization, too, you have to add this additional SPI initializeEmpty (true/false): + +.Setting the `initialize-empty` for the `quarkus` provider of the `connections-jpa` SPI +<@kc.start parameters="--spi-connections-jpa-quarkus-initialize-empty=false"/> + +In the same way the migrationExport to point to a specific file and location: + +.Setting the `migration-export` for the `quarkus` provider of the `connections-jpa` SPI +<@kc.start parameters="--spi-connections-jpa-quarkus-migration-export=/"/> + From d675e4f8f9f912bbad7bad44aba41fdd649844a6 Mon Sep 17 00:00:00 2001 From: psytester Date: Wed, 27 Apr 2022 14:46:05 +0200 Subject: [PATCH 3/4] Update configuration-provider.adoc moved JPA config to db.adoc --- .../src/main/server/configuration-provider.adoc | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/docs/guides/src/main/server/configuration-provider.adoc b/docs/guides/src/main/server/configuration-provider.adoc index e74b0f8ff77..3bcafa657ff 100644 --- a/docs/guides/src/main/server/configuration-provider.adoc +++ b/docs/guides/src/main/server/configuration-provider.adoc @@ -81,23 +81,6 @@ When implementing a provider you might need to use some third-party dependency t In this case, you should copy any additional dependency to the `providers` directory and run the `build` command. Once you do that, the server is going to make these additional dependencies available at runtime for any provider that depends on them. -== Setting JPA provider configuration option for migrationStrategy - -To setup the JPA migrationStrategy you should run the `build` command as follows: - -.Setting the `migration-strategy` for the `quarkus` provider of the `connections-jpa` SPI -<@kc.build parameters="--spi-connections-jpa-quarkus-migration-strategy=manual"/> - -If you want to get a SQL file for DB initialization, too, you have to add this additional initializeEmpty SPI: - -.Setting the `initialize-empty` for the `quarkus` provider of the `connections-jpa` SPI -<@kc.start parameters="--spi-connections-jpa-quarkus-initialize-empty=false"/> - -In the same way the migrationExport to point to a specific file and location: - -.Setting the `migration-export` for the `quarkus` provider of the `connections-jpa` SPI -<@kc.start parameters="--spi-connections-jpa-quarkus-migration-export=/path_to_file/my_sql_file.sql"/> - == References * https://www.keycloak.org/server/configuration[Configuring Keycloak] From b3fba8695de26885f3f467436d574ab6042e18a2 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Fri, 26 Aug 2022 10:37:45 +0200 Subject: [PATCH 4/4] Update docs/guides/src/main/server/configuration-provider.adoc --- docs/guides/src/main/server/configuration-provider.adoc | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/guides/src/main/server/configuration-provider.adoc b/docs/guides/src/main/server/configuration-provider.adoc index 3bcafa657ff..8cc58f14733 100644 --- a/docs/guides/src/main/server/configuration-provider.adoc +++ b/docs/guides/src/main/server/configuration-provider.adoc @@ -42,8 +42,6 @@ Provider configuration options are provided when starting the server, as shown i .Setting the `connection-pool-size` for the `default` provider of the `connections-http-client` SPI <@kc.start parameters="--spi-connections-http-client-default-connection-pool-size=10"/> -As usual, the configuration options can also be set in `conf/keycloak.conf` with follow-up start `build` option. - == Configuring a default provider Depending on the SPI, multiple provider implementations can co-exist but only one of them is going to be used at runtime.