From 420286c1031e1a69e34a8263a9e42751633533db Mon Sep 17 00:00:00 2001 From: Stan Silvert Date: Thu, 22 Dec 2016 16:18:24 -0500 Subject: [PATCH] KEYCLOAK-4101: jboss-cli script to do migration of configuration --- .gitignore | 1 + .../resources/content/bin/migrate-domain.cli | 263 +++++++ .../content/bin/migrate-standalone-ha.cli | 145 ++++ .../content/bin/migrate-standalone.cli | 135 ++++ distribution/pom.xml | 1 + distribution/server-config-migration/pom.xml | 360 +++++++++ .../config/migration/ConfigMigrationTest.java | 71 ++ .../test/resources/domain/domain-1.8.1.xml | 733 ++++++++++++++++++ .../resources/domain/host-master-1.8.1.xml | 79 ++ .../resources/domain/keycloak-server.json | 79 ++ .../resources/standalone/keycloak-server.json | 79 ++ .../resources/standalone/standalone-1.8.1.xml | 392 ++++++++++ .../standalone/standalone-ha-1.8.1.xml | 438 +++++++++++ pom.xml | 12 + 14 files changed, 2788 insertions(+) create mode 100644 distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli create mode 100644 distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli create mode 100644 distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli create mode 100644 distribution/server-config-migration/pom.xml create mode 100644 distribution/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java create mode 100644 distribution/server-config-migration/src/test/resources/domain/domain-1.8.1.xml create mode 100644 distribution/server-config-migration/src/test/resources/domain/host-master-1.8.1.xml create mode 100644 distribution/server-config-migration/src/test/resources/domain/keycloak-server.json create mode 100644 distribution/server-config-migration/src/test/resources/standalone/keycloak-server.json create mode 100644 distribution/server-config-migration/src/test/resources/standalone/standalone-1.8.1.xml create mode 100644 distribution/server-config-migration/src/test/resources/standalone/standalone-ha-1.8.1.xml diff --git a/.gitignore b/.gitignore index 6d655dccbb53..32e898b25ac6 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ nbactions.xml nb-configuration.xml catalog.xml +nbproject # Compiled source # ################### 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.cli new file mode 100644 index 000000000000..0ed854e5ef89 --- /dev/null +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-domain.cli @@ -0,0 +1,263 @@ +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 + +# 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 *** +echo +echo +echo *** Begin Migration of /profile=$clusteredProfile *** +echo + +# Migrate from 1.8.1 to 1.9.1 +if (outcome == failed) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/replicated-cache=work/:read-resource + echo Adding replicated-cache=work to keycloak cache container... + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/replicated-cache=work/:add(mode=SYNC) + echo +end-if +# realmVersions cache deprecated in 2.1.0 +#if (outcome == failed) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource +# echo Adding local-cache=realmVersions to keycloak cache container... +# /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY) +# /profile=$clusteredProfile/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=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak users cache container... + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +# Migrate from 1.9.2 to 2.0.0 +# NO CHANGES + +# Migrate from 2.0.0 to 2.1.0 +if (outcome == success) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource + echo Removing deprecated cache 'realmVersions' + /profile=$clusteredProfile/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=$clusteredProfile/subsystem=keycloak-server/:read-children-names(child-type=spi) + echo Migrating keycloak-server.json to keycloak-server subsystem... + /profile=$clusteredProfile/subsystem=keycloak-server/:migrate-json(file=$pathToJson) + echo +end-if + +# Find if we are using jpa or mongo +if (result == mongo) of /profile=$clusteredProfile/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 (outcome == failed) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=authorization/:read-resource + echo Additing distributed-cache=authorization + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=authorization/:add(mode=SYNC,owners=1) + echo +end-if +if (result == update) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema) + echo Updating connectionsJpa default properties... + /profile=$clusteredProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema) + /profile=$clusteredProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true) + /profile=$clusteredProfile/subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update) + /profile=$clusteredProfile/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=$clusteredProfile/subsystem=keycloak-server/spi=userFederatedStorage/:read-resource + echo Adding spi=userFederatedStorage... + /profile=$clusteredProfile/subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider) + echo +end-if +if (outcome == failed) of /profile=$clusteredProfile/subsystem=keycloak-server/spi=jta-lookup/:read-resource + echo Adding spi=jta-lookup... + /profile=$clusteredProfile/subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss}) + /profile=$clusteredProfile/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=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource + echo Adding local-cache=keys to keycloak cache container... + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/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=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000) + /profile=$clusteredProfile/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=$clusteredProfile/subsystem=keycloak-server/spi=publicKeyStorage/:read-resource + echo Adding spi=publicKeyStorage... + /profile=$clusteredProfile/subsystem=keycloak-server/spi=publicKeyStorage/:add + /profile=$clusteredProfile/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 +if (outcome == success) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/:read-resource + echo Replacing invalidation-cache=users with local-cache=users + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/:remove + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/:add + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy,include-defaults=false) + echo Updating eviction in local-cache=users + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if +if (outcome == success) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=realms/:read-resource + echo Replacing invalidation-cache=realms with local-cache=realms + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/invalidation-cache=realms/:remove + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/:add + echo +end-if + + +# Migrate from 2.4.0 to 2.5.0 +if (result == NONE) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak realms cache... + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU) + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +echo *** End Migration *** \ No newline at end of file diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli new file mode 100644 index 000000000000..7b5dcc735273 --- /dev/null +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone-ha.cli @@ -0,0 +1,145 @@ +embed-server --server-config=standalone-ha.xml + +echo *** Begin Migration *** +echo + +# Migrate from 1.8.1 to 1.9.1 +if (outcome == failed) of /subsystem=infinispan/cache-container=keycloak/replicated-cache=work/:read-resource + echo Adding replicated-cache=work to keycloak cache container... + /subsystem=infinispan/cache-container=keycloak/replicated-cache=work/:add(mode=SYNC) + echo +end-if +# realmVersions cache deprecated in 2.1.0 +#if (outcome == failed) of /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource +# echo Adding local-cache=realmVersions to keycloak cache container... +# /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY) +# /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 /subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak users cache container... + /subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) + /subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +# Migrate from 1.9.2 to 2.0.0 +# NO CHANGES + +# Migrate from 2.0.0 to 2.1.0 +if (outcome == success) of /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource + echo Removing deprecated cache 'realmVersions' + /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:remove + echo +end-if + +# Migrate kecloak-server.json (deprecated in 2.2.0) +if (result == []) of /subsystem=keycloak-server/:read-children-names(child-type=spi) + echo Migrating keycloak-server.json to server cofig xml... + /subsystem=keycloak-server/:migrate-json + echo +end-if + +# Find if we are using jpa or mongo +if (result == mongo) of /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 (outcome == failed) of /extension=org.jboss.as.deployment-scanner/:read-resource + echo Adding deployment-scanner extension... + /extension=org.jboss.as.deployment-scanner/:add(module=org.jboss.as.deployment-scanner) + echo +end-if +if (outcome == failed) of /subsystem=deployment-scanner/:read-resource + echo Adding deployment-scanner... + /subsystem=deployment-scanner/:add + echo +end-if +if (outcome == failed) of /subsystem=deployment-scanner/scanner=default/:read-resource + echo Adding scanner=default + /subsystem=deployment-scanner/scanner=default/:add(path=deployments,relative-to=jboss.server.base.dir,runtime-failure-causes-rollback=${jboss.deployment.scanner.rollback.on.failure:false},scan-interval=5000) + echo +end-if +if (outcome == failed) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=authorization/:read-resource + echo Additing distributed-cache=authorization + /subsystem=infinispan/cache-container=keycloak/distributed-cache=authorization/:add(mode=SYNC,owners=1) + echo +end-if +if (result == update) of /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema) + echo Updating connectionsJpa default properties... + /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema) + /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true) + /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update) + /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 /subsystem=keycloak-server/spi=userFederatedStorage/:read-resource + echo Adding spi=userFederatedStorage... + /subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider) + echo +end-if +if (outcome == failed) of /subsystem=keycloak-server/spi=jta-lookup/:read-resource + echo Adding spi=jta-lookup... + /subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss}) + /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 /subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource + echo Adding local-cache=keys to keycloak cache container... + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY) + echo +end-if +if (result == undefined) of /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... + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU) + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000) + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=expiration/:write-attribute(name=max-idle,value=3600000) + echo +end-if +if (outcome == failed) of /subsystem=keycloak-server/spi=publicKeyStorage/:read-resource + echo Adding spi=publicKeyStorage... + /subsystem=keycloak-server/spi=publicKeyStorage/:add + /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 +if (outcome == success) of /subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/:read-resource + echo Replacing invalidation-cache=users with local-cache=users + /subsystem=infinispan/cache-container=keycloak/invalidation-cache=users/:remove + /subsystem=infinispan/cache-container=keycloak/local-cache=users/:add + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy,include-defaults=false) + echo Updating eviction in local-cache=users... + /subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) + /subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if +if (outcome == success) of /subsystem=infinispan/cache-container=keycloak/invalidation-cache=realms/:read-resource + echo Replacing invalidation-cache=realms with local-cache=realms + /subsystem=infinispan/cache-container=keycloak/invalidation-cache=realms/:remove + /subsystem=infinispan/cache-container=keycloak/local-cache=realms/:add + echo +end-if + + +# Migrate from 2.4.0 to 2.5.0 +if (result == NONE) of /subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak realms cache... + /subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU) + /subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +echo *** End Migration *** \ No newline at end of file diff --git a/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli new file mode 100644 index 000000000000..3398f171b38e --- /dev/null +++ b/distribution/feature-packs/server-feature-pack/src/main/resources/content/bin/migrate-standalone.cli @@ -0,0 +1,135 @@ +embed-server --server-config=standalone.xml + +echo *** Begin Migration *** +echo + +# Migrate from 1.8.1 to 1.9.1 +if (outcome == failed) of /subsystem=infinispan/cache-container=keycloak/local-cache=work/:read-resource + echo Adding local-cache=work to keycloak cache container... + /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 /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource +# echo Adding local-cache=realmVersions to keycloak cache container... +# /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:add(indexing=NONE,start=LAZY) +# /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 /subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak users cache container... + /subsystem=infinispan/cache-container=keycloak/local-cache=users/component=eviction/:write-attribute(name=strategy,value=LRU) + /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 /subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:read-resource + echo Adding local-cache=authorization to keycloak cache container... + /subsystem=infinispan/cache-container=keycloak/local-cache=authorization/:add(indexing=NONE,start=LAZY) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:read-attribute(name=strategy,include-defaults=false) + echo Updating authorization cache container.. + /subsystem=infinispan/cache-container=keycloak/local-cache=authorization/component=eviction/:write-attribute(name=strategy,value=LRU) + /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 /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:read-resource + echo Removing deprecated cache 'realmVersions' + /subsystem=infinispan/cache-container=keycloak/local-cache=realmVersions/:remove + echo +end-if + +# Migrate kecloak-server.json (deprecated in 2.2.0) +if (result == []) of /subsystem=keycloak-server/:read-children-names(child-type=spi) + echo Migrating keycloak-server.json to server cofig xml... + /subsystem=keycloak-server/:migrate-json + echo +end-if + +# Find if we are using jpa or mongo +if (result == mongo) of /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 (outcome == failed) of /extension=org.jboss.as.deployment-scanner/:read-resource + echo Adding deployment-scanner extension... + /extension=org.jboss.as.deployment-scanner/:add(module=org.jboss.as.deployment-scanner) + echo +end-if +if (outcome == failed) of /subsystem=deployment-scanner/:read-resource + echo Adding deployment-scanner... + /subsystem=deployment-scanner/:add + echo +end-if +if (outcome == failed) of /subsystem=deployment-scanner/scanner=default/:read-resource + echo Adding scanner=default + /subsystem=deployment-scanner/scanner=default/:add(path=deployments,relative-to=jboss.server.base.dir,runtime-failure-causes-rollback=${jboss.deployment.scanner.rollback.on.failure:false},scan-interval=5000) + echo +end-if +if (result == update) of /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-get(name=properties,key=databaseSchema) + echo Updating connectionsJpa default properties... + /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-remove(name=properties,key=databaseSchema) + /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=initializeEmpty,value=true) + /subsystem=keycloak-server/spi=connectionsJpa/provider=default/:map-put(name=properties,key=migrationStrategy,value=update) + /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 /subsystem=keycloak-server/spi=userFederatedStorage/:read-resource + echo Adding spi=userFederatedStorage... + /subsystem=keycloak-server/spi=userFederatedStorage/:add(default-provider=$persistenceProvider) + echo +end-if +if (outcome == failed) of /subsystem=keycloak-server/spi=jta-lookup/:read-resource + echo Adding spi=jta-lookup... + /subsystem=keycloak-server/spi=jta-lookup/:add(default-provider=${keycloak.jta.lookup.provider:jboss}) + /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 /subsystem=infinispan/cache-container=keycloak/local-cache=keys/:read-resource + echo Adding local-cache=keys to keycloak cache container... + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/:add(indexing=NONE,start=LAZY) + echo +end-if +if (result == undefined) of /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... + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=strategy,value=LRU) + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=eviction/:write-attribute(name=max-entries,value=1000) + /subsystem=infinispan/cache-container=keycloak/local-cache=keys/component=expiration/:write-attribute(name=max-idle,value=3600000) + echo +end-if +if (outcome == failed) of /subsystem=keycloak-server/spi=publicKeyStorage/:read-resource + echo Adding spi=publicKeyStorage... + /subsystem=keycloak-server/spi=publicKeyStorage/:add + /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 /subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:read-attribute(name=strategy) + echo Adding eviction strategy to keycloak realms cache... + /subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=strategy,value=LRU) + /subsystem=infinispan/cache-container=keycloak/local-cache=realms/component=eviction/:write-attribute(name=max-entries,value=10000) + echo +end-if + +echo *** End Migration *** \ No newline at end of file diff --git a/distribution/pom.xml b/distribution/pom.xml index f0013c6f829f..0ea545b1a327 100755 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -41,6 +41,7 @@ server-dist server-overlay feature-packs + server-config-migration diff --git a/distribution/server-config-migration/pom.xml b/distribution/server-config-migration/pom.xml new file mode 100644 index 000000000000..95ee309ee61e --- /dev/null +++ b/distribution/server-config-migration/pom.xml @@ -0,0 +1,360 @@ + + + + + + 4.0.0 + + + org.keycloak + keycloak-distribution-parent + 2.5.0.Final-SNAPSHOT + ../pom.xml + + + org.keycloak.testsuite + server-config-migration + + Keycloak Migration TestSuite For Server Config + + + ${project.build.directory}/keycloak-${project.version} + + + + + junit + junit + test + + + org.jboss + jboss-dmr + test + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack + compile + + unpack + + + + + org.keycloak + keycloak-server-dist + ${project.version} + zip + true + ${project.build.directory} + + + + + + + + + maven-resources-plugin + + + copy-standalone + generate-test-sources + + copy-resources + + + true + ${jbossHome}/standalone/configuration + + + src/test/resources/standalone + false + + + + + + copy-domain + generate-test-sources + + copy-resources + + + true + ${jbossHome}/domain/configuration + + + src/test/resources/domain + false + + + + + + + + + com.google.code.maven-replacer-plugin + maven-replacer-plugin + + + replaceTokens + process-test-sources + + replace + + + + + + embed-server + #embed-server + + + embed-host-controller + #embed-host-controller + + + :migrate-json(file=$pathToJson) + :migrate-json + + + + + + + false + ${jbossHome} + bin\migrate**.cli + + + + + org.wildfly.plugins + wildfly-maven-plugin + + false + ${jbossHome} + -Djboss.socket.binding.port-offset=1000 + 10990 + + + + + + + migrate-standalone + generate-test-resources + + start + execute-commands + shutdown + + + standalone-1.8.1.xml + + + + + + + + + read-migrated-standalone + process-test-resources + + start + execute-commands + shutdown + + + standalone-1.8.1.xml + + + echo Reading subsystems for migrated standalone-1.8.1.xml + /subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-standalone-1.8.1.txt + + + + + + read-master-standalone + process-test-resources + + start + execute-commands + shutdown + + + standalone.xml + + + echo Reading subsystems for master standalone.xml + /subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-standalone.txt + + + + + + + + migrate-standalone-ha + generate-test-resources + + start + execute-commands + shutdown + + + standalone-ha-1.8.1.xml + + + + + + + + + read-migrated-standalone-ha + process-test-resources + + start + execute-commands + shutdown + + + standalone-ha-1.8.1.xml + + + echo Reading subsystems for migrated standalone-ha-1.8.1.xml + /subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-standalone-ha-1.8.1.txt + + + + + + read-master-standalone-ha + process-test-resources + + start + execute-commands + shutdown + + + standalone-ha.xml + + + echo Reading subsystems for master standalone-ha.xml + /subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-standalone-ha.txt + + + + + + + + migrate-domain + generate-test-resources + + start + execute-commands + shutdown + + + DOMAIN + domain-1.8.1.xml + --host-config=host-master-1.8.1.xml + + + + + -Djboss.management.http.port=10990,-Djboss.management.native.port=10999,-Djboss.server.config.dir=${jbossHome}/domain/configuration/ + + + + + + + + + read-migrated-domain + process-test-resources + + start + execute-commands + shutdown + + + DOMAIN + domain-1.8.1.xml + --host-config=host-master-1.8.1.xml + -Djboss.management.http.port=10990,-Djboss.management.native.port=10999 + + + echo Reading subsystems for migrated domain-1.8.1.xml + /profile=auth-server-standalone/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-domain-standalone-1.8.1.txt + /profile=auth-server-clustered/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/migrated-domain-clustered-1.8.1.txt + + + + + + read-master-domain + process-test-resources + + start + execute-commands + shutdown + + + DOMAIN + domain.xml + -Djboss.management.http.port=10990,-Djboss.management.native.port=10999 + --host-config=host-master.xml + + + echo Reading subsystems for master domain.xml + /profile=auth-server-standalone/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-domain-standalone.txt + /profile=auth-server-clustered/subsystem=*/:read-resource(recursive=true)>${project.build.directory}/master-domain-clustered.txt + + + + + + + + + maven-surefire-plugin + + + + diff --git a/distribution/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java b/distribution/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java new file mode 100644 index 000000000000..f4cda30b79ed --- /dev/null +++ b/distribution/server-config-migration/src/test/java/org/keycloak/test/config/migration/ConfigMigrationTest.java @@ -0,0 +1,71 @@ +/* + * Copyright 2016 Red Hat Inc. and/or its affiliates and other contributors + * as indicated by the @author tags. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package org.keycloak.test.config.migration; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import org.jboss.dmr.ModelNode; +import org.junit.Assert; +import org.junit.Test; + +/** + * Compare outputs from jboss-cli read-resource operations. This compare the total + * configuration of all subsystems to make sure that the version in master + * matches the migrated version. + * + * @author Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc. + */ +public class ConfigMigrationTest { + + private static final File TARGET_DIR = new File("./target"); + + @Test + public void testStandalone() throws IOException { + compareConfigs("master-standalone.txt", "migrated-standalone-1.8.1.txt"); + } + + @Test + public void testStandaloneHA() throws IOException { + compareConfigs("master-standalone-ha.txt", "migrated-standalone-ha-1.8.1.txt"); + } + + @Test + public void testDomain() throws IOException { + compareConfigs("master-domain-standalone.txt", "migrated-domain-standalone-1.8.1.txt"); + compareConfigs("master-domain-clustered.txt", "migrated-domain-clustered-1.8.1.txt"); + } + + private void compareConfigs(String masterConfig, String migratedConfig) throws IOException { + File masterFile = new File(TARGET_DIR, masterConfig); + Assert.assertTrue(masterFile.exists()); + File migratedFile = new File(TARGET_DIR, migratedConfig); + Assert.assertTrue(migratedFile.exists()); + + try ( + FileInputStream masterStream = new FileInputStream(masterFile); + FileInputStream migratedStream = new FileInputStream(migratedFile); + ) { + // Convert to ModelNode to test equality. + // A textual diff might have things out of order. + ModelNode master = ModelNode.fromStream(masterStream); + ModelNode migrated = ModelNode.fromStream(migratedStream); + Assert.assertEquals(master, migrated); + } + } +} diff --git a/distribution/server-config-migration/src/test/resources/domain/domain-1.8.1.xml b/distribution/server-config-migration/src/test/resources/domain/domain-1.8.1.xml new file mode 100644 index 000000000000..7bcbdcef713f --- /dev/null +++ b/distribution/server-config-migration/src/test/resources/domain/domain-1.8.1.xml @@ -0,0 +1,733 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE + h2 + + sa + sa + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auth + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:h2:${jboss.server.data.dir}/../../shared-database/keycloak;AUTO_SERVER=TRUE + h2 + + sa + sa + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auth + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/distribution/server-config-migration/src/test/resources/domain/host-master-1.8.1.xml b/distribution/server-config-migration/src/test/resources/domain/host-master-1.8.1.xml new file mode 100644 index 000000000000..566b4f345d5c --- /dev/null +++ b/distribution/server-config-migration/src/test/resources/domain/host-master-1.8.1.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/distribution/server-config-migration/src/test/resources/domain/keycloak-server.json b/distribution/server-config-migration/src/test/resources/domain/keycloak-server.json new file mode 100644 index 000000000000..89263bf4e59b --- /dev/null +++ b/distribution/server-config-migration/src/test/resources/domain/keycloak-server.json @@ -0,0 +1,79 @@ +{ + "providers": [ + "classpath:${jboss.home.dir}/providers/*" + ], + + "admin": { + "realm": "master" + }, + + "eventsStore": { + "provider": "jpa", + "jpa": { + "exclude-events": [ "REFRESH_TOKEN" ] + } + }, + + "realm": { + "provider": "jpa" + }, + + "user": { + "provider": "jpa" + }, + + "userCache": { + "default" : { + "enabled": true + } + }, + + "userSessionPersister": { + "provider": "jpa" + }, + + "authorizationPersister": { + "provider": "jpa" + }, + + "timer": { + "provider": "basic" + }, + + "theme": { + "staticMaxAge": 2592000, + "cacheTemplates": true, + "cacheThemes": true, + "folder": { + "dir": "${jboss.home.dir}/themes" + } + }, + + "scheduled": { + "interval": 900 + }, + + "connectionsHttpClient": { + "default": {} + }, + + "connectionsJpa": { + "default": { + "dataSource": "java:jboss/datasources/KeycloakDS", + "databaseSchema": "update" + } + }, + + "realmCache": { + "default" : { + "enabled": true + } + }, + + "connectionsInfinispan": { + "provider": "default", + "default": { + "cacheContainer" : "java:comp/env/infinispan/Keycloak" + } + } +} \ No newline at end of file diff --git a/distribution/server-config-migration/src/test/resources/standalone/keycloak-server.json b/distribution/server-config-migration/src/test/resources/standalone/keycloak-server.json new file mode 100644 index 000000000000..89263bf4e59b --- /dev/null +++ b/distribution/server-config-migration/src/test/resources/standalone/keycloak-server.json @@ -0,0 +1,79 @@ +{ + "providers": [ + "classpath:${jboss.home.dir}/providers/*" + ], + + "admin": { + "realm": "master" + }, + + "eventsStore": { + "provider": "jpa", + "jpa": { + "exclude-events": [ "REFRESH_TOKEN" ] + } + }, + + "realm": { + "provider": "jpa" + }, + + "user": { + "provider": "jpa" + }, + + "userCache": { + "default" : { + "enabled": true + } + }, + + "userSessionPersister": { + "provider": "jpa" + }, + + "authorizationPersister": { + "provider": "jpa" + }, + + "timer": { + "provider": "basic" + }, + + "theme": { + "staticMaxAge": 2592000, + "cacheTemplates": true, + "cacheThemes": true, + "folder": { + "dir": "${jboss.home.dir}/themes" + } + }, + + "scheduled": { + "interval": 900 + }, + + "connectionsHttpClient": { + "default": {} + }, + + "connectionsJpa": { + "default": { + "dataSource": "java:jboss/datasources/KeycloakDS", + "databaseSchema": "update" + } + }, + + "realmCache": { + "default" : { + "enabled": true + } + }, + + "connectionsInfinispan": { + "provider": "default", + "default": { + "cacheContainer" : "java:comp/env/infinispan/Keycloak" + } + } +} \ No newline at end of file diff --git a/distribution/server-config-migration/src/test/resources/standalone/standalone-1.8.1.xml b/distribution/server-config-migration/src/test/resources/standalone/standalone-1.8.1.xml new file mode 100644 index 000000000000..f454a7ca60ff --- /dev/null +++ b/distribution/server-config-migration/src/test/resources/standalone/standalone-1.8.1.xml @@ -0,0 +1,392 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE + h2 + + sa + sa + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auth + + + + + + + + + + + + + + + + + + + + + + + diff --git a/distribution/server-config-migration/src/test/resources/standalone/standalone-ha-1.8.1.xml b/distribution/server-config-migration/src/test/resources/standalone/standalone-ha-1.8.1.xml new file mode 100644 index 000000000000..aa9347a3401d --- /dev/null +++ b/distribution/server-config-migration/src/test/resources/standalone/standalone-ha-1.8.1.xml @@ -0,0 +1,438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + h2 + + sa + sa + + + + jdbc:h2:${jboss.server.data.dir}/keycloak;AUTO_SERVER=TRUE + h2 + + sa + sa + + + + + org.h2.jdbcx.JdbcDataSource + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + auth + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml index 5d9d3f0b96f6..200de5ef4bd3 100755 --- a/pom.xml +++ b/pom.xml @@ -51,6 +51,7 @@ 4.5 4.4.1 0.6 + 1.3.0.Final 1.52 3.1.5 1.6.1 @@ -112,6 +113,7 @@ 0.1.12 1.4 + 1.3.5 7.5.Final 1.9.0 1.0.4 @@ -193,6 +195,11 @@ + + org.jboss + jboss-dmr + ${jboss.dmr.version} + com.github.relaxng relaxngDatatype @@ -1373,6 +1380,11 @@ ${surefire.memory.settings} + + com.google.code.maven-replacer-plugin + maven-replacer-plugin + ${replacer.plugin.version} + org.apache.maven.plugins maven-install-plugin