From df68ca8dcfd481ee64801fbc2cecaa0a6359285d Mon Sep 17 00:00:00 2001 From: Tomas Kyjovsky Date: Tue, 19 Dec 2017 12:42:26 +0100 Subject: [PATCH] KEYCLOAK-5968 Move configuration of Infinispan server from Dockerfile to maven --- testsuite/performance/infinispan/Dockerfile | 31 ---- .../performance/infinispan/configure.xml | 79 +++++++++ testsuite/performance/infinispan/pom.xml | 157 ++++++++++++++++++ .../infinispan/src/main/scripts/Dockerfile | 18 ++ .../main/scripts}/docker-entrypoint-custom.sh | 0 .../{ => src/main/scripts}/get-ips.sh | 0 .../main/scripts}/infinispan-healthcheck.sh | 2 - .../jboss-cli/add-keycloak-caches.cli} | 8 +- .../add-private-network-interface.cli | 0 testsuite/performance/pom.xml | 1 + testsuite/performance/tests/pom.xml | 4 +- .../crossdc/docker-compose-base.yml | 22 +-- 12 files changed, 268 insertions(+), 54 deletions(-) delete mode 100644 testsuite/performance/infinispan/Dockerfile create mode 100644 testsuite/performance/infinispan/configure.xml create mode 100644 testsuite/performance/infinispan/pom.xml create mode 100644 testsuite/performance/infinispan/src/main/scripts/Dockerfile rename testsuite/performance/infinispan/{ => src/main/scripts}/docker-entrypoint-custom.sh (100%) rename testsuite/performance/infinispan/{ => src/main/scripts}/get-ips.sh (100%) rename testsuite/performance/infinispan/{ => src/main/scripts}/infinispan-healthcheck.sh (64%) rename testsuite/performance/infinispan/{configs/add-keycloak-caches.cli.template => src/main/scripts/jboss-cli/add-keycloak-caches.cli} (80%) rename testsuite/performance/infinispan/{configs => src/main/scripts/jboss-cli}/add-private-network-interface.cli (100%) diff --git a/testsuite/performance/infinispan/Dockerfile b/testsuite/performance/infinispan/Dockerfile deleted file mode 100644 index 4b61e2aaba..0000000000 --- a/testsuite/performance/infinispan/Dockerfile +++ /dev/null @@ -1,31 +0,0 @@ -FROM jboss/infinispan-server:8.2.6.Final -#FROM jboss/infinispan-server:9.1.0.Final - -ARG LOCAL_SITE -ARG REMOTE_SITE - -ARG MANAGEMENT_USER -ARG MANAGEMENT_USER_PASS - -USER root -RUN yum -y install iproute -USER jboss - -ENV CONFIGURATION clustered.xml - -ADD configs/ ./ -ADD *.sh /usr/local/bin/ - -RUN sed -e s/%LOCAL_SITE%/$LOCAL_SITE/ -e s/%REMOTE_SITE%/$REMOTE_SITE/ add-keycloak-caches.cli.template > add-keycloak-caches.cli - -USER root -RUN chmod -v +x /usr/local/bin/*.sh -USER jboss - -RUN if [ ! -z "$MANAGEMENT_USER" ]; then $INFINISPAN_SERVER_HOME/bin/add-user.sh -u $MANAGEMENT_USER -p $MANAGEMENT_USER_PASS ; fi -RUN $INFINISPAN_SERVER_HOME/bin/ispn-cli.sh --file=add-private-network-interface.cli; \ - $INFINISPAN_SERVER_HOME/bin/ispn-cli.sh --file=add-keycloak-caches.cli; \ - cd $INFINISPAN_SERVER_HOME/standalone; rm -rf configuration/standalone_xml_history log data tmp - -HEALTHCHECK --interval=5s --timeout=5s --retries=12 CMD ["infinispan-healthcheck.sh"] -ENTRYPOINT [ "docker-entrypoint-custom.sh" ] diff --git a/testsuite/performance/infinispan/configure.xml b/testsuite/performance/infinispan/configure.xml new file mode 100644 index 0000000000..2484ac785c --- /dev/null +++ b/testsuite/performance/infinispan/configure.xml @@ -0,0 +1,79 @@ + + + + + + configured: ${configured} + management.configured: ${management.configured} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Adding management user: `${management.user}` + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testsuite/performance/infinispan/pom.xml b/testsuite/performance/infinispan/pom.xml new file mode 100644 index 0000000000..85d7a30b7c --- /dev/null +++ b/testsuite/performance/infinispan/pom.xml @@ -0,0 +1,157 @@ + + + + + + org.keycloak.testsuite + performance + 4.0.0.CR1-SNAPSHOT + ../pom.xml + + 4.0.0 + + performance-keycloak-infinispan-server + Keycloak Performance TestSuite - Infinispan Server + pom + + + org.infinispan.server + infinispan-server-build + + infinispan-server-${infinispan.version} + ${project.build.directory}/${infinispan.unpacked.folder.name} + + sh + ispn-cli.${script.extension} + add-user.${script.extension} + + ${project.build.scriptSourceDirectory} + ${project.basedir}/src/main/resources + + true + false + + + + + + + maven-dependency-plugin + + + unpack-infinispan-servers + generate-resources + + unpack + + + true + + + ${infinispan.groupId} + ${infinispan.artifactId} + ${infinispan.version} + zip + ${project.build.directory} + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + configure-infinispan + process-resources + + run + + + + + + + + + add-management-user + process-resources + + run + + + ${skip.add.management.user} + + + + + + + prepare-docker-config + process-resources + + run + + + ${skip.docker.config} + + + + + + + + + + + + + + add-management-user + + + management.user + + + + false + + ${management.user} + ${management.user.password} + + + + + windows + + + windows + + + + ps1 + + + + + + \ No newline at end of file diff --git a/testsuite/performance/infinispan/src/main/scripts/Dockerfile b/testsuite/performance/infinispan/src/main/scripts/Dockerfile new file mode 100644 index 0000000000..3001c1596d --- /dev/null +++ b/testsuite/performance/infinispan/src/main/scripts/Dockerfile @@ -0,0 +1,18 @@ +FROM jboss/base-jdk:8 + +ENV LAUNCH_JBOSS_IN_BACKGROUND 1 +ENV CONFIGURATION clustered.xml +ENV INFINISPAN_SERVER_HOME /opt/jboss/infinispan-server +WORKDIR $INFINISPAN_SERVER_HOME + +USER root +RUN yum -y install iproute + +ADD infinispan-server ./ +ADD *.sh /usr/local/bin/ +RUN chown -R jboss .; chgrp -R jboss .; chmod -R -v ug+x bin/*.sh ; chmod -R -v ug+x /usr/local/bin/ + +USER jboss +EXPOSE 7600 8080 8181 8888 9990 11211 11222 57600 +HEALTHCHECK --interval=5s --timeout=5s --retries=12 CMD ["infinispan-healthcheck.sh"] +ENTRYPOINT [ "docker-entrypoint-custom.sh" ] diff --git a/testsuite/performance/infinispan/docker-entrypoint-custom.sh b/testsuite/performance/infinispan/src/main/scripts/docker-entrypoint-custom.sh similarity index 100% rename from testsuite/performance/infinispan/docker-entrypoint-custom.sh rename to testsuite/performance/infinispan/src/main/scripts/docker-entrypoint-custom.sh diff --git a/testsuite/performance/infinispan/get-ips.sh b/testsuite/performance/infinispan/src/main/scripts/get-ips.sh similarity index 100% rename from testsuite/performance/infinispan/get-ips.sh rename to testsuite/performance/infinispan/src/main/scripts/get-ips.sh diff --git a/testsuite/performance/infinispan/infinispan-healthcheck.sh b/testsuite/performance/infinispan/src/main/scripts/infinispan-healthcheck.sh similarity index 64% rename from testsuite/performance/infinispan/infinispan-healthcheck.sh rename to testsuite/performance/infinispan/src/main/scripts/infinispan-healthcheck.sh index b2cadf01fa..4238be43a1 100755 --- a/testsuite/performance/infinispan/infinispan-healthcheck.sh +++ b/testsuite/performance/infinispan/src/main/scripts/infinispan-healthcheck.sh @@ -1,7 +1,5 @@ #!/bin/bash -#$JBOSS_HOME/bin/jboss-cli.sh -c ":read-attribute(name=server-state)" | grep -q "running" - . get-ips.sh CODE=`curl -s -o /dev/null -w "%{http_code}" http://$PUBLIC_IP:9990/console/index.html` diff --git a/testsuite/performance/infinispan/configs/add-keycloak-caches.cli.template b/testsuite/performance/infinispan/src/main/scripts/jboss-cli/add-keycloak-caches.cli similarity index 80% rename from testsuite/performance/infinispan/configs/add-keycloak-caches.cli.template rename to testsuite/performance/infinispan/src/main/scripts/jboss-cli/add-keycloak-caches.cli index 5c98754c77..c119e6d243 100644 --- a/testsuite/performance/infinispan/configs/add-keycloak-caches.cli.template +++ b/testsuite/performance/infinispan/src/main/scripts/jboss-cli/add-keycloak-caches.cli @@ -1,4 +1,4 @@ -embed-server --server-config=clustered.xml +embed-server --server-config=clustered-@LOCAL_SITE@.xml # 2) cd /subsystem=datagrid-jgroups @@ -7,8 +7,8 @@ cd /subsystem=datagrid-jgroups ./channel=xsite:add(stack=tcp-private) # 2.b) -./stack=udp/relay=RELAY:add(site="%LOCAL_SITE%", properties={relay_multicasts=false}) -./stack=udp/relay=RELAY/remote-site=%REMOTE_SITE%:add(channel=xsite) +./stack=udp/relay=RELAY:add(site="@LOCAL_SITE@", properties={relay_multicasts=false}) +./stack=udp/relay=RELAY/remote-site=@REMOTE_SITE@:add(channel=xsite) @@ -19,7 +19,7 @@ cd /subsystem=datagrid-infinispan/cache-container=clustered/configurations=CONFI cd replicated-cache-configuration=sessions-cfg ./transaction=TRANSACTION:add(mode=NON_DURABLE_XA, locking=PESSIMISTIC) ./locking=LOCKING:add(acquire-timeout=0) -./backup=%REMOTE_SITE%:add(failure-policy=FAIL, strategy=SYNC, enabled=true, min-wait=60000, after-failures=3) +./backup=@REMOTE_SITE@:add(failure-policy=FAIL, strategy=SYNC, enabled=true, min-wait=60000, after-failures=3) cd /subsystem=datagrid-infinispan/cache-container=clustered ./replicated-cache=work:add(configuration=sessions-cfg) diff --git a/testsuite/performance/infinispan/configs/add-private-network-interface.cli b/testsuite/performance/infinispan/src/main/scripts/jboss-cli/add-private-network-interface.cli similarity index 100% rename from testsuite/performance/infinispan/configs/add-private-network-interface.cli rename to testsuite/performance/infinispan/src/main/scripts/jboss-cli/add-private-network-interface.cli diff --git a/testsuite/performance/pom.xml b/testsuite/performance/pom.xml index b1b778d8e4..089fcd0a54 100644 --- a/testsuite/performance/pom.xml +++ b/testsuite/performance/pom.xml @@ -39,6 +39,7 @@ keycloak load-balancer/wildfly-modcluster + infinispan tests diff --git a/testsuite/performance/tests/pom.xml b/testsuite/performance/tests/pom.xml index 7173a172a9..e12cdbafae 100644 --- a/testsuite/performance/tests/pom.xml +++ b/testsuite/performance/tests/pom.xml @@ -339,10 +339,12 @@ - + + + diff --git a/testsuite/performance/tests/src/main/docker-compose/crossdc/docker-compose-base.yml b/testsuite/performance/tests/src/main/docker-compose/crossdc/docker-compose-base.yml index 2b6a252d10..2d6c95fd18 100644 --- a/testsuite/performance/tests/src/main/docker-compose/crossdc/docker-compose-base.yml +++ b/testsuite/performance/tests/src/main/docker-compose/crossdc/docker-compose-base.yml @@ -30,20 +30,15 @@ networks: services: infinispan_dc1: - build: - context: infinispan - args: - LOCAL_SITE: dc1 - REMOTE_SITE: dc2 - MANAGEMENT_USER: ${MANAGEMENT_USER} - MANAGEMENT_USER_PASS: ${MANAGEMENT_USER_PASS} - image: keycloak_test_infinispan_dc1:${KEYCLOAK_VERSION:-latest} + build: infinispan + image: keycloak_test_infinispan:${KEYCLOAK_VERSION:-latest} cpuset: ${INFINISPAN_DC1_CPUSET:-1} mem_limit: ${INFINISPAN_MEMLIMIT:-1500m} networks: - ispn_replication - dc1_keycloak environment: + CONFIGURATION: clustered-dc1.xml PUBLIC_SUBNET: 10.1.1.0/24 PRIVATE_SUBNET: 10.0.4.0/24 MGMT_USER: admin @@ -54,14 +49,8 @@ services: - "9990" infinispan_dc2: - build: - context: infinispan - args: - LOCAL_SITE: dc2 - REMOTE_SITE: dc1 - MANAGEMENT_USER: ${MANAGEMENT_USER} - MANAGEMENT_USER_PASS: ${MANAGEMENT_USER_PASS} - image: keycloak_test_infinispan_dc2:${KEYCLOAK_VERSION:-latest} + build: infinispan + image: keycloak_test_infinispan:${KEYCLOAK_VERSION:-latest} depends_on: infinispan_dc1: condition: service_healthy @@ -71,6 +60,7 @@ services: - ispn_replication - dc2_keycloak environment: + CONFIGURATION: clustered-dc2.xml PUBLIC_SUBNET: 10.2.1.0/24 PRIVATE_SUBNET: 10.0.4.0/24 MGMT_USER: admin