From 6aff288054a884693d82a22e2fce0af7251ab46a Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Tue, 20 Aug 2024 23:06:41 +0200 Subject: [PATCH 1/4] add jdk17 option --- manifests/init.pp | 2 +- templates/setenv.sh.erb | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index df47b93..d83d25c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -6,7 +6,7 @@ # JVM Settings $javahome = undef, - Enum['openjdk-11', 'oracle-jdk-1.8', 'custom'] $jvm_type = 'openjdk-11', + Enum['openjdk-17', 'openjdk-11', 'oracle-jdk-1.8', 'custom'] $jvm_type = 'openjdk-11', $jvm_xms = '256m', $jvm_xmx = '1024m', $jvm_permgen = '256m', diff --git a/templates/setenv.sh.erb b/templates/setenv.sh.erb index 5647baa..0c1ee05 100644 --- a/templates/setenv.sh.erb +++ b/templates/setenv.sh.erb @@ -88,12 +88,16 @@ CATALINA_OPTS="-XX:+IgnoreUnrecognizedVMOptions ${CATALINA_OPTS}" CATALINA_OPTS="-Xlog:gc+age=debug:file=$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log::filecount=5,filesize=2M ${CATALINA_OPTS}" <%- end -%> <%- end -%> -<%- if scope.lookupvar('confluence::jvm_type') == 'openjdk-11' -%> +<%- if scope.lookupvar('confluence::jvm_type') == 'openjdk-17' -%> +CATALINA_OPTS="-XX:+ExplicitGCInvokesConcurrent ${CATALINA_OPTS}" +CATALINA_OPTS="-Xlog:gc*:file=$LOGBASEABS/logs/gc-%t.log:tags,time,uptime,level:filecount=5,filesize=2M ${CATALINA_OPTS}" +<%- elsif scope.lookupvar('confluence::jvm_type') == 'openjdk-11' -%> CATALINA_OPTS="-XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDateStamps ${CATALINA_OPTS}" +CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}" <%- elsif scope.lookupvar('confluence::jvm_type') == 'oracle-jdk-1.8' -%> CATALINA_OPTS="-XX:-PrintGCDetails -XX:+PrintGCDateStamps -XX:-PrintTenuringDistribution ${CATALINA_OPTS}" -<%- end -%> CATALINA_OPTS="-Xloggc:$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=2M ${CATALINA_OPTS}" +<%- end -%> CATALINA_OPTS="-XX:G1ReservePercent=20 ${CATALINA_OPTS}" CATALINA_OPTS="-Djava.awt.headless=true ${CATALINA_OPTS}" CATALINA_OPTS="-Datlassian.plugins.enable.wait=300 ${CATALINA_OPTS}" From 581cff73f5749375f5c45b38a347ec015d2fc751 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Fri, 23 Aug 2024 15:28:37 +0200 Subject: [PATCH 2/4] limit impact of highly dangerous condition to v7 only --- templates/setenv.sh.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/setenv.sh.erb b/templates/setenv.sh.erb index 0c1ee05..face771 100644 --- a/templates/setenv.sh.erb +++ b/templates/setenv.sh.erb @@ -82,7 +82,7 @@ export JAVA_OPTS # Set the JVM arguments used to start Confluence. For a description of the options, see # http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html -<%- if version[0] >= 7 # 7.x.x or higher -%> +<%- if version[0] == 7 # 7.x.x or higher -%> <%- if version[1] >= 1 # 7.1.x or higher -%> CATALINA_OPTS="-XX:+IgnoreUnrecognizedVMOptions ${CATALINA_OPTS}" CATALINA_OPTS="-Xlog:gc+age=debug:file=$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log::filecount=5,filesize=2M ${CATALINA_OPTS}" From d46a751c0888d3168c499d95d6ae37797f0f1ab0 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Fri, 23 Aug 2024 15:49:38 +0200 Subject: [PATCH 3/4] add tests for JDK17 --- spec/classes/confluence_config_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/classes/confluence_config_spec.rb b/spec/classes/confluence_config_spec.rb index a8822ae..b0d23d5 100644 --- a/spec/classes/confluence_config_spec.rb +++ b/spec/classes/confluence_config_spec.rb @@ -268,6 +268,23 @@ end end + context 'jdk17 specific option' do + let(:params) do + { + version: '8.5.14', + javahome: '/opt/java', + jvm_type: 'openjdk-17' + } + end + + it do + is_expected.to compile.with_all_deps + is_expected.to contain_file('/opt/confluence/atlassian-confluence-8.5.14/bin/setenv.sh'). + with_content(%r{CATALINA_OPTS="-XX:\+ExplicitGCInvokesConcurrent \${CATALINA_OPTS}"}). + with_content(%r{CATALINA_OPTS="-Xlog:gc\*:file=\$LOGBASEABS/logs/gc-%t.log:tags,time,uptime,level:filecount=5,filesize=2M \${CATALINA_OPTS}"}) # fix this spec test + end + end + context 'manage_user set to true' do let(:params) do { From 6f4fa1356549e024a4fe9295a7c833f3f57c7ff4 Mon Sep 17 00:00:00 2001 From: Simon Hoenscheid Date: Fri, 23 Aug 2024 16:37:48 +0200 Subject: [PATCH 4/4] update comment --- templates/setenv.sh.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/setenv.sh.erb b/templates/setenv.sh.erb index face771..ff3215f 100644 --- a/templates/setenv.sh.erb +++ b/templates/setenv.sh.erb @@ -82,7 +82,7 @@ export JAVA_OPTS # Set the JVM arguments used to start Confluence. For a description of the options, see # http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html -<%- if version[0] == 7 # 7.x.x or higher -%> +<%- if version[0] == 7 # 7.x.x -%> <%- if version[1] >= 1 # 7.1.x or higher -%> CATALINA_OPTS="-XX:+IgnoreUnrecognizedVMOptions ${CATALINA_OPTS}" CATALINA_OPTS="-Xlog:gc+age=debug:file=$LOGBASEABS/logs/gc-`date +%F_%H-%M-%S`.log::filecount=5,filesize=2M ${CATALINA_OPTS}"