From 333f77a0394a1adc3704906dd52cb104d6509773 Mon Sep 17 00:00:00 2001 From: vramik Date: Mon, 28 Jun 2021 13:57:46 +0200 Subject: [PATCH] KEYCLOAK-18518 Add expiration lifespan configuration to every distributed and replicated cache --- .../content/bin/migrate-domain-clustered.cli | 44 +++++++++++++++++++ .../content/bin/migrate-standalone-ha.cli | 44 +++++++++++++++++++ .../infinispan-dist-keycloak.xml | 22 ++++++++++ .../src/main/resources/cluster-default.xml | 30 +++++++++---- .../keycloak-infinispan.xml | 30 +++++++++---- 5 files changed, 154 insertions(+), 16 deletions(-) diff --git a/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-domain-clustered.cli b/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-domain-clustered.cli index 0b55d502dd..9179af437f 100644 --- a/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-domain-clustered.cli +++ b/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-domain-clustered.cli @@ -757,4 +757,48 @@ if (outcome == failed) of /profile=$clusteredProfile/subsystem=infinispan/cache- echo end-if +# Migrate from 14.0.0 to 15.0.0 + +# Add expiration lifespan configuration to every distributed and replicated cache. +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/replicated-cache=work/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'work' replicated-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/replicated-cache=work/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'sessions' replicated-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=clientSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'clientSessions' distributed-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=clientSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'offlineSessions' distributed-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineClientSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'offlineClientSessions' distributed-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineClientSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'authenticationSessions' distributed-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'loginFailures' distributed-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'actionTokens' distributed-cache + /profile=$clusteredProfile/subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if + echo *** End Migration of /profile=$clusteredProfile *** diff --git a/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-standalone-ha.cli b/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-standalone-ha.cli index ed1bae1735..c415c5bd05 100644 --- a/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-standalone-ha.cli +++ b/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/content/bin/migrate-standalone-ha.cli @@ -888,4 +888,48 @@ if (outcome == success) && (result == "") of /subsystem=jpa:read-attribute(name= echo end-if +# Migrate from 14.0.0 to 15.0.0 + +# Add expiration lifespan configuration to every distributed and replicated cache. +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/replicated-cache=work/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'work' replicated-cache + /subsystem=infinispan/cache-container=keycloak/replicated-cache=work/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'sessions' replicated-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=sessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=clientSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'clientSessions' distributed-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=clientSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'offlineSessions' distributed-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineClientSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'offlineClientSessions' distributed-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=offlineClientSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'authenticationSessions' distributed-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=authenticationSessions/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'loginFailures' distributed-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=loginFailures/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if +if (result == undefined) of /subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens/component=expiration/:read-attribute(name=lifespan) + echo Setting expiration lifespan for 'actionTokens' distributed-cache + /subsystem=infinispan/cache-container=keycloak/distributed-cache=actionTokens/component=expiration/:write-attribute(name=lifespan,value=900000000000000000) + echo +end-if + echo *** End Migration *** diff --git a/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/feature_groups/infinispan-dist-keycloak.xml b/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/feature_groups/infinispan-dist-keycloak.xml index d382a08099..f799bba994 100644 --- a/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/feature_groups/infinispan-dist-keycloak.xml +++ b/distribution/galleon-feature-packs/server-galleon-pack/src/main/resources/feature_groups/infinispan-dist-keycloak.xml @@ -22,26 +22,44 @@ + + + + + + + + + + + + + + + + + + @@ -51,6 +69,9 @@ + + + @@ -70,6 +91,7 @@ + diff --git a/quarkus/runtime/src/main/resources/cluster-default.xml b/quarkus/runtime/src/main/resources/cluster-default.xml index 44c7987867..ffd2217a9e 100644 --- a/quarkus/runtime/src/main/resources/cluster-default.xml +++ b/quarkus/runtime/src/main/resources/cluster-default.xml @@ -37,12 +37,24 @@ - - - - - - + + + + + + + + + + + + + + + + + + @@ -50,7 +62,9 @@ - + + + @@ -64,7 +78,7 @@ - + diff --git a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml index 007d1ea531..8348f71a48 100755 --- a/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml +++ b/wildfly/server-subsystem/src/main/resources/subsystem-templates/keycloak-infinispan.xml @@ -96,23 +96,37 @@ - - - - - - + + + + + + + + + + + + + + + + + + - + + + - +