KEYCLOAK-18589 map-storage profile for KeycloakServer

This commit is contained in:
Hynek Mlnarik 2021-06-29 13:20:29 +02:00 committed by Hynek Mlnařík
parent aab6782bae
commit 8a83ec83ac
4 changed files with 35 additions and 2 deletions

View file

@ -22,6 +22,7 @@ import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatfor
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.keycloak.Config; import org.keycloak.Config;
import org.keycloak.ServerStartupError; import org.keycloak.ServerStartupError;
import org.keycloak.common.util.StackUtil;
import org.keycloak.common.util.StringPropertyReplacer; import org.keycloak.common.util.StringPropertyReplacer;
import org.keycloak.connections.jpa.updater.JpaUpdaterProvider; import org.keycloak.connections.jpa.updater.JpaUpdaterProvider;
import org.keycloak.connections.jpa.util.JpaUtils; import org.keycloak.connections.jpa.util.JpaUtils;
@ -132,7 +133,7 @@ public class DefaultJpaConnectionProviderFactory implements JpaConnectionProvide
synchronized (this) { synchronized (this) {
if (emf == null) { if (emf == null) {
KeycloakModelUtils.suspendJtaTransaction(session.getKeycloakSessionFactory(), () -> { KeycloakModelUtils.suspendJtaTransaction(session.getKeycloakSessionFactory(), () -> {
logger.debug("Initializing JPA connections"); logger.debugf("Initializing JPA connections%s", StackUtil.getShortStackTrace());
Map<String, Object> properties = new HashMap<>(); Map<String, Object> properties = new HashMap<>();

View file

@ -271,6 +271,34 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>map-storage</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<systemProperties>
<systemProperty><key>keycloak.profile.feature.map_storage</key><value>enabled</value></systemProperty>
<systemProperty><key>keycloak.mapStorage.provider</key><value>concurrenthashmap</value></systemProperty>
<systemProperty><key>keycloak.realm.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.client.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.clientScope.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.group.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.role.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.user.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.serverInfo.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.authSession.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.userSession.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.loginFailure.provider</key><value>map</value></systemProperty>
<systemProperty><key>keycloak.authorization.provider</key><value>map</value></systemProperty>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>mail-server</id> <id>mail-server</id>
<build> <build>

View file

@ -63,7 +63,9 @@
"mapStorage": { "mapStorage": {
"provider": "${keycloak.mapStorage.provider:}", "provider": "${keycloak.mapStorage.provider:}",
"concurrenthashmap": { "concurrenthashmap": {
"dir": "${project.build.directory:target}" "dir": "${project.build.directory:target/map}",
"keyType.realms": "string",
"keyType.authz-resource-servers": "string"
} }
}, },

View file

@ -113,3 +113,5 @@ log4j.logger.org.apache.directory.server.ldap.LdapProtocolHandler=error
# Client policies # Client policies
#log4j.logger.org.keycloak.services.clientpolicy=trace #log4j.logger.org.keycloak.services.clientpolicy=trace
#log4j.logger.org.keycloak.STACK_TRACE=trace