diff --git a/manifests/init.pp b/manifests/init.pp index 4ddbcb92..d444a173 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -71,6 +71,7 @@ $mysql_connector_format = 'tar.gz', Stdlib::Absolutepath $mysql_connector_install = '/opt/MySQL-connector', Stdlib::HTTPUrl $mysql_connector_url = 'https://dev.mysql.com/get/Downloads/Connector-J', + String[1] $mysql_connector_jar_suffix = '-bin', # Configure database settings if you are pooling connections $enable_connection_pooling = false, $pool_min_size = 20, @@ -86,12 +87,17 @@ $pool_test_on_borrow = false, # JVM Settings $javahome = undef, - $jvm_xms = '256m', - $jvm_xmx = '1024m', - $jvm_permgen = '256m', - $jvm_optional = '-XX:-HeapDumpOnOutOfMemoryError', - $java_opts = '', - $catalina_opts = '', + Enum['openjdk-11', 'oracle-jdk-1.8', 'custom'] $jvm_type = 'custom', + String $jvm_xms = '256m', + String $jvm_xmx = '1024m', + String $jvm_permgen = '256m', + String $jvm_optional = '-XX:-HeapDumpOnOutOfMemoryError', + String $jvm_extra_args = '-XX:+PrintGCDateStamps -XX:+ExplicitGCInvokesConcurrent -XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT', + String $jvm_gc_args = '-XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent', + String $jvm_codecache_args = '-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m', + Integer $jvm_nofiles_limit = 16384, + String $java_opts = '', + String $catalina_opts = '', # Misc Settings Stdlib::HTTPUrl $download_url = 'https://product-downloads.atlassian.com/software/jira/downloads', $checksum = undef, diff --git a/manifests/mysql_connector.pp b/manifests/mysql_connector.pp index 726eba82..064e61c0 100644 --- a/manifests/mysql_connector.pp +++ b/manifests/mysql_connector.pp @@ -5,6 +5,7 @@ $format = $jira::mysql_connector_format, $installdir = $jira::mysql_connector_install, $download_url = $jira::mysql_connector_url, + $jar_suffix = $jira::mysql_connector_jar_suffix, ) { require staging @@ -31,6 +32,6 @@ -> file { "${jira::webappdir}/lib/mysql-connector-java.jar": ensure => link, - target => "${installdir}/${product}-${version}/${product}-${version}-bin.jar", + target => "${installdir}/${product}-${version}/${product}-${version}${jar_suffix}.jar", } } diff --git a/templates/setenv.sh.erb b/templates/setenv.sh.erb index 80788a7f..22e4fc5d 100755 --- a/templates/setenv.sh.erb +++ b/templates/setenv.sh.erb @@ -1,33 +1,66 @@ # -# One way to set the JIRA HOME path is here via this variable. Simply uncomment it and set a valid path like /jira/home. You can of course set it outside in the command terminal. That will also work. +# If the limit of files that Jira can open is too low, it will be set to this value. # -JIRA_HOME="<%= scope.lookupvar('jira::homedir') %>" +MIN_NOFILES_LIMIT=<%= @jvm_nofiles_limit %> # -# Additional JAVA_OPTS +# One way to set the JIRA HOME path is here via this variable. Simply uncomment it and set a valid path like /jira/home. You can of course set it outside in the command terminal. That will also work. # -JAVA_OPTS="<%= scope.lookupvar('jira::java_opts') %> $JAVA_OPTS" +JIRA_HOME="<%= @homedir %>" + # -# Additional CATALINA_OPTS +# Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable below to do that. # -CATALINA_OPTS="<%= scope.lookupvar('jira::catalina_opts') %> $CATALINA_OPTS" +<%- if @jvm_type == 'openjdk-11' -%> +JVM_SUPPORT_RECOMMENDED_ARGS='-XX:-HeapDumpOnOutOfMemoryError' +<%- elsif @jvm_type == 'oracle-jdk-1.8' -%> +JVM_SUPPORT_RECOMMENDED_ARGS='-XX:-HeapDumpOnOutOfMemoryError' +<%- elsif @jvm_type == 'custom' -%> +JVM_SUPPORT_RECOMMENDED_ARGS="<%= @jvm_optional %>" +<%- end -%> # -# Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable below to do that. +# You can use variable below to modify garbage collector settings. +# For Java 8 we recommend default settings +# For Java 11 and relatively small heaps we recommend: -XX:+UseParallelGC +# For Java 11 and larger heaps we recommend: -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent # -JVM_SUPPORT_RECOMMENDED_ARGS="<%= scope.lookupvar('jira::jvm_optional') %>" +<%- if @jvm_type == 'openjdk-11' -%> +JVM_GC_ARGS='-XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent' +<%- elsif @jvm_type == 'oracle-jdk-1.8' -%> +JVM_GC_ARGS='' +<%- elsif @jvm_type == 'custom' -%> +JVM_GC_ARGS="<%= @jvm_gc_args %>" +<%- end -%> # # 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. # -JVM_MINIMUM_MEMORY="<%= scope.lookupvar('jira::jvm_xms') %>" -JVM_MAXIMUM_MEMORY="<%= scope.lookupvar('jira::jvm_xmx') %>" -JVM_PERMGEN_MEMORY="<%= scope.lookupvar('jira::jvm_permgen') %>" +JVM_MINIMUM_MEMORY="<%= @jvm_xms %>" +JVM_MAXIMUM_MEMORY="<%= @jvm_xmx %>" +JVM_PERMGEN_MEMORY="<%= @jvm_permgen %>" + +# +# The following setting configures the size of JVM code cache. A high value of reserved size allows Jira to work with more installed apps. +# +<%- if @jvm_type == 'openjdk-11' -%> +JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m' +<%- elsif @jvm_type == 'oracle-jdk-1.8' -%> +JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m' +<%- elsif @jvm_type == 'custom' -%> +JVM_CODE_CACHE_ARGS="<%= @jvm_codecache_args %>" +<%- end -%> # -# The following are the required arguments for JIRA. +# The following are the required arguments for Jira. # -JVM_REQUIRED_ARGS="-Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true" +<%- if scope.call_function('versioncmp', [@version, '8.11.0']) > 0 -%> +JVM_REQUIRED_ARGS='-Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true -Dorg.dom4j.factory=com.atlassian.core.xml.InterningDocumentFactory' +<% else -%> +JVM_REQUIRED_ARGS='-Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dmail.mime.decodeparameters=true' +<%- end -%> + + # Uncomment this setting if you want to import data without notifications # @@ -37,6 +70,7 @@ DISABLE_NOTIFICATIONS=" -Datlassian.mail.senddisabled=true -Datlassian.mail.fetc #DISABLE_NOTIFICATIONS=" -Datlassian.mail.senddisabled=true -Datlassian.mail.fetchdisabled=true -Datlassian.mail.popdisabled=true" <% end -%> + #----------------------------------------------------------------------------------- # # In general don't make changes below here @@ -44,35 +78,45 @@ DISABLE_NOTIFICATIONS=" -Datlassian.mail.senddisabled=true -Datlassian.mail.fetc #----------------------------------------------------------------------------------- #----------------------------------------------------------------------------------- -# This allows us to actually debug GC related issues by correlating timestamps -# with other parts of the application logs. +# Prevents the JVM from suppressing stack traces if a given type of exception +# occurs frequently, which could make it harder for support to diagnose a problem. #----------------------------------------------------------------------------------- -JVM_EXTRA_ARGS="-XX:+PrintGCDateStamps" - -PRGDIR=`dirname "$0"` +<%- if @jvm_type == 'openjdk-11' -%> +JVM_EXTRA_ARGS='-Xlog:gc*:verbose_gc.log:time,uptime:filecount=15,filesize=10M -XX:+ExplicitGCInvokesConcurrent -XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT' +<%- elsif @jvm_type == 'oracle-jdk-1.8' -%> +JVM_EXTRA_ARGS='-XX:+PrintGCDateStamps -XX:+ExplicitGCInvokesConcurrent -XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT' +<%- elsif @jvm_type == 'custom' -%> +JVM_EXTRA_ARGS="<%= @jvm_extra_args %>" +<%- end -%> + +CURRENT_NOFILES_LIMIT=$( ulimit -Hn ) +ulimit -Sn "${CURRENT_NOFILES_LIMIT}" +ulimit -n $(( CURRENT_NOFILES_LIMIT > MIN_NOFILES_LIMIT ? CURRENT_NOFILES_LIMIT : MIN_NOFILES_LIMIT )) + +PRGDIR=$(dirname "$0") cat "${PRGDIR}"/jirabanner.txt JIRA_HOME_MINUSD="" -if [ "$JIRA_HOME" != "" ]; then - echo $JIRA_HOME | grep -q " " - if [ $? -eq 0 ]; then +if [[ "${JIRA_HOME}" != "" ]]; then + echo "${JIRA_HOME}" | grep -q " " + if [[ $? -eq 0 ]]; then echo "" echo "--------------------------------------------------------------------------------------------------------------------" echo " WARNING : You cannot have a JIRA_HOME environment variable set with spaces in it. This variable is being ignored" echo "--------------------------------------------------------------------------------------------------------------------" else - JIRA_HOME_MINUSD=-Djira.home=$JIRA_HOME + JIRA_HOME_MINUSD=-Djira.home="${JIRA_HOME}" fi fi -JAVA_OPTS="-Xms${JVM_MINIMUM_MEMORY} -Xmx${JVM_MAXIMUM_MEMORY} ${JAVA_OPTS} ${JVM_REQUIRED_ARGS} ${DISABLE_NOTIFICATIONS} ${JVM_SUPPORT_RECOMMENDED_ARGS} ${JVM_EXTRA_ARGS} ${JIRA_HOME_MINUSD}" +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}" # Perm Gen size needs to be increased if encountering OutOfMemoryError: PermGen problems. Specifying PermGen size is not valid on IBM JDKs JIRA_MAX_PERM_SIZE=${JVM_PERMGEN_MEMORY} -if [ -f "${PRGDIR}/permgen.sh" ]; then +if [[ -f "${PRGDIR}/permgen.sh" ]]; then echo "Detecting JVM PermGen support..." . "${PRGDIR}/permgen.sh" - if [ $JAVA_PERMGEN_SUPPORTED = "true" ]; then + if [[ "${JAVA_PERMGEN_SUPPORTED}" = "true" ]]; then echo "PermGen switch is supported. Setting to ${JIRA_MAX_PERM_SIZE}" JAVA_OPTS="-XX:MaxPermSize=${JIRA_MAX_PERM_SIZE} ${JAVA_OPTS}" else @@ -80,44 +124,46 @@ if [ -f "${PRGDIR}/permgen.sh" ]; then fi fi -export JAVA_OPTS CATALINA_OPTS +export JAVA_OPTS + +# DO NOT remove the following line +# !INSTALLER SET JAVA_HOME echo "" -echo "If you encounter issues starting or stopping JIRA, please see the Troubleshooting guide at http://confluence.atlassian.com/display/JIRA/Installation+Troubleshooting+Guide" +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" echo "" -if [ "$JIRA_HOME_MINUSD" != "" ]; then - echo "Using JIRA_HOME: $JIRA_HOME" +if [[ "${JIRA_HOME_MINUSD}" != "" ]]; then + echo "Using JIRA_HOME: ${JIRA_HOME}" fi # set the location of the pid file -if [ -z "$CATALINA_PID" ] ; then - if [ -n "$CATALINA_BASE" ] ; then - CATALINA_PID="$CATALINA_BASE"/work/catalina.pid - elif [ -n "$CATALINA_HOME" ] ; then - CATALINA_PID="$CATALINA_HOME"/work/catalina.pid +if [[ -z "${CATALINA_PID}" ]] ; then + if [[ -n "${CATALINA_HOME}" ]] ; then + CATALINA_PID="${CATALINA_HOME}/work/catalina.pid" + elif [[ -n "${CATALINA_HOME}" ]] ; then + CATALINA_PID="${CATALINA_HOME}/work/catalina.pid" fi fi export CATALINA_PID -if [ -z "$CATALINA_BASE" ]; then - if [ -z "$CATALINA_HOME" ]; then - LOGBASE=$PRGDIR +if [[ -z "${CATALINA_HOME}" ]]; then + if [[ -z "${CATALINA_HOME}" ]]; then + LOGBASE=${PRGDIR} LOGTAIL=.. else - LOGBASE=$CATALINA_HOME + LOGBASE=${CATALINA_HOME} LOGTAIL=. fi else - LOGBASE=$CATALINA_BASE + LOGBASE=${CATALINA_BASE} LOGTAIL=. fi -PUSHED_DIR=`pwd` -cd $LOGBASE -cd $LOGTAIL -LOGBASEABS=`pwd` -cd $PUSHED_DIR +PUSHED_DIR=$(pwd) +cd ${LOGBASE} +cd ${LOGTAIL} +LOGBASEABS=$(pwd) +cd ${PUSHED_DIR} echo "" -echo "Server startup logs are located in $LOGBASEABS/logs/catalina.out" - +echo "Server startup logs are located in ${LOGBASEABS}/logs/catalina.out" diff --git a/templates/user.sh.erb b/templates/user.sh.erb index aef6061f..400d1c7f 100755 --- a/templates/user.sh.erb +++ b/templates/user.sh.erb @@ -1,5 +1,5 @@ # START INSTALLER MAGIC ! DO NOT EDIT ! -JIRA_USER="<%= scope.lookupvar('jira::user') %>" # user created by puppet +JIRA_USER="<%= @user %>" # user created by puppet SHELL="/bin/bash" # # END INSTALLER MAGIC ! DO NOT EDIT !