This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 95baae1b4 [type: build] Support user-defined jvm param in startup
scripts (#3924)
95baae1b4 is described below
commit 95baae1b4206dc36f6615bf999e80346e5e903b5
Author: Kunshuai Zhu <[email protected]>
AuthorDate: Wed Sep 7 16:09:56 2022 +0800
[type: build] Support user-defined jvm param in startup scripts (#3924)
* Support user-defined jvm param in startup scripts
* Support user-defined jvm param in startup scripts
* Add default env in dockerfile
---
shenyu-dist/shenyu-admin-dist/Dockerfile | 3 ++-
.../src/main/resources/bin/start.sh | 25 +++++++++++++---------
shenyu-dist/shenyu-bootstrap-dist/Dockerfile | 2 ++
.../src/main/resources/bin/start.sh | 25 +++++++++++++---------
4 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/shenyu-dist/shenyu-admin-dist/Dockerfile
b/shenyu-dist/shenyu-admin-dist/Dockerfile
index a16a50311..1d9ee3822 100644
--- a/shenyu-dist/shenyu-admin-dist/Dockerfile
+++ b/shenyu-dist/shenyu-admin-dist/Dockerfile
@@ -15,10 +15,11 @@
# limitations under the License.
FROM openjdk:8-jre-alpine
-
+
ARG APP_NAME
ENV LOCAL_PATH /opt/shenyu-admin
+ENV ADMIN_JVM ""
RUN apk --no-cache add procps
diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh
b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh
index 5a920bdd0..4eb0c3101 100644
--- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh
+++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh
@@ -31,16 +31,21 @@ LOG_FILES=${LOGS_DIR}/shenyu-admin.log
EXT_LIB=${DEPLOY_DIR}/ext-lib
CLASS_PATH=.:${DEPLOY_DIR}/conf:${DEPLOY_DIR}/lib/*:${EXT_LIB}/*
-JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC
-XX:LargePageSizeInBytes=128m"
-
-version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'`
-echo "current jdk version:${version}"
-if [[ "$version" =~ "1.8" ]];then
-JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=70"
-elif [[ "$version" =~ "11" ]];then
-JAVA_OPTS="${JAVA_OPTS}"
-elif [[ "$version" =~ "17" ]];then
-JAVA_OPTS="${JAVA_OPTS}"
+if [ -z "${ADMIN_JVM}" ]; then
+ JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC
-XX:LargePageSizeInBytes=128m"
+ version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print
$3}'`
+ echo "current jdk version:${version}"
+ if [[ "$version" =~ "1.8" ]];then
+ JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
+ elif [[ "$version" =~ "11" ]];then
+ JAVA_OPTS="${JAVA_OPTS}"
+ elif [[ "$version" =~ "17" ]];then
+ JAVA_OPTS="${JAVA_OPTS}"
+ fi
+ echo "Use default jvm param: $JAVA_OPTS"
+else
+ JAVA_OPTS=${ADMIN_JVM}
+ echo "Start with the environment variable JAVA_OPTS set: $JAVA_OPTS"
fi
MAIN_CLASS=org.apache.shenyu.admin.ShenyuAdminBootstrap
diff --git a/shenyu-dist/shenyu-bootstrap-dist/Dockerfile
b/shenyu-dist/shenyu-bootstrap-dist/Dockerfile
index 118ed9ff0..f54f85d88 100644
--- a/shenyu-dist/shenyu-bootstrap-dist/Dockerfile
+++ b/shenyu-dist/shenyu-bootstrap-dist/Dockerfile
@@ -17,7 +17,9 @@
FROM openjdk:8-jre-alpine
ARG APP_NAME
+
ENV LOCAL_PATH /opt/shenyu-bootstrap
+ENV BOOT_JVM ""
RUN apk --no-cache add procps
diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh
b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh
index 4e79e31ee..bc9cad0cc 100644
--- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh
+++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh
@@ -31,16 +31,21 @@ LOG_FILES=${LOGS_DIR}/shenyu-bootstrap.log
EXT_LIB=${DEPLOY_DIR}/ext-lib
CLASS_PATH=.:${DEPLOY_DIR}/conf:${DEPLOY_DIR}/lib/*:${EXT_LIB}/*
-JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss512k -XX:+DisableExplicitGC
-XX:LargePageSizeInBytes=128m"
-
-version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'`
-echo "current jdk version:${version}"
-if [[ "$version" =~ "1.8" ]];then
-JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods -XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly
-XX:CMSInitiatingOccupancyFraction=70"
-elif [[ "$version" =~ "11" ]];then
-JAVA_OPTS="${JAVA_OPTS}"
-elif [[ "$version" =~ "17" ]];then
-JAVA_OPTS="${JAVA_OPTS}"
+if [ -z "${BOOT_JVM}" ]; then
+ JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss512k -XX:+DisableExplicitGC
-XX:LargePageSizeInBytes=128m"
+ version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print
$3}'`
+ echo "current jdk version:${version}"
+ if [[ "$version" =~ "1.8" ]];then
+ JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods
-XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled
-XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
+ elif [[ "$version" =~ "11" ]];then
+ JAVA_OPTS="${JAVA_OPTS}"
+ elif [[ "$version" =~ "17" ]];then
+ JAVA_OPTS="${JAVA_OPTS}"
+ fi
+ echo "Use default jvm param: $JAVA_OPTS"
+else
+ JAVA_OPTS=${BOOT_JVM}
+ echo "Start with the environment variable JAVA_OPTS set: $JAVA_OPTS"
fi
MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication