Skip to content

Commit 6f3ed71

Browse files
authored
Sync setenv.sh settings with upstream 8.13.5 (LTS) (#357)
* Sync setenv.sh settings with upstream and reduce diff This undeprecates $java_opts for backwards compatibility and repurposes the other parameters to do what a custom $jvm_type did previously. It removes "-XX:HeapDumpOnOutOfMemoryError" because that's not a default setting in the upstream setenv.sh It also makes setting $jvm_permgen a no-op, since JIRA doesn't support JDK older than 8 anymore and the option does nothing * Add maintainer note about sticking close to upstream
1 parent 4af9589 commit 6f3ed71

File tree

7 files changed

+77
-127
lines changed

7 files changed

+77
-127
lines changed

Diff for: README.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ Defaults to `http://cdn.mysql.com/Downloads/Connector-J`
357357

358358
##### `$javahome`
359359

360-
The JAVA_HOME directory, defaults to undef. This is a *required* parameter
360+
The `JAVA_HOME` directory, defaults to undef. This is a *required* parameter
361361

362362
##### `$jvm_xms`
363363

@@ -369,18 +369,28 @@ defaults to '256m'
369369
Maximum memory allocation pool for a Java Virtual Machine.
370370
defaults to '1024m'
371371

372-
##### `$jvm_permgen`
372+
##### `$jvm_type`
373373

374-
Increase max permgen size for a Java Virtual Machine.
375-
defaults to '256m'
374+
Choose your JVM type. Valid values are 'openjdk-11', 'oracle-jdk-1.8'
375+
This setting affects various defaults in setenv.sh if the options aren't defined
376376

377-
##### `$jvm_optional`
377+
##### `$java_opts`
378378

379-
defaults to '-XX:-HeapDumpOnOutOfMemoryError'
379+
defaults to ''. This sets `JVM_SUPPORT_RECOMMENDED_ARGS` in setenv.sh
380380

381-
##### `$java_opts`
381+
##### `$jvm_gc_args`
382382

383-
defaults to ''
383+
This sets `JVM_GC_ARGS` in `setenv.sh`. Defaults to undef, meaning
384+
the module makes a choice based on `jvm_type`
385+
386+
##### `$jvm_code_cache_args`
387+
388+
This sets `JVM_CODE_CACHE_ARGS` in `setenv.sh`. Defaults to undef, meaning
389+
the module makes a choice based on `jvm_type`
390+
391+
##### `$jvm_extra_args`
392+
This sets `JVM_EXTRA_ARGS` in `setenv.sh`. Defaults to undef, meaning
393+
the module makes a choice based on `jvm_type`
384394

385395
##### `$catalina_opts`
386396

Diff for: manifests/config.pp

+9-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
2323
group => $jira::group,
2424
}
2525

26+
# JVM args. These will be the defaults if not overridden
27+
if $jira::jvm_type == 'openjdk-11' {
28+
$jvm_gc_args = '-XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent'
29+
} else {
30+
$jvm_gc_args = '-XX:+ExplicitGCInvokesConcurrent'
31+
}
32+
$jvm_code_cache_args = '-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m'
33+
$jvm_extra_args = '-XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT'
34+
2635
$dbschema_default = $jira::db ? {
2736
'postgresql' => 'public',
2837
default => undef
@@ -31,13 +40,6 @@
3140
# can't use pick_default: https://tickets.puppetlabs.com/browse/MODULES-11018
3241
$dbschema = if $jira::dbschema { $jira::dbschema } else { $dbschema_default }
3342

34-
if $jira::java_opts {
35-
deprecation('jira::java_opts', 'jira::java_opts is deprecated. Please use jira::jvm_extra_args')
36-
$jvm_extra_args_real = "${jira::java_opts} ${jira::jvm_extra_args}"
37-
} else {
38-
$jvm_extra_args_real = $jira::jvm_extra_args
39-
}
40-
4143
# Allow some backwards compatibility;
4244
if $jira::poolsize {
4345
deprecation('jira::poolsize', 'jira::poolsize is deprecated and simply sets max-pool-size. Please use jira::pool_max_size instead and remove this configuration')

Diff for: manifests/init.pp

+8-5
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,10 @@
8787
Jira::Jvm_types $jvm_type = 'openjdk-11',
8888
String $jvm_xms = '256m',
8989
String $jvm_xmx = '1024m',
90-
String $jvm_permgen = '256m',
91-
Optional[String] $jvm_optional = undef,
92-
Optional[String] $jvm_extra_args = undef,
90+
Optional[String] $java_opts = undef,
9391
Optional[String] $jvm_gc_args = undef,
94-
Optional[String] $jvm_codecache_args = undef,
92+
Optional[String] $jvm_code_cache_args = undef,
93+
Optional[String] $jvm_extra_args = undef,
9594
Integer $jvm_nofiles_limit = 16384,
9695
String $catalina_opts = '',
9796
# Misc Settings
@@ -160,8 +159,8 @@
160159
Integer $session_validationinterval = 5,
161160
String $session_lastvalidation = 'session.lastvalidation',
162161
# Deprecated parameters
162+
Optional[String] $jvm_permgen = undef,
163163
Optional[Integer[0]] $poolsize = undef,
164-
Optional[String] $java_opts = undef,
165164
Optional[Boolean] $enable_connection_pooling = undef,
166165
) inherits jira::params {
167166
if versioncmp($jira::version, '8.0.0') < 0 {
@@ -172,6 +171,10 @@
172171
fail("\$shared_homedir must be set when \$datacenter is true")
173172
}
174173

174+
if $jvm_permgen {
175+
fail('jira::jvm_permgen', 'jira::jvm_permgen has been removed and no longer does anything. Configuring it hasn\'t been supported since JDK 8')
176+
}
177+
175178
if $enable_connection_pooling != undef {
176179
deprecation('jira::enable_connection_pooling', 'jira::enable_connection_pooling has been removed and does nothing. Please simply configure the connection pooling parameters')
177180
}

Diff for: spec/classes/jira_config_spec.rb

+3-31
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@
674674
it do
675675
is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/setenv.sh').
676676
with_content(%r{#DISABLE_NOTIFICATIONS=}).
677-
with_content(%r{JVM_SUPPORT_RECOMMENDED_ARGS='\S+HeapDumpOnOutOfMemoryError}).
677+
with_content(%r{JVM_SUPPORT_RECOMMENDED_ARGS=''}).
678678
with_content(%r{JVM_GC_ARGS='.+ \-XX:\+ExplicitGCInvokesConcurrent}).
679679
with_content(%r{JVM_CODE_CACHE_ARGS='\S+InitialCodeCacheSize=32m \S+ReservedCodeCacheSize=512m}).
680680
with_content(%r{JVM_REQUIRED_ARGS='.+InterningDocumentFactory})
@@ -695,10 +695,9 @@
695695
{
696696
version: '8.16.0',
697697
javahome: '/opt/java',
698-
jvm_type: 'custom',
699-
jvm_optional: '-XX:-TEST_OPTIONAL',
698+
java_opts: '-XX:-TEST_OPTIONAL',
700699
jvm_gc_args: '-XX:-TEST_GC_ARG',
701-
jvm_codecache_args: '-XX:-TEST_CODECACHE',
700+
jvm_code_cache_args: '-XX:-TEST_CODECACHE',
702701
jvm_extra_args: '-XX:-TEST_EXTRA'
703702
}
704703
end
@@ -722,33 +721,6 @@
722721
it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
723722
it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/check-java.sh') }
724723
end
725-
726-
context 'jira-8.12 - openjdk-11 with additional jvm params' do
727-
let(:params) do
728-
{
729-
version: '8.16.0',
730-
javahome: '/opt/java',
731-
jvm_type: 'openjdk-11',
732-
jvm_optional: '-XX:-TEST_OPTIONAL',
733-
jvm_gc_args: '-XX:-TEST_GC_ARG',
734-
jvm_codecache_args: '-XX:-TEST_CODECACHE',
735-
jvm_extra_args: '-XX:-TEST_EXTRA'
736-
}
737-
end
738-
739-
it { is_expected.to compile.with_all_deps }
740-
it do
741-
is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/setenv.sh').
742-
with_content(%r{JVM_SUPPORT_RECOMMENDED_ARGS='.+TEST_OPTIONAL'}).
743-
with_content(%r{JVM_GC_ARGS='.+TEST_GC_ARG'}).
744-
with_content(%r{JVM_CODE_CACHE_ARGS='.+TEST_CODECACHE'}).
745-
with_content(%r{JVM_EXTRA_ARGS='.+TEST_EXTRA'})
746-
end
747-
it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/user.sh') }
748-
it { is_expected.to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/conf/server.xml') }
749-
it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
750-
it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.16.0-standalone/bin/check-java.sh') }
751-
end
752724
end
753725
end
754726
end

Diff for: spec/type_aliases/jvm_types_spec.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
describe 'Jira::Jvm_types' do
44
describe 'valid attributes' do
55
['openjdk-11',
6-
'oracle-jdk-1.8',
7-
'custom'].each do |value|
6+
'oracle-jdk-1.8'].each do |value|
87
describe value.inspect do
98
it { is_expected.to allow_value(value) }
109
end

Diff for: templates/setenv.sh.epp

+37-73
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<%# MAINTAINERS: try to keep diff with the original file to a minimum #-%>
2+
<%# Don't include shell style fixes unless they fix real bugs #-%>
13
#
24
# If the limit of files that Jira can open is too low, it will be set to this value.
35
#
@@ -11,45 +13,27 @@ JIRA_HOME="<%= $jira::homedir %>"
1113
#
1214
# Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable below to do that.
1315
#
14-
<%- if $jira::jvm_type == 'openjdk-11' { -%>
15-
JVM_SUPPORT_RECOMMENDED_ARGS='-XX:-HeapDumpOnOutOfMemoryError <%= $jira::jvm_optional %>'
16-
<%- } elsif $jira::jvm_type == 'oracle-jdk-1.8' { -%>
17-
JVM_SUPPORT_RECOMMENDED_ARGS='-XX:-HeapDumpOnOutOfMemoryError <%= $jira::jvm_optional %>'
18-
<%- } elsif $jira::jvm_type == 'custom' { -%>
19-
JVM_SUPPORT_RECOMMENDED_ARGS='<%= $jira::jvm_optional %>'
20-
<%- } -%>
16+
# Puppet: $jira::jvm_type is <%= $jira::jvm_type %>
17+
JVM_SUPPORT_RECOMMENDED_ARGS='<%= $jira::java_opts %>'
2118

2219
#
2320
# You can use variable below to modify garbage collector settings.
2421
# For Java 8 we recommend default settings
2522
# For Java 11 and relatively small heaps we recommend: -XX:+UseParallelGC
2623
# For Java 11 and larger heaps we recommend: -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent
2724
#
28-
<%- if $jira::jvm_type == 'openjdk-11' { -%>
29-
JVM_GC_ARGS='-XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent <%= $jira::jvm_gc_args %>'
30-
<%- } elsif $jira::jvm_type == 'oracle-jdk-1.8' { -%>
31-
JVM_GC_ARGS='<%= $jira::jvm_gc_args %>'
32-
<%- } elsif $jira::jvm_type == 'custom' { -%>
33-
JVM_GC_ARGS='<%= $jira::jvm_gc_args %>'
34-
<%- } -%>
25+
JVM_GC_ARGS='<%= pick_default($jira::jvm_gc_args, $jira::config::jvm_gc_args) %>'
3526

3627
#
3728
# The following 2 settings control the minimum and maximum given to the JIRA Java virtual machine. In larger JIRA instances, the maximum amount will need to be increased.
3829
#
3930
JVM_MINIMUM_MEMORY='<%= $jira::jvm_xms %>'
4031
JVM_MAXIMUM_MEMORY='<%= $jira::jvm_xmx %>'
41-
JVM_PERMGEN_MEMORY='<%= $jira::jvm_permgen %>'
4232

4333
#
4434
# The following setting configures the size of JVM code cache. A high value of reserved size allows Jira to work with more installed apps.
4535
#
46-
<%- if $jira::jvm_type == 'openjdk-11' { -%>
47-
JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m <%= $jira::jvm_codecache_args %>'
48-
<%- } elsif $jira::jvm_type == 'oracle-jdk-1.8' { -%>
49-
JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m <%= $jira::jvm_codecache_args %>'
50-
<%- } elsif $jira::jvm_type == 'custom' { -%>
51-
JVM_CODE_CACHE_ARGS='<%= $jira::jvm_codecache_args %>'
52-
<%- } -%>
36+
JVM_CODE_CACHE_ARGS='<%= pick_default($jira::jvm_code_cache_args, $jira::config::jvm_code_cache_args) %>'
5337

5438
#
5539
# The following are the required arguments for Jira.
@@ -65,9 +49,9 @@ JVM_REQUIRED_ARGS='-Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.ap
6549
# Uncomment this setting if you want to import data without notifications
6650
#
6751
<%- if $jira::disable_notifications { -%>
68-
DISABLE_NOTIFICATIONS='-Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true'
52+
DISABLE_NOTIFICATIONS=" -Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true"
6953
<% } else { %>
70-
#DISABLE_NOTIFICATIONS='-Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true'
54+
#DISABLE_NOTIFICATIONS=" -Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true"
7155
<% } -%>
7256

7357

@@ -81,90 +65,70 @@ DISABLE_NOTIFICATIONS='-Datlassian.mail.senddisabled=true -Datlassian.mail.fetch
8165
# Prevents the JVM from suppressing stack traces if a given type of exception
8266
# occurs frequently, which could make it harder for support to diagnose a problem.
8367
#-----------------------------------------------------------------------------------
84-
<%- if $jira::jvm_type == 'openjdk-11' { -%>
85-
JVM_EXTRA_ARGS='<%= $jira::config::jvm_extra_args_real %>'
86-
JVM_EXTRA_ARGS+='-XX:+ExplicitGCInvokesConcurrent -XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT'
87-
<%- } elsif $jira::jvm_type == 'oracle-jdk-1.8' { -%>
88-
JVM_EXTRA_ARGS='-XX:+PrintGCDateStamps -XX:+ExplicitGCInvokesConcurrent -XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT <%= $jira::config::jvm_extra_args_real %>'
89-
<%- } elsif $jira::jvm_type == 'custom' { -%>
90-
JVM_EXTRA_ARGS='<%= $jira::config::jvm_extra_args_real %>'
91-
<%- } -%>
68+
JVM_EXTRA_ARGS='<%= pick_default($jira::jvm_extra_args, $jira::config::jvm_extra_args) %>'
9269

9370
CURRENT_NOFILES_LIMIT=$( ulimit -Hn )
94-
ulimit -Sn "${CURRENT_NOFILES_LIMIT}"
71+
ulimit -Sn $CURRENT_NOFILES_LIMIT
9572
ulimit -n $(( CURRENT_NOFILES_LIMIT > MIN_NOFILES_LIMIT ? CURRENT_NOFILES_LIMIT : MIN_NOFILES_LIMIT ))
9673

97-
PRGDIR=$(dirname "$0")
74+
PRGDIR=`dirname "$0"`
9875
cat "${PRGDIR}"/jirabanner.txt
9976

10077
JIRA_HOME_MINUSD=""
101-
if [ -n "${JIRA_HOME}" ]; then
102-
echo "${JIRA_HOME}" | grep -q " "
78+
if [ "$JIRA_HOME" != "" ]; then
79+
echo $JIRA_HOME | grep -q " "
10380
if [ $? -eq 0 ]; then
104-
echo ""
105-
echo "--------------------------------------------------------------------------------------------------------------------"
106-
echo " WARNING : You cannot have a JIRA_HOME environment variable set with spaces in it. This variable is being ignored"
107-
echo "--------------------------------------------------------------------------------------------------------------------"
81+
echo ""
82+
echo "--------------------------------------------------------------------------------------------------------------------"
83+
echo " WARNING : You cannot have a JIRA_HOME environment variable set with spaces in it. This variable is being ignored"
84+
echo "--------------------------------------------------------------------------------------------------------------------"
10885
else
109-
JIRA_HOME_MINUSD=-Djira.home="${JIRA_HOME}"
86+
JIRA_HOME_MINUSD=-Djira.home=$JIRA_HOME
11087
fi
11188
fi
11289

11390
JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JVM_CODE_CACHE_ARGS} ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${DISABLE_NOTIFICATIONS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${JVM_EXTRA_ARGS} ${JIRA_HOME_MINUSD} ${START_JIRA_JAVA_OPTS}"
11491

115-
# Perm Gen size needs to be increased if encountering OutOfMemoryError: PermGen problems. Specifying PermGen size is not valid on IBM JDKs
116-
JIRA_MAX_PERM_SIZE=${JVM_PERMGEN_MEMORY}
117-
if [ -f "${PRGDIR}/permgen.sh" ]; then
118-
echo "Detecting JVM PermGen support..."
119-
. "${PRGDIR}/permgen.sh"
120-
if [ "${JAVA_PERMGEN_SUPPORTED}" = "true" ]; then
121-
echo "PermGen switch is supported. Setting to ${JIRA_MAX_PERM_SIZE}"
122-
JAVA_OPTS="-XX:MaxPermSize=${JIRA_MAX_PERM_SIZE} ${JAVA_OPTS}"
123-
else
124-
echo "PermGen switch is NOT supported and will NOT be set automatically."
125-
fi
126-
fi
127-
12892
export JAVA_OPTS
12993

13094
# DO NOT remove the following line
13195
# !INSTALLER SET JAVA_HOME
13296

13397
echo ""
134-
echo "If you encounter issues starting or stopping Jira, please see the Troubleshooting guide at https://docs.atlassian.com/jira/jadm-docs-0812/Troubleshooting+installation"
98+
echo "If you encounter issues starting or stopping Jira, please see the Troubleshooting guide at https://docs.atlassian.com/jira/jadm-docs-0813/Troubleshooting+installation"
13599
echo ""
136-
if [ -n "${JIRA_HOME_MINUSD}" ]; then
137-
echo "Using JIRA_HOME: ${JIRA_HOME}"
100+
if [ "$JIRA_HOME_MINUSD" != "" ]; then
101+
echo "Using JIRA_HOME: $JIRA_HOME"
138102
fi
139103

140104
# set the location of the pid file
141-
if [ -z "${CATALINA_PID}" ] ; then
142-
if [ -n "${CATALINA_HOME}" ] ; then
143-
CATALINA_PID="${CATALINA_HOME}/work/catalina.pid"
144-
elif [ -n "${CATALINA_HOME}" ] ; then
145-
CATALINA_PID="${CATALINA_HOME}/work/catalina.pid"
105+
if [ -z "$CATALINA_PID" ] ; then
106+
if [ -n "$CATALINA_BASE" ] ; then
107+
CATALINA_PID="$CATALINA_BASE"/work/catalina.pid
108+
elif [ -n "$CATALINA_HOME" ] ; then
109+
CATALINA_PID="$CATALINA_HOME"/work/catalina.pid
146110
fi
147111
fi
148112
export CATALINA_PID
149113

150-
if [ -z "${CATALINA_HOME}" ]; then
151-
if [ -z "${CATALINA_HOME}" ]; then
152-
LOGBASE=${PRGDIR}
114+
if [ -z "$CATALINA_BASE" ]; then
115+
if [ -z "$CATALINA_HOME" ]; then
116+
LOGBASE=$PRGDIR
153117
LOGTAIL=..
154118
else
155-
LOGBASE=${CATALINA_HOME}
119+
LOGBASE=$CATALINA_HOME
156120
LOGTAIL=.
157121
fi
158122
else
159-
LOGBASE=${CATALINA_BASE}
123+
LOGBASE=$CATALINA_BASE
160124
LOGTAIL=.
161125
fi
162126

163-
PUSHED_DIR=$(pwd)
164-
cd ${LOGBASE}
165-
cd ${LOGTAIL}
166-
LOGBASEABS=$(pwd)
167-
cd ${PUSHED_DIR}
127+
PUSHED_DIR=`pwd`
128+
cd $LOGBASE
129+
cd $LOGTAIL
130+
LOGBASEABS=`pwd`
131+
cd $PUSHED_DIR
168132

169133
echo ""
170-
echo "Server startup logs are located in ${LOGBASEABS}/logs/catalina.out"
134+
echo "Server startup logs are located in $LOGBASEABS/logs/catalina.out"

Diff for: types/jvm_types.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# @summary Java Virtual Machine (JVM) types
2-
type Jira::Jvm_types = Enum['openjdk-11', 'oracle-jdk-1.8', 'custom']
2+
type Jira::Jvm_types = Enum['openjdk-11', 'oracle-jdk-1.8']

0 commit comments

Comments
 (0)