From 5385c6648b9bf93ef94c55407e4dd611d5c8cd8c Mon Sep 17 00:00:00 2001 From: Radoslav Husar Date: Mon, 23 Sep 2024 11:17:01 +0200 Subject: [PATCH] feat: add scripts and examples how to configure clusterbench for singleton deployment (resolves #504) --- README.adoc | 68 ++++++++++++++++++- scripts/singleton-deployment-overlay-add.cli | 7 ++ .../singleton-deployment-overlay-remove.cli | 7 ++ scripts/singleton-deployment.xml | 6 ++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 scripts/singleton-deployment-overlay-add.cli create mode 100644 scripts/singleton-deployment-overlay-remove.cli create mode 100644 scripts/singleton-deployment.xml diff --git a/README.adoc b/README.adoc index 9c51e73a..ccb41ca9 100644 --- a/README.adoc +++ b/README.adoc @@ -232,14 +232,78 @@ These scripts can be combined to achieve a desired resulting configuration. |=== | Script | Description -| infinispan-session-management-attribute.cli +| `infinispan-session-management-attribute.cli` | Reconfigures the default session manager to use `ATTRIBUTE` granularity. -| infinispan-session-management-offload.cli +| `infinispan-session-management-offload.cli` | Reconfigures the default session manager to use cache `offload`. +| `singleton-deployment-overlay-add.cli` +| Adds a deployment overlay for the ClusterBench deployment which configures it for singleton deployment. + +| `singleton-deployment-overlay-remove.cli` +| Removes the previously added deployment overlay so that it will no longer operate as a singleton deployment. + |=== +.Example: singleton deployment +[%collapsible] +==== +Following is a singleton deployment walk-through. +Start with two local servers already started and with `clusterbench-ee10.ear` deployed. +First run the provided scripts against both servers: + +[code,shell] +---- +[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --file=singleton-deployment-overlay-add.cli +[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --controller=localhost:10090 --file=singleton-deployment-overlay-add.cli +---- + +The provided script adds a deployment overlay, which configures existing deployment for singleton deployment. +This is achieved by overlaying a `META-INF/singleton-deployment.xml` file. +Note that the script automatically redeploys the deployments affected by this overlay. + +Now that these have configured both deployments for singleton deployment, observe the server log: + +[code] +---- +10:39:16,287 INFO [org.wildfly.clustering.singleton.server] (main - 1) WFLYCLSN0003: node2 elected as the singleton provider of the jboss.deployment.unit."clusterbench-ee10.ear".installer service +10:39:16,287 INFO [org.wildfly.clustering.singleton.server] (main - 1) WFLYCLSN0001: This node will now operate as the singleton provider of the jboss.deployment.unit."clusterbench-ee10.ear".installer service +---- + +We can now verify that only one of the contexts is available: + +[code] +---- +[rhusar@puglia wildfly]$ curl --head http://localhost:8080/clusterbench/ +HTTP/1.1 404 Not Found +Connection: keep-alive +Content-Length: 74 +Content-Type: text/html +Date: Mon, 23 Sep 2024 08:50:28 GMT + +[rhusar@puglia wildfly]$ curl --head http://localhost:8180/clusterbench/ +HTTP/1.1 200 OK +Connection: keep-alive +Last-Modified: Fri, 03 May 2024 14:27:54 GMT +Content-Type: text/html +Content-Length: 1335 +Accept-Ranges: bytes +Date: Mon, 23 Sep 2024 08:50:29 GMT +---- + +Notice that only one of the servers has returned a valid answer. + +To undo the changes, run the 'remove' variant of the scripts: + +[code,shell] +---- +[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --file=singleton-deployment-overlay-remove.cli +[rhusar@puglia scripts]$ $JBOSS_HOME/bin/jboss-cli.sh --connect --controller=localhost:10090 --file=singleton-deployment-overlay-remove.cli +---- + +==== + == Custom Build Profiles There a several profiles to test specific scenarios where the standard build needs to be modified. diff --git a/scripts/singleton-deployment-overlay-add.cli b/scripts/singleton-deployment-overlay-add.cli new file mode 100644 index 00000000..8c8a4e0d --- /dev/null +++ b/scripts/singleton-deployment-overlay-add.cli @@ -0,0 +1,7 @@ +# +# Copyright The ClusterBench Authors +# SPDX-License-Identifier: Apache-2.0 +# + +# Adds a deployment overlay for the ClusterBench deployment and redeploys +deployment-overlay add --name=clusterbench-ee10 --deployments=clusterbench-ee10.ear --content=META-INF/singleton-deployment.xml=singleton-deployment.xml --redeploy-affected diff --git a/scripts/singleton-deployment-overlay-remove.cli b/scripts/singleton-deployment-overlay-remove.cli new file mode 100644 index 00000000..927ba6b2 --- /dev/null +++ b/scripts/singleton-deployment-overlay-remove.cli @@ -0,0 +1,7 @@ +# +# Copyright The ClusterBench Authors +# SPDX-License-Identifier: Apache-2.0 +# + +# Removes the previously added deployment overlay and redeploys +deployment-overlay remove --name=clusterbench-ee10 --redeploy-affected diff --git a/scripts/singleton-deployment.xml b/scripts/singleton-deployment.xml new file mode 100644 index 00000000..e3802eae --- /dev/null +++ b/scripts/singleton-deployment.xml @@ -0,0 +1,6 @@ + + +