From ed9db7da4f00cecbe84ebc849569db987278f5c5 Mon Sep 17 00:00:00 2001 From: Manuel Finelli Date: Tue, 10 Dec 2024 18:55:16 +0000 Subject: [PATCH] [WFLY-19337] The GitHub Action to test ejb-txn-remote-call is now working --- .../kubernetes/core/excluded-directories.txt | 2 - .../kubernetes/core/overridable-functions.sh | 104 +++++++- .../core/run-quickstart-test-on-kubernetes.sh | 137 ++++++---- .../overridable-functions.sh | 244 +++++++++++++++--- ejb-txn-remote-call/README-source.adoc | 11 +- ejb-txn-remote-call/client/client-cr.yaml | 6 +- ejb-txn-remote-call/client/pom.xml | 112 +++----- .../client/scripts/cli.local.properties | 2 + .../client/scripts/cli.openshift.properties | 6 +- .../client/scripts/remoting-configuration.cli | 59 ++--- .../application-roles.properties | 0 .../application-users.properties | 0 ejb-txn-remote-call/server/pom.xml | 75 ++---- ejb-txn-remote-call/server/server-cr.yaml | 6 +- 14 files changed, 486 insertions(+), 278 deletions(-) rename ejb-txn-remote-call/server/{ => extra-content/standalone}/configuration/application-roles.properties (100%) rename ejb-txn-remote-call/server/{ => extra-content/standalone}/configuration/application-users.properties (100%) diff --git a/.github/workflows/scripts/kubernetes/core/excluded-directories.txt b/.github/workflows/scripts/kubernetes/core/excluded-directories.txt index d934741d3a..f5fa24e630 100644 --- a/.github/workflows/scripts/kubernetes/core/excluded-directories.txt +++ b/.github/workflows/scripts/kubernetes/core/excluded-directories.txt @@ -3,6 +3,4 @@ # microprofile-reactive-messaging-kafka # Can't connect to server... I see something relating to adding a user in the README but nothing in the OpenShift tests about this so it is odd ejb-remote -# Some problems once the operator is installed. I haven't been able to get my go environment set up to the same version -ejb-txn-remote-call diff --git a/.github/workflows/scripts/kubernetes/core/overridable-functions.sh b/.github/workflows/scripts/kubernetes/core/overridable-functions.sh index 21544287da..68e2ca2ac9 100644 --- a/.github/workflows/scripts/kubernetes/core/overridable-functions.sh +++ b/.github/workflows/scripts/kubernetes/core/overridable-functions.sh @@ -9,6 +9,7 @@ # # Parameters # 1 - the name of the qs directory (not the full path) +# function applicationName() { echo "${1}" } @@ -20,6 +21,7 @@ function applicationName() { # # Parameters # 1 - the name of the qs directory +# function namespace() { application="${1}" # Uncomment to make the tests run in the 'testing' namespace @@ -32,6 +34,7 @@ function namespace() { # # Parameters # 1 - application name +# function installPrerequisites() { application="${1}" @@ -43,12 +46,53 @@ function installPrerequisites() # # Parameters # 1 - application name +# function cleanPrerequisites() { application="${1}" echo "No prerequisites to clean for ${application}" } +# Trigger the custom behaviour when it comes to +# provision the server and push the imagestream. +# Returns +# 0 - false +# 1 - true +# +function customProvisionServer() { + echo 0 +} + +# Provision server and push imagestream +# The current directory is the quickstart directory +# +# Parameters +# 1 - application name +# 2 - quickstart dir +# +function provisionServer() +{ + echo "Nothing to do in provisionServer()..." +} + +# Trigger a custom behaviour when it comes to +# setting up the environment +# Returns +# 0 - false +# 1 - true +# +function customDeploy() { + echo 0 +} + +# Set up the environment before testing +# Parameters +# 1 - application name +# +function deploy() { + echo "Nothing to do in deploy()..." +} + # Performs the 'helm install' command. # The current directory is the quickstart directory # Parameters @@ -106,10 +150,68 @@ function helmInstallFailed() { echo "" } +# Trigger a custom behaviour when it comes to +# forward ports +# Returns +# 0 - false +# 1 - true +# +function customPortForward() { + echo 0 +} + +# Port forward to test the quickstart +# Parameters +# 1 - application name +# +function portForward() { + echo "Nothing to do in portForward()..." +} + +# Trigger a custom behaviour when it comes to +# running tests +# Returns +# 0 - false +# 1 - true +# +function customRunningTests() { + echo 0 +} + +# Running tests of the quickstart +# Parameters +# 1 - application name +# 2 - server protocol +# 3 - extra maven argument for the verify target +# +function runningTests() { + echo "Nothing to do in portForward()..." +} + +# Trigger a custom behaviour when it comes to +# running tests +# Returns +# 0 - false +# 1 - true +# +function customHelmUninstall() { + echo 0 +} + +# Performs the 'helm uninstall' command. +# Parameters +# 1 - application name +# +function helmUninstall() { + application="${1}" + + helm uninstall "${application}" --wait --timeout=10m0s +} + # More output when the tests have failed # Parameters # 1 - application name # function testsFailed() { echo "" -} \ No newline at end of file +} diff --git a/.github/workflows/scripts/kubernetes/core/run-quickstart-test-on-kubernetes.sh b/.github/workflows/scripts/kubernetes/core/run-quickstart-test-on-kubernetes.sh index 3b9dc2a64e..e1f3afda4b 100755 --- a/.github/workflows/scripts/kubernetes/core/run-quickstart-test-on-kubernetes.sh +++ b/.github/workflows/scripts/kubernetes/core/run-quickstart-test-on-kubernetes.sh @@ -76,50 +76,69 @@ fi ################################################################################################ # Install any pre-requisites. Function is from overridable-functions.sh + echo "Checking if we need to install pre-requisites" installPrerequisites "${application}" ################################################################################################ # Provision server and push imagestream -echo "Building application and provisioning server image..." -mvn -B package -Popenshift wildfly:image -DskipTests +customProvisionServer=$(customProvisionServer) +if [ "0" = "${customProvisionServer}" ]; then + echo "Building application and provisioning server image..." + mvn -B package -Popenshift wildfly:image -DskipTests -echo "Tagging image and pushing to registry..." -export root_image_name="localhost:5000/${application}" -export image="${root_image_name}:latest" -docker tag ${qs_dir} ${image} -docker push ${image} + echo "Tagging image and pushing to registry..." + export root_image_name="localhost:5000/${application}" + export image="${root_image_name}:latest" + docker tag ${qs_dir} ${image} + docker push ${image} +else + provisionServer "${application}" "${qs_dir}" +fi ################################################################################################ -# Helm install, waiting for the pods to come up -helm_set_arguments=" --set ${helm_set_arg_prefix}build.enabled=false --set ${helm_set_arg_prefix}deploy.route.enabled=false --set ${helm_set_arg_prefix}image.name=${root_image_name}" -additional_arguments="No additional arguments" -if [ -n "${helm_set_arguments}" ]; then - additional_arguments="Additional arguments: ${helm_set_arguments}" +customDeploy=$(customDeploy) +if [ "0" = "${customDeploy}" ]; then + # Helm install, waiting for the pods to come up + helm_set_arguments=" --set ${helm_set_arg_prefix}build.enabled=false --set ${helm_set_arg_prefix}deploy.route.enabled=false --set ${helm_set_arg_prefix}image.name=${root_image_name}" + + additional_arguments="No additional arguments" + if [ -n "${helm_set_arguments}" ]; then + additional_arguments="Additional arguments: ${helm_set_arguments}" + fi + + echo "Performing Helm install and waiting for completion.... (${additional_arguments})" + # helmInstall is from overridable-functions.sh + helm_install_ret=$(helmInstall "${application}" "${helm_set_arguments}") + + # For some reason the above sometimes becomes a multi-line string. actual The exit code will be + # on the last line + helm_install_ret=$(echo "${helm_install_ret}"| tail -n 1) + + echo "ret: ${helm_install_ret}" + if [ "${helm_install_ret}" != "0" ]; then + echo "Helm install failed!" + echo "Dumping the application pod(s)" + kubectl logs deployment/"${application}" + helmInstallFailed + fi +else + deploy fi -echo "Performing Helm install and waiting for completion.... (${additional_arguments})" -# helmInstall is from overridable-functions.sh -helm_install_ret=$(helmInstall "${application}" "${helm_set_arguments}") - -# For some reason the above sometimes becomes a multi-line string. actual The exit code will be -# on the last line -helm_install_ret=$(echo "${helm_install_ret}"| tail -n 1) - -echo "ret: ${helm_install_ret}" -if [ "${helm_install_ret}" != "0" ]; then - echo "Helm install failed!" - echo "Dumping the application pod(s)" - kubectl logs deployment/"${application}" - helmInstallFailed +customPortForward=$(customPortForward) +if [ "0" = "${customPortForward}" ]; then + nohup kubectl port-forward service/${application} 8080:8080 > /dev/null 2>&1 & + kubectl_fwd_pids=$! + echo "Process ID of kubect port-forward: ${kubectl_fwd_pids}" +else + echo "Performing Port Forward and waiting for completion...." + kubectl_fwd_pids=$(portForward "${application}") + echo "Process ID(s) of kubect port-forward: ${kubectl_fwd_pids}" fi -kubectl port-forward service/${application} 8080:8080 & -kubectl_fwd_pid=$! -echo "Process ID of kubect port-forward: ${kubectl_fwd_pid}" - ################################################################################################ # Run any post install echo "Running post Helm install commands in $(pwd)" @@ -130,35 +149,47 @@ runPostHelmInstallCommands echo "running the tests" pwd -route="localhost:8080" - -mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} " -extraMvnVerifyArguments="$(getMvnVerifyExtraArguments)" -if [ -n "${extraMvnVerifyArguments}" ]; then - mvnVerifyArguments="${mvnVerifyArguments} ${extraMvnVerifyArguments}" -fi -if [ "${QS_DEBUG_TESTS}" = "1" ]; then - mvnVerifyArguments="${mvnVerifyArguments} -Dmaven.failsafe.debug=true" -fi - -echo "Verify Arguments: ${mvnVerifyArguments}" - -mvn -B verify -Pintegration-testing ${mvnVerifyArguments} - -if [ "$?" != "0" ]; then - test_status=1 - echo "Tests failed!" - echo "Dumping the application pod(s)" - kubectl logs deployment/"${application}" - testsFailed +customRunningTests=$(customRunningTests) +if [ "0" = "${customRunningTests}" ]; then + route="localhost:8080" + + mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} " + extraMvnVerifyArguments="$(getMvnVerifyExtraArguments)" + if [ -n "${extraMvnVerifyArguments}" ]; then + mvnVerifyArguments="${mvnVerifyArguments} ${extraMvnVerifyArguments}" + fi + if [ "${QS_DEBUG_TESTS}" = "1" ]; then + mvnVerifyArguments="${mvnVerifyArguments} -Dmaven.failsafe.debug=true" + fi + + echo "Verify Arguments: ${mvnVerifyArguments}" + + mvn -B verify -Pintegration-testing ${mvnVerifyArguments} + + if [ "$?" != "0" ]; then + test_status=1 + echo "Tests failed!" + echo "Dumping the application pod(s)" + kubectl logs deployment/"${application}" + testsFailed + fi +else + runningTests "${application}" "${server_protocol}" "$(getMvnVerifyExtraArguments)" + test_status=$? fi -kill -9 ${kubectl_fwd_pid} +kill -9 ${kubectl_fwd_pids} ################################################################################################ # Helm uninstall echo "Running Helm uninstall" -helm uninstall "${application}" --wait --timeout=10m0s + +customHelmUninstall=$(customHelmUninstall) +if [ "0" = "${customHelmUninstall}" ]; then + helm uninstall "${application}" --wait --timeout=10m0s +else + helmUninstall "${application}" +fi ################################################################################################ # Clean pre-requisites (cleanPrerequisites is fromm overridable-functions.sh) diff --git a/.github/workflows/scripts/kubernetes/qs-overrides/ejb-txn-remote-call/overridable-functions.sh b/.github/workflows/scripts/kubernetes/qs-overrides/ejb-txn-remote-call/overridable-functions.sh index 0e93b5dc24..392ab8e37e 100644 --- a/.github/workflows/scripts/kubernetes/qs-overrides/ejb-txn-remote-call/overridable-functions.sh +++ b/.github/workflows/scripts/kubernetes/qs-overrides/ejb-txn-remote-call/overridable-functions.sh @@ -1,16 +1,3 @@ -# These functions are 'overridable in the individual quickstarts. -# To do so create a ./qs-overrides/${qs_dir}/overridable-functions.sh and override the -# functions you need to. ${qs_dir} in this case is the same as the name of the quickstart directory -# that you want to tweak - -# Installs any prerequisites before doing the Helm install. -# The current directory is the quickstart directory. -# The default is to use the quickstart directory as the name, but in some cases -# a quickstart may need to shorten the name of the application in order to control -# the length of the resources created by OpenShift -# -# Parameters -# 1 - the name of the qs directory (not the full path) function applicationName() { #echo "${1}" # The fill microprofile-reactive-messaging-kafka name results in names of generated resources which are too long for @@ -18,12 +5,6 @@ function applicationName() { echo "ejb-txn-remote-call" } - -# Installs any prerequisites before doing the Helm install. -# The current directory is the quickstart directory -# -# Parameters -# 1 - application name function installPrerequisites() { application="${1}" @@ -68,32 +49,215 @@ function installPrerequisites() cd $CURRENT_FOLDER || return } +function customProvisionServer() { + echo 1 +} + +function provisionServer() { + application="${1}" + + echo "Packaging the 'client' provisioned server..." + cd client || return 1 + mvn -B -fae clean package -Popenshift,provisioned-server wildfly:image -DskipTests -DpostgresqlUsername="test" -DpostgresqlPassword="test" -DpostgresqlHost="postgresql" + + export client_image_name="${application}-client" + export client_image_location="localhost:5000/${client_image_name}" + export image="${client_image_location}:latest" + + echo "Building and tagging the 'client' image..." + docker build --load -t ${image} ./target + echo "...and pushing to registry." + docker push ${image} + + cd ../server || return 1 + echo "Packaging the 'server' provisioned server..." + mvn -B -fae clean package -Popenshift,provisioned-server wildfly:image -DskipTests -DpostgresqlUsername="test" -DpostgresqlPassword="test" -DpostgresqlHost="postgresql" + + export server_image_name="${application}-server" + export server_image_location="localhost:5000/${server_image_name}" + export image="${server_image_location}:latest" + + echo "Building and tagging 'server' image..." + docker build --load -t ${image} ./target + echo "...and pushing to registry." + docker push ${image} + + # Let's go back to the root of the quickstart + cd .. +} + +function customDeploy() { + echo 1 +} + +function deploy() { + seconds=60 + + kubectl create -f client/client-cr.yaml + + now=$(date +%s) + end=$(($seconds + $now)) + + echo "Waiting for 1 minutes that the 'ejb-txn-remote-call-client' pod is in 'Running' status." + + while [ $now -lt $end ]; do + sleep 5 + + if [[ $(kubectl get pods --field-selector=status.phase==Running -l app.kubernetes.io/name=ejb-txn-remote-call-client | awk '{ if ($3 == "Running" && $2 == "1/1") { print } }') ]]; then + break + fi + + now=$(date +%s) + done + + kubectl create -f server/server-cr.yaml + + now=$(date +%s) + end=$(($seconds + $now)) + + echo "Waiting for 1 minutes that the 'ejb-txn-remote-call-server' pods are in 'Running' status." + + while [ $now -lt $end ]; do + sleep 5 + + if [[ $(kubectl get pods --field-selector=status.phase==Running -l app.kubernetes.io/name=ejb-txn-remote-call-server | awk '{ if ($3 == "Running" && $2 == "1/1") { print } }') ]]; then + break + fi + + now=$(date +%s) + done +} + function helmInstall() { - helm_set_arguments="$2" - - # TODO https://issues.redhat.com/browse/WFLY-18574 remove this when persistence is working - # This seems to work with my postgresql.yaml :fingers_crossed - # helm_set_arguments="${helm_set_arguments} --set postgresql.primary.persistence.enabled=false" - - # Don't quote ${helm_set_arguments} as it breaks the command when empty, and seems to work without - helm install client -f charts/client.yaml wildfly/wildfly --wait --timeout="${helm_install_timeout}" ${helm_set_arguments} - echo "$?" - # TODO: should we check when the build is done? - helm install server -f charts/server.yaml wildfly/wildfly --wait --timeout="${helm_install_timeout}" ${helm_set_arguments} - echo "$?" - # TODO: should we check when the build is done? + echo "Nothing to do in helmInstall()..." } -# Commands to run once the Helm install has completed -function runPostHelmInstallCommands() { +function customPortForward() { + echo 1 +} + +function portForward() { + + seconds=60 + + # Start the first port-forward process for the client + nohup kubectl port-forward service/${application}-client-headless 8080:8080 > /dev/null 2>&1 & + kubectl_fwd_pid_client=$! + + now=$(date +%s) + end=$(($seconds + $now)) + localhost="localhost" + port="8080" + endpoint="/client/remote-outbound-stateless" + + while [ $now -lt $end ]; do + sleep 5 + + if [[ $(curl --silent --write-out "%{http_code}" --output /dev/null "http://${localhost}:${port}${endpoint}") -eq 200 ]]; then + break + fi + + now=$(date +%s) + done + + # Start the second port-forward process for the server + nohup kubectl port-forward service/${application}-server-headless 8180:8080 > /dev/null 2>&1 & + kubectl_fwd_pid_server=$! + + now=$(date +%s) + end=$(($seconds + $now)) + localhost="localhost" + port="8180" + endpoint="/server/commits" + + while [ $now -lt $end ]; do + sleep 5 + + if [[ $(curl --silent --write-out "%{http_code}" --output /dev/null "http://${localhost}:${port}${endpoint}") -eq 200 ]]; then + break + fi - # Make sure that view permissions are granted to the default system account. - # kubectl policy add-role-to-user view system:serviceaccount:$(oc project -q):default -n $(oc project -q) + now=$(date +%s) + done + + echo "${kubectl_fwd_pid_client} ${kubectl_fwd_pid_server}" +} + +function customRunningTests() { + echo 1 +} + +function runningTests() { + application="${1}" + server_protocol="${2}" + extraMvnVerifyArguments="${3}" + + cd client || return 1 + route="localhost:8080" + + mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} " + if [ -n "${extraMvnVerifyArguments}" ]; then + mvnVerifyArguments="${mvnVerifyArguments} ${extraMvnVerifyArguments}" + fi + if [ "${QS_DEBUG_TESTS}" = "1" ]; then + mvnVerifyArguments="${mvnVerifyArguments} -Dmaven.failsafe.debug=true" + fi + + echo "Verify Arguments: ${mvnVerifyArguments}" + + mvn -B verify -Pintegration-testing ${mvnVerifyArguments} + + client_test_status="$?" + + if [ "$?" != "0" ]; then + client_test_status=1 + echo "Tests failed!" + echo "Dumping the application pod" + kubectl logs deployment/"${application}-client-0" + testsFailed + fi + + cd ../server || return 1 + route="localhost:8180" + + mvnVerifyArguments="-Dserver.host=${server_protocol}://${route} " + if [ -n "${extraMvnVerifyArguments}" ]; then + mvnVerifyArguments="${mvnVerifyArguments} ${extraMvnVerifyArguments}" + fi + if [ "${QS_DEBUG_TESTS}" = "1" ]; then + mvnVerifyArguments="${mvnVerifyArguments} -Dmaven.failsafe.debug=true" + fi + + echo "Verify Arguments: ${mvnVerifyArguments}" + + mvn -B verify -Pintegration-testing ${mvnVerifyArguments} + + server_test_status="$?" + + if [ "$?" != "0" ]; then + server_test_status=1 + echo "Tests failed!" + echo "Dumping the application pods" + kubectl logs deployment/"${application}-server-0" + kubectl logs deployment/"${application}-server-1" + testsFailed + fi + + if (( client_test_status == 1 || server_test_status == 1 )); then + result=1 + else + result=0 + fi + + return "${result}" +} + +function customHelmUninstall() { + return 0 +} - kubectl create -f client/client-cr.yaml - # TODO: should we check when the deployment is completed? - kubectl create -f server/server-cr.yaml - # TODO: should we check when the deployment is completed? +function helmUninstall() { + echo "helmUninstall() nothing to do" } # Cleans any prerequisites after doing the Helm uninstall. diff --git a/ejb-txn-remote-call/README-source.adoc b/ejb-txn-remote-call/README-source.adoc index 6f6e3c0caf..eb9fc2b53b 100644 --- a/ejb-txn-remote-call/README-source.adoc +++ b/ejb-txn-remote-call/README-source.adoc @@ -63,6 +63,7 @@ include::../shared-doc/system-requirements.adoc[leveloffset=+1] The EJB remote call propagates transaction from `client` application to `server` application. The remote call hits one of the two servers where the `server` application is deployed. +[[_running_in_a_bare_metal_environment]] == Running in a bare metal environment First of all, an environment variable should be defined to point to this quickstart's root folder. @@ -239,13 +240,15 @@ will be executed on `server1`. [source,sh,subs="+quotes,attributes+",options="nowrap"] ---- cd ${jbossHomeName}_1; \ -./bin/jboss-cli.sh -DremoteServerUsername='quickstartUser' -DremoteServerPassword='quickstartPwd1!' \ +./bin/jboss-cli.sh --connect -DremoteServerUsername='quickstartUser' -DremoteServerPassword='quickstartPwd1!' \ --file=${PATH_TO_QUICKSTART_DIR}/client/scripts/remoting-configuration.cli \ --properties=${PATH_TO_QUICKSTART_DIR}/client/scripts/cli.local.properties ---- NOTE: For Windows, use the `bin\jboss-cli.bat` script. +After executing the CLI script, stop `server1` by pressing the keys `CRTL+C` in the terminal where it is running. + Running `remoting-configuration.cli` results in the creation of: * A `remote outbound socket` that points to the port on `server2`/`server3` where EJB remoting endpoints can be reached @@ -293,7 +296,7 @@ the `client` and `server` application can be deployed [source,sh,subs="+quotes,attributes+",options="nowrap"] ---- cd ${PATH_TO_QUICKSTART_DIR}/ -mvn clean package +mvn clean package -P '!provisioned-server' ---- + . Then, the `client` application can be deployed using the following commands: @@ -568,9 +571,7 @@ Instead of using a standard {productName} server distribution, the three {produc [source,sh,subs="+quotes,attributes+",options="nowrap"] ---- cd ${PATH_TO_QUICKSTART_DIR}/client; -mvn clean package \ - -DremoteServerUsername="quickstartUser" -DremoteServerPassword='quickstartPwd1!' \ - -DpostgresqlUsername="test" -DpostgresqlPassword="test" +mvn clean package -DpostgresqlUsername="test" -DpostgresqlPassword="test" ---- [source,sh,subs="+quotes,attributes+",options="nowrap"] ---- diff --git a/ejb-txn-remote-call/client/client-cr.yaml b/ejb-txn-remote-call/client/client-cr.yaml index f3cf259f26..f606f68a93 100644 --- a/ejb-txn-remote-call/client/client-cr.yaml +++ b/ejb-txn-remote-call/client/client-cr.yaml @@ -1,7 +1,7 @@ apiVersion: wildfly.org/v1alpha1 kind: WildFlyServer metadata: - name: client + name: ejb-txn-remote-call-client spec: env: - name: POSTGRESQL_DATABASE @@ -12,5 +12,5 @@ spec: value: test - name: POSTGRESQL_USER value: test - applicationImage: "client:latest" - replicas: 1 \ No newline at end of file + applicationImage: "localhost:5000/ejb-txn-remote-call-client:latest" + replicas: 1 diff --git a/ejb-txn-remote-call/client/pom.xml b/ejb-txn-remote-call/client/pom.xml index ef2296cdba..5b28845eab 100644 --- a/ejb-txn-remote-call/client/pom.xml +++ b/ejb-txn-remote-call/client/pom.xml @@ -45,6 +45,9 @@ 5.1.0.Final 42.7.2 + + scripts/cli.local.properties + bare-metal @@ -237,102 +240,38 @@ wildfly-maven-plugin + ${postgresqlHost:localhost} test java:jboss/datasources/ejbJtaDs ${postgresqlUsername} ${postgresqlPassword} - - - - package - package - - package - - - - ${version.server} - - false - - postgresql - - - - - - run-script - package - - execute-commands - - - true - ${project.build.directory}/server + + ${version.server} + ${discovery.context} + + false + + postgresql + + + + - - scripts/cli.local.properties - - - ${remoteServerUsername} - ${remoteServerPassword} - - - - - - - - - - openshift - - - - org.wildfly.plugins - wildfly-maven-plugin + + ${property.file} + + + + false + - package - package package - - - ${version.server} - - false - cloud - - postgresql - - - - - - run-script - package - - execute-commands - - - true - ${project.build.directory}/server - - - - - scripts/cli.openshift.properties - - - ${remoteServerUsername} - ${remoteServerPassword} - - @@ -350,6 +289,13 @@ + + openshift + + scripts/cli.openshift.properties + cloud + + integration-testing diff --git a/ejb-txn-remote-call/client/scripts/cli.local.properties b/ejb-txn-remote-call/client/scripts/cli.local.properties index dc57508214..59ab29efc3 100644 --- a/ejb-txn-remote-call/client/scripts/cli.local.properties +++ b/ejb-txn-remote-call/client/scripts/cli.local.properties @@ -1,5 +1,7 @@ remoteServerHost=127.0.0.1 remoteServerPort=8180 remoteDeploymentName=server +remoteServerUsername=quickstartUser +remoteServerPassword=quickstartPwd1! postgresqlServerName=localhost serverConfig=standalone.xml diff --git a/ejb-txn-remote-call/client/scripts/cli.openshift.properties b/ejb-txn-remote-call/client/scripts/cli.openshift.properties index 69457dba19..a380a0b480 100644 --- a/ejb-txn-remote-call/client/scripts/cli.openshift.properties +++ b/ejb-txn-remote-call/client/scripts/cli.openshift.properties @@ -1,6 +1,8 @@ -remoteServerHost=server-0.server-headless +remoteServerHost=ejb-txn-remote-call-server-headless remoteServerPort=8080 remoteDeploymentName=server +remoteServerUsername=quickstartUser +remoteServerPassword=quickstartPwd1! # This is the service's name of the PostgreSQL database on OpenShift postgresqlServerName=postgresql -serverConfig=standalone.xml \ No newline at end of file +serverConfig=standalone.xml diff --git a/ejb-txn-remote-call/client/scripts/remoting-configuration.cli b/ejb-txn-remote-call/client/scripts/remoting-configuration.cli index 14e99a4845..8a2c070629 100644 --- a/ejb-txn-remote-call/client/scripts/remoting-configuration.cli +++ b/ejb-txn-remote-call/client/scripts/remoting-configuration.cli @@ -6,49 +6,46 @@ set remoteServerUsername=${remoteServerUsername} set remoteServerPassword=${remoteServerPassword} set serverConfig=${serverConfig} -# running embeded server with server config -embed-server --server-config=$serverConfig - -# we assume that if one of the sys properties exists then server was configured already +# It is assumed that in case one of the system properties exists then this script was already executed if (outcome != success) of /system-property=remote.server.host:read-resource -/system-property=remote.server.host:add(value=$remoteServerHost) -/system-property=remote.server.port:add(value=$remoteServerPort) -/system-property=remote.server.username:add(value=$remoteServerUsername) -/system-property=remote.server.password:add(value=$remoteServerPassword) -/system-property=remote.deployment.name:add(value=$remoteDeploymentName) + /system-property=remote.server.host:add(value=$remoteServerHost) + /system-property=remote.server.port:add(value=$remoteServerPort) + /system-property=remote.server.username:add(value=$remoteServerUsername) + /system-property=remote.server.password:add(value=$remoteServerPassword) + /system-property=remote.deployment.name:add(value=$remoteDeploymentName) -echo "System properties defined" + echo "System properties defined" -/socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=server2:add(host=${remote.server.host}, port=${remote.server.port}) + /socket-binding-group=standard-sockets/remote-destination-outbound-socket-binding=server2:add(host=${remote.server.host}, port=${remote.server.port}) -echo "Outbound socket binding 'server2' created" + echo "Outbound socket binding 'server2' created" -# adding password realm where secret is password 'quickstartUser' converted to base64 format -# reload # when would be run not in embed mode + # adding password realm where secret is password 'quickstartUser' converted to base64 format + # reload # when would be run not in embed mode -/subsystem=elytron/authentication-configuration=auth_config:add(authentication-name=quickstartUser,authorization-name=quickstartUser, credential-reference={clear-text=quickstartPwd1!}, realm="ApplicationRealm", sasl-mechanism-selector="DIGEST-MD5") -/subsystem=elytron/authentication-context=auth_context:add(match-rules=[{authentication-configuration=auth_config}]) + /subsystem=elytron/authentication-configuration=auth_config:add(authentication-name=quickstartUser,authorization-name=quickstartUser, credential-reference={clear-text=quickstartPwd1!}, realm="ApplicationRealm", sasl-mechanism-selector="DIGEST-MD5") + /subsystem=elytron/authentication-context=auth_context:add(match-rules=[{authentication-configuration=auth_config}]) -/subsystem=remoting/remote-outbound-connection=remote-ejb-connection:add(outbound-socket-binding-ref=server2, authentication-context=auth_context) -/subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SASL_POLICY_NOANONYMOUS:add(value=false) -/subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SSL_ENABLED:add(value=false) -/subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SASL_DISALLOWED_MECHANISMS:add(value=JBOSS-LOCAL-USER) + /subsystem=remoting/remote-outbound-connection=remote-ejb-connection:add(outbound-socket-binding-ref=server2, authentication-context=auth_context) + /subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SASL_POLICY_NOANONYMOUS:add(value=false) + /subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SSL_ENABLED:add(value=false) + /subsystem=remoting/remote-outbound-connection=remote-ejb-connection/property=SASL_DISALLOWED_MECHANISMS:add(value=JBOSS-LOCAL-USER) -echo "Remote outbound connection 'remote-ejb-connection' created" + echo "Remote outbound connection 'remote-ejb-connection' created" -# for transaction manager could be asked for recovery to be started the listener at port has to be enabled (JVM restart needed) -/subsystem=transactions:write-attribute(name=recovery-listener,value=true) -echo "Transaction recovery listener enabled" -# the recovery listener is normally bound at port 4712, you can verify it with: -# /socket-binding-group=standard-sockets/socket-binding=txn-recovery-environment:read-attribute(name=bound-port) -# for recovery invocation you can use e.g.: `telnet localhost 4712`; enter 'SCAN' on input + # for transaction manager could be asked for recovery to be started the listener at port has to be enabled (JVM restart needed) + /subsystem=transactions:write-attribute(name=recovery-listener,value=true) + echo "Transaction recovery listener enabled" + # the recovery listener is normally bound at port 4712, you can verify it with: + # /socket-binding-group=standard-sockets/socket-binding=txn-recovery-environment:read-attribute(name=bound-port) + # for recovery invocation you can use e.g.: `telnet localhost 4712`; enter 'SCAN' on input -# to get detailed insight on what happening during transaction processing switch on the TRACE logging for Narayana -# /subsystem=logging/logger=com.arjuna:write-attribute(name=level,value=TRACE) + # to get detailed insight on what happening during transaction processing switch on the TRACE logging for Narayana + # /subsystem=logging/logger=com.arjuna:write-attribute(name=level,value=TRACE) -echo "remoting-configuration.cli script finished" + echo "remoting-configuration.cli script finished" end-if -quit \ No newline at end of file +quit diff --git a/ejb-txn-remote-call/server/configuration/application-roles.properties b/ejb-txn-remote-call/server/extra-content/standalone/configuration/application-roles.properties similarity index 100% rename from ejb-txn-remote-call/server/configuration/application-roles.properties rename to ejb-txn-remote-call/server/extra-content/standalone/configuration/application-roles.properties diff --git a/ejb-txn-remote-call/server/configuration/application-users.properties b/ejb-txn-remote-call/server/extra-content/standalone/configuration/application-users.properties similarity index 100% rename from ejb-txn-remote-call/server/configuration/application-users.properties rename to ejb-txn-remote-call/server/extra-content/standalone/configuration/application-users.properties diff --git a/ejb-txn-remote-call/server/pom.xml b/ejb-txn-remote-call/server/pom.xml index 0a66120801..f4205f709a 100644 --- a/ejb-txn-remote-call/server/pom.xml +++ b/ejb-txn-remote-call/server/pom.xml @@ -43,6 +43,7 @@ 5.1.0.Final 7.0.0.Final + bare-metal @@ -202,32 +203,33 @@ + ${postgresqlHost:localhost} test java:jboss/datasources/ejbJtaDs ${postgresqlUsername} ${postgresqlPassword} + + ${version.server} + + postgresql + wildfly-cli + + ${discovery.context} + + false + ha + + + extra-content + + false - package - package package - - true - - ${version.server} - - postgresql - wildfly-cli - - - false - ha - - @@ -236,46 +238,9 @@ openshift - - - - org.wildfly.plugins - wildfly-maven-plugin - - - package - package - - package - - - - ${version.server} - - postgresql - - cloud - - false - ha - - - - - - - - org.apache.maven.plugins - maven-source-plugin - - - attach-sources - none - - - - - + + cloud + integration-testing diff --git a/ejb-txn-remote-call/server/server-cr.yaml b/ejb-txn-remote-call/server/server-cr.yaml index d7b82b20a0..5c4b33fdb3 100644 --- a/ejb-txn-remote-call/server/server-cr.yaml +++ b/ejb-txn-remote-call/server/server-cr.yaml @@ -1,7 +1,7 @@ apiVersion: wildfly.org/v1alpha1 kind: WildFlyServer metadata: - name: server + name: ejb-txn-remote-call-server spec: env: - name: POSTGRESQL_DATABASE @@ -12,5 +12,5 @@ spec: value: test - name: POSTGRESQL_USER value: test - applicationImage: "server:latest" - replicas: 2 \ No newline at end of file + applicationImage: "localhost:5000/ejb-txn-remote-call-server:latest" + replicas: 2