diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli similarity index 52% rename from distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli rename to distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli index 0ed854e5ef..d11e2b9f25 100644 --- a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-clustered.cli @@ -1,9 +1,5 @@ embed-host-controller --domain-config=domain.xml -# Early versions of keycloak used "default" for the standalone profile name. -# Yours maybe be something completely different. -set standaloneProfile=auth-server-standalone - # Early versions of keycloak used "ha" for the clustered profile name. # Yours maybe be something completely different. set clusteredProfile=auth-server-clustered @@ -12,125 +8,6 @@ set clusteredProfile=auth-server-clustered set pathToJson=../domain/configuration/keycloak-server.json -echo *** Begin Migration of /profile=$standaloneProfile *** -echo - -# Migrate from 1.8.1 to 1.9.1 -if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:read-resource - echo Adding local-cache=work to keycloak cache container... - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:add(indexing=NONE,start=LAZY) - echo -end-if -# realmVersions cache deprecated in 2.1.0 -#if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource -# echo Adding local-cache=realmVersions to keycloak cache container... -# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY) -# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/component=transaction/:write-attribute(name=mode,value=BATCH) -# echo -#end-if - - -# Migrate from 1.9.1 to 1.9.2 -if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy) - echo Adding eviction strategy to keycloak users cache container... - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000) - echo -end-if - -# Migrate from 1.9.2 to 1.9.8 -# NO CHANGES - -# Migrate from 1.9.8 to 2.0.0 -if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:read-resource - echo Adding local-cache=authorization to keycloak cache container... - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:add(indexing=NONE,start=LAZY) - echo -end-if -if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:read-attribute(name=strategy,include-defaults=false) - echo Updating authorization cache container.. - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU) - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=max-entries,value=100) -end-if - -# Migrate from 2.0.0 to 2.1.0 -if (outcome == success) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource - echo Removing deprecated cache 'realmVersions' - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:remove - echo -end-if - -# Migrate kecloak-server.json (deprecated in 2.2.0) -if (result == []) of /profile=$standaloneProfile/subsystem=keycloak-server/:read-children-names(child-type=spi) - echo Migrating keycloak-server.json to keycloak-server subsystem... - /profile=$standaloneProfile/subsystem=keycloak-server/:migrate-json(file=$pathToJson) - echo -end-if - -# Find if we are using jpa or mongo -if (result == mongo) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=realm/:read-attribute(name=default-provider) - set persistenceProvider=mongo -else - set persistenceProvider=jpa -end-if - -# Migrate from 2.1.0 to 2.2.0 -if (result == update) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema) - echo Updating connectionsJpa default properties... - /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema) - /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true) - /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update) - /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationExport,value=${jboss.home.dir}/keycloak-database-update.sql) - echo -end-if -if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource - echo Adding spi=userFederatedStorage... - /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider) - echo -end-if -if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:read-resource - echo Adding spi=jta-lookup... - /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss}) - /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/provider=jboss/:add(enabled=true) - echo -end-if - -# Migrate from 2.2.0 to 2.2.1 -# NO CHANGES - -# Migrate from 2.2.1 to 2.3.0 -if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource - echo Adding local-cache=keys to keycloak cache container... - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY) - echo -end-if -if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:read-attribute(name=strategy,include-defaults=false) - echo Updating eviction and expiration in local-cache=keys... - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU) - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000) - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=expiration/:write-attribute(name=max-idle,value=3600000) - echo -end-if -if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:read-resource - echo Adding spi=publicKeyStorage... - /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:add - /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/provider=infinispan/:add(properties={minTimeBetweenRequests => "10"},enabled=true) - echo -end-if - -# Migrate from 2.3.0 to 2.4.0 -# NO CHANGES - -# Migrate from 2.4.0 to 2.5.0 -if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy) - echo Adding eviction strategy to keycloak realms cache... - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU) - /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000) - echo -end-if - -echo *** End Migration of /profile=$standaloneProfile *** -echo echo echo *** Begin Migration of /profile=$clusteredProfile *** echo @@ -260,4 +137,4 @@ if (result == NONE) of /profile=$clusteredProfile/subsystem=infinispan/cache-con echo end-if -echo *** End Migration *** \ No newline at end of file +echo *** End Migration of /profile=$clusteredProfile *** \ No newline at end of file diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli new file mode 100644 index 0000000000..b24819e3b0 --- /dev/null +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain-standalone.cli @@ -0,0 +1,128 @@ +embed-host-controller --domain-config=domain.xml + +# Early versions of keycloak used "default" for the standalone profile name. +# Yours maybe be something completely different. +set standaloneProfile=auth-server-standalone + +# keycloak-server.json is not normally on this path. +set pathToJson=../domain/configuration/keycloak-server.json + + +echo *** Begin Migration of /profile=$standaloneProfile *** +echo + +# Migrate from 1.8.1 to 1.9.1 +if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:read-resource + echo Adding local-cache=work to keycloak cache container... + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=work/:add(indexing=NONE,start=LAZY) + echo +end-if +# realmVersions cache deprecated in 2.1.0 +#if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource +# echo Adding local-cache=realmVersions to keycloak cache container... +# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY) +# /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/component=transaction/:write-attribute(name=mode,value=BATCH) +# echo +#end-if + + +# Migrate from 1.9.1 to 1.9.2 +if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak users cache container... + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +# Migrate from 1.9.2 to 1.9.8 +# NO CHANGES + +# Migrate from 1.9.8 to 2.0.0 +if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:read-resource + echo Adding local-cache=authorization to keycloak cache container... + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:add(indexing=NONE,start=LAZY) + echo +end-if +if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:read-attribute(name=strategy,include-defaults=false) + echo Updating authorization cache container.. + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=max-entries,value=100) +end-if + +# Migrate from 2.0.0 to 2.1.0 +if (outcome == success) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource + echo Removing deprecated cache 'realmVersions' + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:remove + echo +end-if + +# Migrate kecloak-server.json (deprecated in 2.2.0) +if (result == []) of /profile=$standaloneProfile/subsystem=keycloak-server/:read-children-names(child-type=spi) + echo Migrating keycloak-server.json to keycloak-server subsystem... + /profile=$standaloneProfile/subsystem=keycloak-server/:migrate-json(file=$pathToJson) + echo +end-if + +# Find if we are using jpa or mongo +if (result == mongo) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=realm/:read-attribute(name=default-provider) + set persistenceProvider=mongo +else + set persistenceProvider=jpa +end-if + +# Migrate from 2.1.0 to 2.2.0 +if (result == update) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema) + echo Updating connectionsJpa default properties... + /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema) + /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true) + /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update) + /profile=$standaloneProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationExport,value=${jboss.home.dir}/keycloak-database-update.sql) + echo +end-if +if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource + echo Adding spi=userFederatedStorage... + /profile=$standaloneProfile/subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider) + echo +end-if +if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:read-resource + echo Adding spi=jta-lookup... + /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss}) + /profile=$standaloneProfile/subsystem=keycloak-server/spi=jta-lookup/provider=jboss/:add(enabled=true) + echo +end-if + +# Migrate from 2.2.0 to 2.2.1 +# NO CHANGES + +# Migrate from 2.2.1 to 2.3.0 +if (outcome == failed) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource + echo Adding local-cache=keys to keycloak cache container... + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY) + echo +end-if +if (result == undefined) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:read-attribute(name=strategy,include-defaults=false) + echo Updating eviction and expiration in local-cache=keys... + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000) + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=expiration/:write-attribute(name=max-idle,value=3600000) + echo +end-if +if (outcome == failed) of /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:read-resource + echo Adding spi=publicKeyStorage... + /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/:add + /profile=$standaloneProfile/subsystem=keycloak-server/spi=publicKeyStorage/provider=infinispan/:add(properties={minTimeBetweenRequests => "10"},enabled=true) + echo +end-if + +# Migrate from 2.3.0 to 2.4.0 +# NO CHANGES + +# Migrate from 2.4.0 to 2.5.0 +if (result == NONE) of /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak realms cache... + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$standaloneProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +echo *** End Migration of /profile=$standaloneProfile *** \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml b/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml index 7dd8cea1b3..559c60f80b 100644 --- a/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml +++ b/testsuite/integration-arquillian/tests/other/server-config-migration/pom.xml @@ -24,7 +24,7 @@ org.keycloak.testsuite integration-arquillian-tests-other - 2.5.1.Final-SNAPSHOT + 3.0.0.CR1-SNAPSHOT ../pom.xml @@ -323,7 +323,8 @@ - + +