KEYCLOAK-1678: Configuration of remote (tcp) H2 datasource for wildfly.
This commit is contained in:
parent
96a00317b8
commit
a264c15886
3 changed files with 113 additions and 25 deletions
|
@ -40,6 +40,13 @@
|
||||||
<module>wildfly</module>
|
<module>wildfly</module>
|
||||||
</modules>
|
</modules>
|
||||||
</profile>
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>auth-server-wildfly-cluster</id>
|
||||||
|
<modules>
|
||||||
|
<module>wildfly</module>
|
||||||
|
</modules>
|
||||||
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>auth-server-eap7</id>
|
<id>auth-server-eap7</id>
|
||||||
<modules>
|
<modules>
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
|
||||||
~ and other contributors as indicated by the @author tags.
|
~ and other contributors as indicated by the @author tags.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
~ you may not use this file except in compliance with the License.
|
~ you may not use this file except in compliance with the License.
|
||||||
~ You may obtain a copy of the License at
|
~ You may obtain a copy of the License at
|
||||||
~
|
~
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~
|
~
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
~ Unless required by applicable law or agreed to in writing, software
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
~ See the License for the specific language governing permissions and
|
~ See the License for the specific language governing permissions and
|
||||||
~ limitations under the License.
|
~ limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
@ -254,16 +254,16 @@
|
||||||
<goal>copy-resources</goal>
|
<goal>copy-resources</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<outputDirectory>${keycloak.server.home}/standalone/configuration</outputDirectory>
|
<outputDirectory>${keycloak.server.home}/standalone/configuration</outputDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/keystore</directory>
|
<directory>src/main/keystore</directory>
|
||||||
<includes>
|
<includes>
|
||||||
<include>keycloak.jks</include>
|
<include>keycloak.jks</include>
|
||||||
<include>keycloak.truststore</include>
|
<include>keycloak.truststore</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
@ -412,5 +412,50 @@
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>auth-server-wildfly-cluster</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>xml-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>configure-wildfly-datasource</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>transform</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<transformationSets>
|
||||||
|
<!-- point KeycloakDS datasource to H2 running on TCP port -->
|
||||||
|
<transformationSet>
|
||||||
|
<dir>${keycloak.server.home}/standalone/configuration</dir>
|
||||||
|
<includes>
|
||||||
|
<include>standalone-ha.xml</include>
|
||||||
|
</includes>
|
||||||
|
<stylesheet>src/main/xslt/datasource-jdbc-url.xsl</stylesheet>
|
||||||
|
<outputDir>${keycloak.server.home}/standalone/configuration</outputDir>
|
||||||
|
<parameters>
|
||||||
|
<parameter>
|
||||||
|
<name>pool.name</name>
|
||||||
|
<value>KeycloakDS</value>
|
||||||
|
</parameter>
|
||||||
|
<parameter>
|
||||||
|
<name>jdbc.url</name>
|
||||||
|
<value>jdbc:h2:tcp://${jboss.bind.address:localhost}:9092/mem:keycloak;DB_CLOSE_DELAY=-1</value>
|
||||||
|
</parameter>
|
||||||
|
</parameters>
|
||||||
|
</transformationSet>
|
||||||
|
</transformationSets>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
</profiles>
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:xalan="http://xml.apache.org/xalan"
|
||||||
|
xmlns:j="urn:jboss:domain:4.0"
|
||||||
|
xmlns:ds="urn:jboss:domain:datasources:4.0"
|
||||||
|
xmlns:k="urn:jboss:domain:keycloak:1.1"
|
||||||
|
xmlns:sec="urn:jboss:domain:security:1.2"
|
||||||
|
version="2.0"
|
||||||
|
exclude-result-prefixes="xalan j ds k sec">
|
||||||
|
|
||||||
|
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
|
||||||
|
<xsl:strip-space elements="*"/>
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:variable name="nsDS" select="'urn:jboss:domain:datasources:'"/>
|
||||||
|
|
||||||
|
<xsl:param name="pool.name" select="'KeycloakDS'"/>
|
||||||
|
<xsl:param name="jdbc.url" />
|
||||||
|
|
||||||
|
<!-- replace JDBC URL -->
|
||||||
|
<xsl:template match="//*[local-name()='subsystem' and starts-with(namespace-uri(), $nsDS)]
|
||||||
|
/*[local-name()='datasources' and starts-with(namespace-uri(), $nsDS)]
|
||||||
|
/*[local-name()='datasource' and starts-with(namespace-uri(), $nsDS) and @pool-name=$pool.name]
|
||||||
|
/*[local-name()='connection-url' and starts-with(namespace-uri(), $nsDS)]">
|
||||||
|
<connection-url>
|
||||||
|
<xsl:value-of select="$jdbc.url"/>
|
||||||
|
</connection-url>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- Copy everything else. -->
|
||||||
|
<xsl:template match="@*|node()">
|
||||||
|
<xsl:copy>
|
||||||
|
<xsl:apply-templates select="@*|node()" />
|
||||||
|
</xsl:copy>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
Loading…
Reference in a new issue