KEYCLOAK-1265 Fix import realm in admin console on EAP 6.4, Update docker-cluster

This commit is contained in:
mposolda 2015-05-04 23:16:42 +02:00
parent c1708ea7d5
commit 3d26ab8817
12 changed files with 62 additions and 48 deletions

View file

@ -55,6 +55,7 @@
<module name="org.bouncycastle"/> <module name="org.bouncycastle"/>
<module name="org.jboss.resteasy.resteasy-jackson-provider" services="import"/> <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"/> <module name="org.jboss.resteasy.resteasy-jaxrs"/>
</dependencies> </dependencies>
<exclusions> <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: Docker+Fig allows to easily setup and test the whole environment with:
* Apache HTTPD 2.4 + modcluster 1.3 as Load Balancer * Apache HTTPD 2.4 + modcluster 1.3 as Load Balancer
* MySQL 5.6.1 as database * 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. 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. (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) 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". Also name of the node is "eapnode" instead of "wfnode".
So your commands will look like So your commands will look like
```shell ```shell
$ fig -f fig-eap63.yml build $ fig -f fig-eap6.yml build
$ fig -f fig-eap63.yml up $ fig -f fig-eap6.yml up
$ fig -f fig-eap63.yml scale eapnode=2 $ fig -f fig-eap6.yml scale eapnode=2
```` ````
and viceversa. and viceversa.

View file

@ -34,6 +34,13 @@
<directory>target/eap63-adapter</directory> <directory>target/eap63-adapter</directory>
<outputDirectory>eap63-adapter</outputDirectory> <outputDirectory>eap63-adapter</outputDirectory>
</fileSet> </fileSet>
<fileSet>
<directory>target/server-overlay</directory>
<outputDirectory>server-overlay</outputDirectory>
<excludes>
<exclude>**/standalone-keycloak.xml</exclude>
</excludes>
</fileSet>
<fileSet> <fileSet>
<directory>shared-files</directory> <directory>shared-files</directory>
<outputDirectory>shared-files</outputDirectory> <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 install -y unzip && yum install -y wget && yum install -y mc && yum -y install nc
RUN yum clean all RUN yum clean all
# Drop wildfly
RUN rm -rf /opt/jboss/wildfly*
# Download mysql driver # Download mysql driver
RUN cd /tmp 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 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 # Download and unpack EAP64 distribution TODO: Check if it's an issue for EAP 6.4
RUN rm -rf /opt/wildfly*
# Download and unpack EAP63 distribution TODO: Check if it's an issue for EAP 6.3
RUN cd / 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 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 # 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 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: ports:
- "33306:3306" - "33306:3306"
eapnode: eapnode:
build: eap63 build: eap6
command: /keycloak-eap63-trigger.sh command: /keycloak-eap6-trigger.sh
volumes: volumes:
- target/keycloak-docker-cluster:/keycloak-docker-cluster - target/keycloak-docker-cluster:/keycloak-docker-cluster
volumes_from: volumes_from:

View file

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

View file

@ -1,5 +1,11 @@
#!/bin/bash #!/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 # Copy MySQL driver
cd /tmp cd /tmp
mkdir -p mysql/main && mv /mysql-connector-java-5.1.32.jar mysql/main/ 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/ 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/<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/<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/<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 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 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/ 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"; 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 # Deploy to volume
rm -rf /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST rm -rf /keycloak-docker-shared/keycloak-$JBOSS_TYPE-$MYHOST
cp -r $JBOSS_HOME /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 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 ADD keycloak-wildfly-trigger.sh /keycloak-wildfly-trigger.sh
RUN chmod u+x /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_MODULES_HOME $JBOSS_HOME/modules/system/layers/base
ENV JBOSS_TYPE wildfly ENV JBOSS_TYPE wildfly
ENV NODE_PREFIX wf ENV NODE_PREFIX wf