Merge pull request #1216 from mposolda/master

KEYCLOAK-1265 Fix import realm in admin console on EAP 6.4, Update docke...
This commit is contained in:
Marek Posolda 2015-05-04 23:34:34 +02:00
commit dea4f4b931
12 changed files with 62 additions and 48 deletions

View file

@ -55,6 +55,7 @@
<module name="org.bouncycastle"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" services="import"/>
<module name="org.jboss.resteasy.resteasy-multipart-provider" services="import"/>
<module name="org.jboss.resteasy.resteasy-jaxrs"/>
</dependencies>
<exclusions>

View file

@ -3,7 +3,7 @@ How to test Keycloak cluster with Docker
Docker+Fig allows to easily setup and test the whole environment with:
* Apache HTTPD 2.4 + modcluster 1.3 as Load Balancer
* MySQL 5.6.1 as database
* Various number of Keycloak cluster nodes running on WildFly with "demo" examples deployed. (See below for EAP 6.3 and AS7)
* Various number of Keycloak cluster nodes running on WildFly with "demo" examples deployed. (See below for EAP 6.4 and AS7)
You don't need to setup Apache with modcluster + MySQL on your laptop as Docker will do it for you and all will run in Docker containers.
@ -133,16 +133,16 @@ changed jars, then rebuild distribution and testsuite/docker-cluster
(or just copy changed JAR into $KEYCLOAK_HOME/testsuite/docker-cluster/target/keycloak-docker-cluster/deployments/auth-server.war/WEB-INF/lib if it's not adapter stuff.
But 'fig rm' is safer to call anyway)
Test with Keycloak and examples on EAP 6.3
Test with Keycloak and examples on EAP 6.4
------------------------------------------
Steps are quite similar like for WildFly but we need to pass different file "fig-eap63.yml" instead of default "fig.yml" which is used for WildFly.
Steps are quite similar like for WildFly but we need to pass different file "fig-eap6.yml" instead of default "fig.yml" which is used for WildFly.
Also name of the node is "eapnode" instead of "wfnode".
So your commands will look like
```shell
$ fig -f fig-eap63.yml build
$ fig -f fig-eap63.yml up
$ fig -f fig-eap63.yml scale eapnode=2
$ fig -f fig-eap6.yml build
$ fig -f fig-eap6.yml up
$ fig -f fig-eap6.yml scale eapnode=2
````
and viceversa.

View file

@ -34,6 +34,13 @@
<directory>target/eap63-adapter</directory>
<outputDirectory>eap63-adapter</outputDirectory>
</fileSet>
<fileSet>
<directory>target/server-overlay</directory>
<outputDirectory>server-overlay</outputDirectory>
<excludes>
<exclude>**/standalone-keycloak.xml</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>shared-files</directory>
<outputDirectory>shared-files</outputDirectory>

View file

@ -6,24 +6,24 @@ USER root
RUN yum install -y unzip && yum install -y wget && yum install -y mc && yum -y install nc
RUN yum clean all
# Drop wildfly
RUN rm -rf /opt/jboss/wildfly*
# Download mysql driver
RUN cd /tmp
RUN wget http://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/5.1.32/mysql-connector-java-5.1.32.jar
RUN mv *.jar mysql-connector-java-5.1.32.jar
RUN mv *.jar /mysql-connector-java-5.1.32.jar
# Drop wildfly
RUN rm -rf /opt/wildfly*
# Download and unpack EAP63 distribution TODO: Check if it's an issue for EAP 6.3
# Download and unpack EAP64 distribution TODO: Check if it's an issue for EAP 6.4
RUN cd /
RUN wget https://dl.dropboxusercontent.com/u/5525920/jboss-eap-6.3.0.zip
RUN wget https://dl.dropboxusercontent.com/u/5525920/jboss-eap-6.4.0.zip
RUN sleep 3
RUN unzip -q jboss-eap-6.3.0.zip
RUN unzip -q jboss-eap-6.4.0.zip
# Make sure the distribution is available from a well-known place
RUN mv jboss-eap-6.3 /opt/eap63
RUN mv jboss-eap-6.4 /opt/eap6
RUN rm -rf jboss-eap-6.3.0.zip
RUN rm -rf jboss-eap-6.4.0.zip
EXPOSE 8787

View file

@ -0,0 +1,18 @@
FROM mposolda/eap64
ADD keycloak-eap6-trigger.sh /keycloak-eap6-trigger.sh
RUN chmod u+x /keycloak-eap6-trigger.sh
# TODO: REmove as it's in base EAP64 image already
RUN cd /tmp
RUN wget http://search.maven.org/remotecontent?filepath=mysql/mysql-connector-java/5.1.32/mysql-connector-java-5.1.32.jar
RUN mv mysql-connector-*.jar /
ENV JBOSS_HOME /opt/eap6
ENV JBOSS_MODULES_HOME $JBOSS_HOME/modules/system/layers/base
ENV JBOSS_TYPE eap6
ENV NODE_PREFIX eap
EXPOSE 8787
CMD [ "/keycloak-eap6-trigger.sh" ]

View file

@ -1,13 +0,0 @@
FROM mposolda/eap63
ADD keycloak-eap63-trigger.sh /keycloak-eap63-trigger.sh
RUN chmod u+x /keycloak-eap63-trigger.sh
ENV JBOSS_HOME /opt/eap63
ENV JBOSS_MODULES_HOME $JBOSS_HOME/modules/system/layers/base
ENV JBOSS_TYPE eap63
ENV NODE_PREFIX eap
EXPOSE 8787
CMD [ "/keycloak-eap63-trigger.sh" ]

View file

@ -16,8 +16,8 @@ mysql:
ports:
- "33306:3306"
eapnode:
build: eap63
command: /keycloak-eap63-trigger.sh
build: eap6
command: /keycloak-eap6-trigger.sh
volumes:
- target/keycloak-docker-cluster:/keycloak-docker-cluster
volumes_from:

View file

@ -41,26 +41,30 @@
<artifactItems>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-war-deployment</artifactId>
<artifactId>keycloak-server-overlay</artifactId>
<type>zip</type>
<outputDirectory>${project.build.directory}</outputDirectory>
<version>${project.version}</version>
<outputDirectory>${project.build.directory}/server-overlay</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-wildfly-adapter-dist</artifactId>
<type>zip</type>
<version>${project.version}</version>
<outputDirectory>${project.build.directory}/wildfly-adapter</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-as7-adapter-dist</artifactId>
<type>zip</type>
<version>${project.version}</version>
<outputDirectory>${project.build.directory}/as7-adapter</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-eap6-adapter-dist</artifactId>
<type>zip</type>
<version>${project.version}</version>
<outputDirectory>${project.build.directory}/eap63-adapter</outputDirectory>
</artifactItem>
</artifactItems>

View file

@ -1,5 +1,11 @@
#!/bin/bash
# Copy Overlay
cp -r /keycloak-docker-cluster/server-overlay/* $JBOSS_HOME/
# Deploy and configure examples
/keycloak-docker-cluster/shared-files/deploy-examples.sh
# Copy MySQL driver
cd /tmp
mkdir -p mysql/main && mv /mysql-connector-java-5.1.32.jar mysql/main/
@ -7,7 +13,7 @@ cp /keycloak-docker-cluster/shared-files/mysql-module.xml mysql/main/module.xml
mv mysql $JBOSS_MODULES_HOME/com/
sed -i -e "s/<extensions>/&\n <extension module=\"org.keycloak.keycloak-subsystem\"\/>/" $JBOSS_HOME/standalone/configuration/standalone-ha.xml
sed -i -e 's/<profile>/&\n <subsystem xmlns="urn:jboss:domain:keycloak:1.0"\/>/' $JBOSS_HOME/standalone/configuration/standalone-ha.xml && \
sed -i -e 's/<profile>/&\n <subsystem xmlns="urn:jboss:domain:keycloak:1.0">\n <auth-server name="main-auth-server">\n <enabled>true<\/enabled>\n <web-context>auth<\/web-context>\n <\/auth-server> \n <\/subsystem>/' $JBOSS_HOME/standalone/configuration/standalone-ha.xml && \
sed -i -e 's/<security-domains>/&\n <security-domain name="keycloak">\n <authentication>\n <login-module code="org.keycloak.adapters.jboss.KeycloakLoginModule" flag="required"\/>\n <\/authentication>\n <\/security-domain>/' $JBOSS_HOME/standalone/configuration/standalone-ha.xml && \
sed -i -e 's/<drivers>/&\n <driver name="mysql" module="com.mysql">\n <xa-datasource-class>com.mysql.jdbc.Driver<\/xa-datasource-class>\n <driver-class>com.mysql.jdbc.Driver<\/driver-class>\n <\/driver>/' $JBOSS_HOME/standalone/configuration/standalone-ha.xml && \
sed -i -e 's/<\/periodic-rotating-file-handler>/&\n <logger category=\"org.keycloak\">\n <level name=\"DEBUG\" \/> \n <\/logger>\n <logger category=\"org.jboss.resteasy.core.ResourceLocator\">\n <level name=\"ERROR\" \/> \n <\/logger>/' $JBOSS_HOME/standalone/configuration/standalone-ha.xml
@ -23,3 +29,7 @@ sed -i "s|<mod-cluster-config .*>|<mod-cluster-config advertise-socket=\"modclus
sed -i "s|#JAVA_OPTS=\"\$JAVA_OPTS -agentlib:jdwp=transport=dt_socket|JAVA_OPTS=\"\$JAVA_OPTS -agentlib:jdwp=transport=dt_socket|" $JBOSS_HOME/bin/standalone.conf
cp /keycloak-docker-cluster/shared-files/mysql-keycloak-ds.xml $JBOSS_HOME/standalone/deployments/
# Enable Infinispan provider
sed -i "s|\"provider\".*: \"mem\"|\"provider\": \"infinispan\"|" $JBOSS_HOME/standalone/configuration/keycloak-server.json
sed -i -e "s/\"connectionsJpa\"/\n \"connectionsInfinispan\": \{\n \"default\" : \{\n \"cacheContainer\" : \"java:jboss\/infinispan\/Keycloak\"\n \}\n \},\n &/" $JBOSS_HOME/standalone/configuration/keycloak-server.json

View file

@ -16,19 +16,6 @@ function prepareHost
echo "Base prepare finished";
cd $JBOSS_HOME
cp -r /keycloak-docker-cluster/$JBOSS_TYPE-adapter/modules ./
# Deploy keycloak
cp -r /keycloak-docker-cluster/deployments/* $JBOSS_HOME/standalone/deployments/
# Enable Infinispan provider
sed -i "s|\"provider\".*: \"mem\"|\"provider\": \"infinispan\"|" $JBOSS_HOME/standalone/deployments/auth-server.war/WEB-INF/classes/META-INF/keycloak-server.json
sed -i -e "s/\"connectionsJpa\"/\n \"connectionsInfinispan\": \{\n \"default\" : \{\n \"cacheContainer\" : \"java:jboss\/infinispan\/Keycloak\"\n \}\n \},\n &/" $JBOSS_HOME/standalone/deployments/auth-server.war/WEB-INF/classes/META-INF/keycloak-server.json
# Deploy and configure examples
/keycloak-docker-cluster/shared-files/deploy-examples.sh
# Deploy to volume
rm -rf /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST
cp -r $JBOSS_HOME /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST

View file

@ -1,4 +1,4 @@
FROM jboss/wildfly
FROM jboss/wildfly:8.2.0.Final
USER root
@ -14,7 +14,7 @@ RUN mv *.jar /mysql-connector-java-5.1.32.jar
ADD keycloak-wildfly-trigger.sh /keycloak-wildfly-trigger.sh
RUN chmod u+x /keycloak-wildfly-trigger.sh
ENV JBOSS_HOME /opt/wildfly-8.1.0.Final
ENV JBOSS_HOME /opt/jboss/wildfly
ENV JBOSS_MODULES_HOME $JBOSS_HOME/modules/system/layers/base
ENV JBOSS_TYPE wildfly
ENV NODE_PREFIX wf