From c50700919ce004333d108cdd99b19ec27860d6d9 Mon Sep 17 00:00:00 2001 From: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 10 Feb 2022 10:44:01 +0100 Subject: [PATCH 1/3] Move to JDK 11 --- cli/pom.xml | 2 +- messaging-executor/pom.xml | 2 +- .../src/main/resources/bin/mta-cli | 75 ++++++++++++++----- web/pom.xml | 2 +- 4 files changed, 61 insertions(+), 20 deletions(-) diff --git a/cli/pom.xml b/cli/pom.xml index 257f878..478d2d8 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -38,7 +38,7 @@ ${docker.name.windup.cli} - registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:1.8 + registry.access.redhat.com/openjdk/openjdk-11-rhel7:1.11 /opt/migrationtoolkit/bin/mta-cli / diff --git a/messaging-executor/pom.xml b/messaging-executor/pom.xml index 33fe7e8..41cda12 100644 --- a/messaging-executor/pom.xml +++ b/messaging-executor/pom.xml @@ -37,7 +37,7 @@ ${docker.name.windup.web.executor} - registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:1.8 + registry.access.redhat.com/openjdk/openjdk-11-rhel7:1.11 /opt/mta-cli/bin/openshift-launch.sh / diff --git a/messaging-executor/src/main/resources/bin/mta-cli b/messaging-executor/src/main/resources/bin/mta-cli index e9a23d7..a2570d3 100755 --- a/messaging-executor/src/main/resources/bin/mta-cli +++ b/messaging-executor/src/main/resources/bin/mta-cli @@ -27,10 +27,15 @@ ADDONS_DIR=() MTA_DEBUG_ARGS=() QUOTED_ARGS=() +RUN_OPENREWRITE=() +TRANSFORM_PROJECT_PATH=() +OPENREWRITE_QUOTED_ARGS=() +OPENREWRITE_GOAL=( "dryRun" ) ## Increase the open file limit if low, to what we need or at least to the hard limit. ## Complain if the hard limit is lower than what we need. -WE_NEED=1024 +## Value set to 10000 to be aligned with windup-web-distribution +WE_NEED=10000 MAX_HARD=$(ulimit -H -n); MAX_SOFT=$(ulimit -S -n); @@ -38,17 +43,20 @@ if [ $MAX_SOFT == 'unlimited' ] ; then MAX_SOFT=$WE_NEED; fi; if [ $MAX_HARD == 'unlimited' ] ; then MAX_HARD=$WE_NEED; fi; if [ $MAX_SOFT -lt $WE_NEED ] || [ $MAX_HARD -lt $WE_NEED ] ; then - - echo "" - echo "[WARNING] The limits ($MAX_SOFT/$MAX_HARD) for open files is too low and could make MTA unstable. Please increase them to at least $WE_NEED." - echo "" - echo " {RHEL & Fedora} Limits are typically configured in /etc/security/limits.conf" - echo " -> Follow instructions of https://access.redhat.com/solutions/60746" - echo "" - echo " {MacOS} Limits are typically configured in /etc/launchd.conf or /etc/sysctl.conf." - echo " -> Execute this script: https://gist.github.com/Maarc/d13b1e70f191d5b527a24d39dd3e2569 and restart your operating system." - echo "" - + if [ $MAX_HARD -lt $WE_NEED ] ; then + echo "" + echo "[WARNING] The limits ($MAX_SOFT/$MAX_HARD) for open files is too low and could make MTA unstable. Please increase them to at least $WE_NEED." + echo "" + echo " {RHEL & Fedora} Limits are typically configured in /etc/security/limits.conf" + echo " -> Follow instructions of https://access.redhat.com/solutions/60746" + echo "" + echo " {MacOS} Limits are typically configured in /etc/launchd.conf or /etc/sysctl.conf." + echo " -> Execute this script: https://gist.github.com/Maarc/d13b1e70f191d5b527a24d39dd3e2569 and restart your operating system." + echo "" + fi + MIN_WE_NEED_OR_CAN_HAVE=$(( $MAX_HARD > $WE_NEED ? $WE_NEED : $MAX_HARD )) + echo "Increasing the maximum of open files to $MIN_WE_NEED_OR_CAN_HAVE." + ulimit -S -n $MIN_WE_NEED_OR_CAN_HAVE fi @@ -66,11 +74,15 @@ while [ -h "$PRG" ] ; do fi done +saveddir=`pwd` + SCRIPT_HOME=`dirname "$SCRIPT_HOME"`/.. # make it fully qualified SCRIPT_HOME=`cd "$SCRIPT_HOME" && pwd` +cd "$saveddir" + echo "Changing to script home: $SCRIPT_HOME" cd $SCRIPT_HOME @@ -80,7 +92,22 @@ while [ "$1" != "" ] ; do MTA_DEBUG_ARGS=( "-Xdebug" "-Xnoagent" "-Djava.compiler=NONE" "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" ) fi + if [ "$1" = "--openrewrite" ] ; then + RUN_OPENREWRITE=( "yes" ) + elif [ "$1" = "--input" ] ; then + TRANSFORM_PROJECT_PATH=("$2") + elif [ "$1" = "$TRANSFORM_PROJECT_PATH" ] ; then + pathfound=true + elif [ "$1" = "--goal" ] ; then + OPENREWRITE_GOAL=("$2") + elif [ "$1" = "$OPENREWRITE_GOAL" ] ; then + goalfound=true + else + OPENREWRITE_QUOTED_ARGS+=("$1") + fi + QUOTED_ARGS+=("$1") + shift done @@ -143,10 +170,14 @@ if [ -z "$MTA_HOME" ] ; then fi done + saveddir=`pwd` + MTA_HOME=`dirname "$PRG"`/.. # make it fully qualified MTA_HOME=`cd "$MTA_HOME" && pwd` + + cd "$saveddir" fi echo Using MTA at $MTA_HOME @@ -189,11 +220,15 @@ if [ ! -x "$JAVACMD" ] ; then exit 1 fi +MODULES="" JAVAVER=`"$JAVACMD" -version 2>&1` case $JAVAVER in -*1.[8-9]*) ;; -*1.[1-7]*) - echo " Error: a Java 1.8 or higher JRE is required to run MTA; found [$JAVACMD -version == $JAVAVER]." +*"11"*) + MODULES="--add-modules=java.se" + echo "TECH PREVIEW Running on JDK $JAVAVER" +;; +*1.[1-9]*) + echo " Error: a Java 11 or higher JRE is required to run MTA; found [$JAVACMD -version == $JAVAVER]." exit 1 ;; esac @@ -238,7 +273,13 @@ fi MTA_OPTS="$MTA_OPTS $FILE_DESCRIPTOR_OPTS"; +if [ "$RUN_OPENREWRITE" != "" ] ; then + ( cd "$TRANSFORM_PROJECT_PATH"; exec mvn org.openrewrite.maven:rewrite-maven-plugin:4.13.0:"${OPENREWRITE_GOAL}" -DconfigLocation="${MTA_HOME}"/rules/openrewrite/rewrite.yml "${OPENREWRITE_QUOTED_ARGS[@]}" ) + exit 0; + +fi + JAVA_TOOL_OPTIONS="" -$JAVACMD "${MTA_DEBUG_ARGS[@]}" $MTA_OPTS -Dforge.standalone=true -Dforge.home=${MTA_HOME} -Dwindup.home=${MTA_HOME} \ - -cp ${MTA_HOME}/lib/'*' $MTA_MAIN_CLASS "${QUOTED_ARGS[@]}" "${ADDONS_DIR[@]}" +exec "$JAVACMD" $MODULES "${MTA_DEBUG_ARGS[@]}" $MTA_OPTS -Dforge.standalone=true -Dforge.home="${MTA_HOME}" -Dwindup.home="${MTA_HOME}" \ + -cp "${MTA_HOME}"/lib/'*' $MTA_MAIN_CLASS "${QUOTED_ARGS[@]}" "${ADDONS_DIR[@]}" diff --git a/web/pom.xml b/web/pom.xml index 5afc066..da405fa 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -37,7 +37,7 @@ ${docker.name.windup.web} - registry.redhat.io/jboss-eap-7/eap73-openjdk8-openshift-rhel7:7.3.0-13 + registry.redhat.io/jboss-eap-7/eap73-openjdk11-openshift-rhel8:7.3.10 /opt/eap/bin/webapp-launch.sh / From 90144b43a3d5f3d7a5c07fe02e6be55d5b3670b4 Mon Sep 17 00:00:00 2001 From: Carlos Feria <2582866+carlosthe19916@users.noreply.github.com> Date: Thu, 17 Feb 2022 09:37:37 +0100 Subject: [PATCH 2/3] Change container images & CLI script --- cli/pom.xml | 2 +- messaging-executor/pom.xml | 2 +- .../src/main/resources/bin/mta-cli | 75 +++++-------------- web/pom.xml | 2 +- 4 files changed, 21 insertions(+), 60 deletions(-) diff --git a/cli/pom.xml b/cli/pom.xml index 478d2d8..78699c3 100644 --- a/cli/pom.xml +++ b/cli/pom.xml @@ -38,7 +38,7 @@ ${docker.name.windup.cli} - registry.access.redhat.com/openjdk/openjdk-11-rhel7:1.11 + registry.access.redhat.com/ubi8/openjdk-11:1.11 /opt/migrationtoolkit/bin/mta-cli / diff --git a/messaging-executor/pom.xml b/messaging-executor/pom.xml index 41cda12..f388dd4 100644 --- a/messaging-executor/pom.xml +++ b/messaging-executor/pom.xml @@ -37,7 +37,7 @@ ${docker.name.windup.web.executor} - registry.access.redhat.com/openjdk/openjdk-11-rhel7:1.11 + registry.access.redhat.com/ubi8/openjdk-11:1.11 /opt/mta-cli/bin/openshift-launch.sh / diff --git a/messaging-executor/src/main/resources/bin/mta-cli b/messaging-executor/src/main/resources/bin/mta-cli index a2570d3..79f1c71 100755 --- a/messaging-executor/src/main/resources/bin/mta-cli +++ b/messaging-executor/src/main/resources/bin/mta-cli @@ -27,15 +27,10 @@ ADDONS_DIR=() MTA_DEBUG_ARGS=() QUOTED_ARGS=() -RUN_OPENREWRITE=() -TRANSFORM_PROJECT_PATH=() -OPENREWRITE_QUOTED_ARGS=() -OPENREWRITE_GOAL=( "dryRun" ) ## Increase the open file limit if low, to what we need or at least to the hard limit. ## Complain if the hard limit is lower than what we need. -## Value set to 10000 to be aligned with windup-web-distribution -WE_NEED=10000 +WE_NEED=1024 MAX_HARD=$(ulimit -H -n); MAX_SOFT=$(ulimit -S -n); @@ -43,20 +38,17 @@ if [ $MAX_SOFT == 'unlimited' ] ; then MAX_SOFT=$WE_NEED; fi; if [ $MAX_HARD == 'unlimited' ] ; then MAX_HARD=$WE_NEED; fi; if [ $MAX_SOFT -lt $WE_NEED ] || [ $MAX_HARD -lt $WE_NEED ] ; then - if [ $MAX_HARD -lt $WE_NEED ] ; then - echo "" - echo "[WARNING] The limits ($MAX_SOFT/$MAX_HARD) for open files is too low and could make MTA unstable. Please increase them to at least $WE_NEED." - echo "" - echo " {RHEL & Fedora} Limits are typically configured in /etc/security/limits.conf" - echo " -> Follow instructions of https://access.redhat.com/solutions/60746" - echo "" - echo " {MacOS} Limits are typically configured in /etc/launchd.conf or /etc/sysctl.conf." - echo " -> Execute this script: https://gist.github.com/Maarc/d13b1e70f191d5b527a24d39dd3e2569 and restart your operating system." - echo "" - fi - MIN_WE_NEED_OR_CAN_HAVE=$(( $MAX_HARD > $WE_NEED ? $WE_NEED : $MAX_HARD )) - echo "Increasing the maximum of open files to $MIN_WE_NEED_OR_CAN_HAVE." - ulimit -S -n $MIN_WE_NEED_OR_CAN_HAVE + + echo "" + echo "[WARNING] The limits ($MAX_SOFT/$MAX_HARD) for open files is too low and could make MTA unstable. Please increase them to at least $WE_NEED." + echo "" + echo " {RHEL & Fedora} Limits are typically configured in /etc/security/limits.conf" + echo " -> Follow instructions of https://access.redhat.com/solutions/60746" + echo "" + echo " {MacOS} Limits are typically configured in /etc/launchd.conf or /etc/sysctl.conf." + echo " -> Execute this script: https://gist.github.com/Maarc/d13b1e70f191d5b527a24d39dd3e2569 and restart your operating system." + echo "" + fi @@ -74,15 +66,11 @@ while [ -h "$PRG" ] ; do fi done -saveddir=`pwd` - SCRIPT_HOME=`dirname "$SCRIPT_HOME"`/.. # make it fully qualified SCRIPT_HOME=`cd "$SCRIPT_HOME" && pwd` -cd "$saveddir" - echo "Changing to script home: $SCRIPT_HOME" cd $SCRIPT_HOME @@ -92,22 +80,7 @@ while [ "$1" != "" ] ; do MTA_DEBUG_ARGS=( "-Xdebug" "-Xnoagent" "-Djava.compiler=NONE" "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" ) fi - if [ "$1" = "--openrewrite" ] ; then - RUN_OPENREWRITE=( "yes" ) - elif [ "$1" = "--input" ] ; then - TRANSFORM_PROJECT_PATH=("$2") - elif [ "$1" = "$TRANSFORM_PROJECT_PATH" ] ; then - pathfound=true - elif [ "$1" = "--goal" ] ; then - OPENREWRITE_GOAL=("$2") - elif [ "$1" = "$OPENREWRITE_GOAL" ] ; then - goalfound=true - else - OPENREWRITE_QUOTED_ARGS+=("$1") - fi - QUOTED_ARGS+=("$1") - shift done @@ -170,14 +143,10 @@ if [ -z "$MTA_HOME" ] ; then fi done - saveddir=`pwd` - MTA_HOME=`dirname "$PRG"`/.. # make it fully qualified MTA_HOME=`cd "$MTA_HOME" && pwd` - - cd "$saveddir" fi echo Using MTA at $MTA_HOME @@ -220,15 +189,13 @@ if [ ! -x "$JAVACMD" ] ; then exit 1 fi -MODULES="" JAVAVER=`"$JAVACMD" -version 2>&1` case $JAVAVER in *"11"*) - MODULES="--add-modules=java.se" - echo "TECH PREVIEW Running on JDK $JAVAVER" -;; -*1.[1-9]*) - echo " Error: a Java 11 or higher JRE is required to run MTA; found [$JAVACMD -version == $JAVAVER]." + MODULES="--add-modules=java.se" + ;; +*) + echo " Error: a Java 11 JRE is required to run MTA; found [$JAVACMD -version == $JAVAVER]." exit 1 ;; esac @@ -273,13 +240,7 @@ fi MTA_OPTS="$MTA_OPTS $FILE_DESCRIPTOR_OPTS"; -if [ "$RUN_OPENREWRITE" != "" ] ; then - ( cd "$TRANSFORM_PROJECT_PATH"; exec mvn org.openrewrite.maven:rewrite-maven-plugin:4.13.0:"${OPENREWRITE_GOAL}" -DconfigLocation="${MTA_HOME}"/rules/openrewrite/rewrite.yml "${OPENREWRITE_QUOTED_ARGS[@]}" ) - exit 0; - -fi - JAVA_TOOL_OPTIONS="" -exec "$JAVACMD" $MODULES "${MTA_DEBUG_ARGS[@]}" $MTA_OPTS -Dforge.standalone=true -Dforge.home="${MTA_HOME}" -Dwindup.home="${MTA_HOME}" \ - -cp "${MTA_HOME}"/lib/'*' $MTA_MAIN_CLASS "${QUOTED_ARGS[@]}" "${ADDONS_DIR[@]}" +$JAVACMD "${MTA_DEBUG_ARGS[@]}" $MTA_OPTS -Dforge.standalone=true -Dforge.home=${MTA_HOME} -Dwindup.home=${MTA_HOME} -Djboss.modules.system.pkgs=sun.reflect \ + -cp ${MTA_HOME}/lib/'*' $MTA_MAIN_CLASS "${QUOTED_ARGS[@]}" "${ADDONS_DIR[@]}" diff --git a/web/pom.xml b/web/pom.xml index da405fa..51178a2 100644 --- a/web/pom.xml +++ b/web/pom.xml @@ -37,7 +37,7 @@ ${docker.name.windup.web} - registry.redhat.io/jboss-eap-7/eap73-openjdk11-openshift-rhel8:7.3.10 + registry.redhat.io/jboss-eap-7/eap73-openjdk11-openshift-rhel8:7.3.0 /opt/eap/bin/webapp-launch.sh / From 97a97641c65b9666fc821f45c0c303f24ba1741b Mon Sep 17 00:00:00 2001 From: Marco Rizzi Date: Thu, 17 Feb 2022 10:08:59 +0100 Subject: [PATCH 3/3] WINDUP-3269 Switched to OpenJDK11 runtime (#41) --- messaging-executor/pom.xml | 2 +- messaging-executor/src/main/resources/bin/mta-cli | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/messaging-executor/pom.xml b/messaging-executor/pom.xml index 33fe7e8..f388dd4 100644 --- a/messaging-executor/pom.xml +++ b/messaging-executor/pom.xml @@ -37,7 +37,7 @@ ${docker.name.windup.web.executor} - registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift:1.8 + registry.access.redhat.com/ubi8/openjdk-11:1.11 /opt/mta-cli/bin/openshift-launch.sh / diff --git a/messaging-executor/src/main/resources/bin/mta-cli b/messaging-executor/src/main/resources/bin/mta-cli index e9a23d7..ead9c5d 100755 --- a/messaging-executor/src/main/resources/bin/mta-cli +++ b/messaging-executor/src/main/resources/bin/mta-cli @@ -240,5 +240,5 @@ MTA_OPTS="$MTA_OPTS $FILE_DESCRIPTOR_OPTS"; JAVA_TOOL_OPTIONS="" -$JAVACMD "${MTA_DEBUG_ARGS[@]}" $MTA_OPTS -Dforge.standalone=true -Dforge.home=${MTA_HOME} -Dwindup.home=${MTA_HOME} \ +$JAVACMD "${MTA_DEBUG_ARGS[@]}" $MTA_OPTS -Dforge.standalone=true -Dforge.home=${MTA_HOME} -Dwindup.home=${MTA_HOME} -Djboss.modules.system.pkgs=sun.reflect \ -cp ${MTA_HOME}/lib/'*' $MTA_MAIN_CLASS "${QUOTED_ARGS[@]}" "${ADDONS_DIR[@]}"