KEYCLOAK-7440 Modcluster configuration for functional cluster test is broken

This commit is contained in:
Tomas Kyjovsky 2018-06-06 04:53:44 +02:00 committed by Hynek Mlnařík
parent b7fb3ec9a9
commit 1b4d9a6147
13 changed files with 164 additions and 259 deletions

View file

@ -0,0 +1,47 @@
<project>
<target name="check-configuration-state">
<available property="modcluster-configured" file="${project.build.directory}/modcluster-configured"/>
<echo>modcluster-configured: ${modcluster-configured}</echo>
<available property="crossdc-configured" file="${project.build.directory}/crossdc-configured"/>
<echo>crossdc-configured: ${crossdc-configured}</echo>
</target>
<macrodef name="bin-chmod">
<sequential>
<chmod perm="ug+x">
<fileset dir="${auth.server.home}/bin">
<include name="*.sh"/>
</fileset>
</chmod>
</sequential>
</macrodef>
<macrodef name="cleanup">
<sequential>
<delete dir="${auth.server.home}/standalone/configuration/standalone_xml_history"/>
<delete dir="${auth.server.home}/standalone/log"/>
<delete dir="${auth.server.home}/standalone/data"/>
<delete dir="${auth.server.home}/standalone/tmp"/>
</sequential>
</macrodef>
<target name="modcluster" unless="modcluster-configured" depends="check-configuration-state">
<bin-chmod/>
<exec dir="${auth.server.home}/bin" executable="./${jboss.cli.executable}" failonerror="true">
<arg value="--file=${common.resources}/jboss-cli/modcluster-simple-load-provider.cli"/>
</exec>
<cleanup/>
<touch file="${project.build.directory}/modcluster-configured"/>
</target>
<target name="crossdc" unless="crossdc-configured" depends="check-configuration-state">
<bin-chmod/>
<exec dir="${auth.server.home}/bin" executable="./${jboss.cli.executable}" failonerror="true">
<arg value="--file=${common.resources}/jboss-cli/cross-dc-setup.cli"/>
</exec>
<cleanup/>
<touch file="${project.build.directory}/crossdc-configured"/>
</target>
</project>

View file

@ -0,0 +1,7 @@
embed-server --server-config=standalone-ha.xml
# remove dynamic-load-provider
/subsystem=modcluster/mod-cluster-config=configuration/dynamic-load-provider=configuration:remove
# add simple-load-provider with factor=1 to assure round-robin balancing
/subsystem=modcluster/mod-cluster-config=configuration:write-attribute(name=simple-load-provider, value=1)

View file

@ -1,55 +0,0 @@
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:param name="load.metric" select="'simple'" />\
<!-- mod-cluster-config -->
<xsl:template match="//*[local-name()='mod-cluster-config']">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<xsl:choose>
<xsl:when test="$load.metric='simple'">
<simple-load-provider factor="1"/>
</xsl:when>
<xsl:otherwise>
<dynamic-load-provider>
<load-metric type="{$load.metric}"/>
</dynamic-load-provider>
</xsl:otherwise>
</xsl:choose>
</mod-cluster-config>
</xsl:template>
<!--add socket-binding-->
<xsl:template match="//*[local-name()='socket-binding-group' and @name='standard-sockets']/*[local-name()='socket-binding' and @name='modcluster']">
<socket-binding name="modcluster" interface="private" port="0" multicast-address="${{jboss.default.multicast.address:230.0.0.4}}" multicast-port="23364"/>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -32,7 +32,7 @@
<name>Auth Server - JBoss</name>
<properties>
<common.resources>${project.parent.basedir}/common</common.resources>
<common.resources>${basedir}/../common</common.resources>
<assembly.xml>${project.parent.basedir}/assembly.xml</assembly.xml>
<!--server-dist-->
@ -263,6 +263,10 @@
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
@ -659,37 +663,19 @@
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>crossdc-setup</id>
<id>configure-crossdc</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
<goal>run</goal>
</goals>
<configuration>
<executable>${auth.server.home}/bin/jboss-cli.sh</executable>
<arguments>
<argument>--file=${common.resources}/crossdc/cross-dc-setup.cli</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>remove-temp-data-crossdc-setup</id>
<phase>process-resources</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<workingDirectory>${auth.server.home}/standalone/</workingDirectory>
<executable>rm</executable>
<arguments>
<argument>-rf</argument>
<argument>data</argument>
<argument>log</argument>
<argument>tmp</argument>
</arguments>
<target>
<ant antfile="${common.resources}/ant/configure.xml" target="crossdc" />
</target>
</configuration>
</execution>
</executions>
@ -782,33 +768,28 @@
</transformationSets>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>mod-cluster-configuration</id>
<id>configure-modcluster</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
<goal>run</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${auth.server.home}/standalone/configuration</dir>
<includes>
<include>standalone-ha.xml</include>
</includes>
<stylesheet>${common.resources}/mod_cluster.xsl</stylesheet>
<outputDir>${auth.server.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
<name>load.metric</name>
<value>${load.metric}</value>
</parameter>
</parameters>
</transformationSet>
</transformationSets>
<target>
<ant antfile="${common.resources}/ant/configure.xml" target="modcluster" />
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

View file

@ -52,9 +52,12 @@
<jboss.default.worker.io-threads>16</jboss.default.worker.io-threads>
<jboss.default.worker.task-max-threads>128</jboss.default.worker.task-max-threads>
<jboss.default.http.max-connections>500</jboss.default.http.max-connections>
<cache.default.worker.io-threads>2</cache.default.worker.io-threads>
<cache.default.worker.task-max-threads>4</cache.default.worker.task-max-threads>
<jboss.cli.executable>jboss-cli.sh</jboss.cli.executable>
</properties>
<modules>
@ -87,6 +90,7 @@
</activation>
<properties>
<script.suffix>bat</script.suffix>
<jboss.cli.executable>jboss-cli.ps1</jboss.cli.executable>
</properties>
</profile>

View file

@ -33,9 +33,13 @@
<wildfly.balancer.home>${project.build.directory}/unpacked/wildfly-${wildfly.version}</wildfly.balancer.home>
<wildfly.balancer.worker.io-threads>${jboss.default.worker.io-threads}</wildfly.balancer.worker.io-threads>
<wildfly.balancer.worker.task-max-threads>${jboss.default.worker.task-max-threads}</wildfly.balancer.worker.task-max-threads>
<wildfly.balancer.http.max-connections>${jboss.default.http.max-connections}</wildfly.balancer.http.max-connections>
<script.sources.dir>${project.build.scriptSourceDirectory}</script.sources.dir>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
@ -60,62 +64,47 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>io-worker-threads</id>
<phase>process-resources</phase>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>transform</goal>
<goal>copy-resources</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${wildfly.balancer.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/io.xsl</stylesheet>
<outputDir>${wildfly.balancer.home}/standalone/configuration</outputDir>
<parameters>
<parameter>
<name>worker.io-threads</name>
<value>${wildfly.balancer.worker.io-threads}</value>
</parameter>
<parameter>
<name>worker.task-max-threads</name>
<value>${wildfly.balancer.worker.task-max-threads}</value>
</parameter>
</parameters>
</transformationSet>
</transformationSets>
</configuration>
<outputDirectory>${wildfly.balancer.home}/bin</outputDirectory>
<resources>
<resource>
<directory>${script.sources.dir}/jboss-cli</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>configure-mod-cluster</id>
<id>configure-wildfly-modcluster</id>
<phase>process-resources</phase>
<goals>
<goal>transform</goal>
<goal>run</goal>
</goals>
<configuration>
<transformationSets>
<transformationSet>
<dir>${wildfly.balancer.home}/standalone/configuration</dir>
<includes>
<include>standalone.xml</include>
</includes>
<stylesheet>src/main/xslt/mod_cluster.xsl</stylesheet>
<outputDir>${wildfly.balancer.home}/standalone/configuration</outputDir>
</transformationSet>
</transformationSets>
<target>
<ant antfile="${script.sources.dir}/ant/configure.xml" target="wildfly-modcluster" />
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>

View file

@ -0,0 +1,31 @@
<project>
<target name="check-configuration-state">
<available property="wildfly-modcluster-configured" file="${project.build.directory}/wildfly-modcluster-configured"/>
<echo>wildfly-modcluster-configured: ${wildfly-modcluster-configured}</echo>
</target>
<target name="wildfly-modcluster" unless="wildfly-modcluster-configured" depends="check-configuration-state">
<chmod perm="ug+x">
<fileset dir="${wildfly.balancer.home}/bin">
<include name="*.sh"/>
</fileset>
</chmod>
<exec executable="./${jboss.cli.executable}" dir="${wildfly.balancer.home}/bin" failonerror="true">
<arg value="--file=mod-cluster-balancer.cli"/>
</exec>
<exec executable="./${jboss.cli.executable}" dir="${wildfly.balancer.home}/bin" failonerror="true">
<arg value="--file=undertow.cli"/>
</exec>
<exec executable="./${jboss.cli.executable}" dir="${wildfly.balancer.home}/bin" failonerror="true">
<arg value="--file=io-worker-threads.cli"/>
</exec>
<delete dir="${wildfly.balancer.home}/standalone/configuration/standalone_xml_history"/>
<delete dir="${wildfly.balancer.home}/standalone/log"/>
<delete dir="${wildfly.balancer.home}/standalone/data"/>
<delete dir="${wildfly.balancer.home}/standalone/tmp"/>
<touch file="${project.build.directory}/wildfly-modcluster-configured"/>
</target>
</project>

View file

@ -0,0 +1,7 @@
embed-server --server-config=standalone.xml
# default is cpuCount * 2
/subsystem=io/worker=default:write-attribute(name=io-threads,value=${wildfly.balancer.worker.io-threads})
# default is cpuCount * 16
/subsystem=io/worker=default:write-attribute(name=task-max-threads,value=${jboss.default.worker.task-max-threads})

View file

@ -0,0 +1,12 @@
embed-server --server-config=standalone.xml
/interface=private:add(inet-address=${jboss.bind.address.private:127.0.0.1})
/socket-binding-group=standard-sockets/socket-binding=modcluster-advertise:add(interface=private, multicast-port=23364, multicast-address=${jboss.default.multicast.address:224.0.1.105})
/socket-binding-group=standard-sockets/socket-binding=modcluster-management:add(interface=private, port=6666)
/extension=org.jboss.as.modcluster/:add
/subsystem=undertow/configuration=filter/mod-cluster=modcluster:add(advertise-socket-binding=modcluster-advertise, advertise-frequency=${modcluster.advertise-frequency:2000}, management-socket-binding=modcluster-management, enable-http2=true)
/subsystem=undertow/server=default-server/host=default-host/filter-ref=modcluster:add
/subsystem=undertow/server=default-server/http-listener=modcluster:add(socket-binding=modcluster-management, enable-http2=true)

View file

@ -0,0 +1,2 @@
embed-server --server-config=standalone.xml
/subsystem=undertow/server=default-server/http-listener=default:write-attribute(name=max-connections,value=${wildfly.balancer.http.max-connections})

View file

@ -1,40 +0,0 @@
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<xsl:param name="worker.io-threads" select="'16'"/>
<xsl:param name="worker.task-max-threads" select="'128'"/>
<!--set worker threads-->
<xsl:template match="//*[local-name()='worker' and @name='default']">
<worker name="default" io-threads="{$worker.io-threads}" task-max-threads="{$worker.task-max-threads}" />
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,80 +0,0 @@
<!--
~ Copyright 2016 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ 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.
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xalan="http://xml.apache.org/xalan"
version="2.0"
exclude-result-prefixes="xalan">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" xalan:indent-amount="4" standalone="no"/>
<xsl:strip-space elements="*"/>
<!--enable mod_cluster extension-->
<xsl:template match="//*[local-name()='extensions']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<extension module="org.jboss.as.modcluster"/>
</xsl:copy>
</xsl:template>
<!--add filter-ref-->
<xsl:template match="//*[local-name()='server' and @name='default-server']/*[local-name()='host' and @name='default-host']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<filter-ref name="modcluster"/>
</xsl:copy>
</xsl:template>
<!--add filter-->
<xsl:template match="//*[local-name()='subsystem']/*[local-name()='filters']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<mod-cluster
name="modcluster"
advertise-socket-binding="modcluster"
advertise-frequency="${{modcluster.advertise-frequency:2000}}"
management-socket-binding="http"
enable-http2="true"
/>
</xsl:copy>
</xsl:template>
<!--add private interface -->
<xsl:template match="/*[local-name()='server']/*[local-name()='interfaces']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<interface name="private">
<inet-address value="${{jboss.bind.address.private:127.0.0.1}}"/>
</interface>
</xsl:copy>
</xsl:template>
<!--add socket binding-->
<xsl:template match="//*[local-name()='socket-binding-group' and @name='standard-sockets']">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
<socket-binding name="modcluster" interface="private" port="23364" multicast-address="${{jboss.default.multicast.address:230.0.0.4}}" multicast-port="23364" />
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>