Skip to content

Commit

Permalink
feat: add variables to setenv.sh to make it possible to change JVM …
Browse files Browse the repository at this point in the history
…arguments (#9)
  • Loading branch information
antmelekhin committed Dec 6, 2023
1 parent 9b31a21 commit d0434a5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ Role Variables
- `jira_username` and `jira_group` Unix username and group (default: `jira`).
- `jira_root_path` Path to Jira installation directory (default: `/opt/atlassian/jira`).
- `jira_home_path` Path to Jira home directory (default: `/var/atlassian/application-data/jira`).
- `jira_min_nofiles_limit` If the limit of files that Jira can open is too low, it will be set to this value (default: `16384`).
- `jira_jvm_support_recommends_args` Occasionally Atlassian Support may recommend that you set some specific JVM arguments (default: `null`).
- `jira_jvm_gc_args` You can use variable below to modify garbage collector settings (default: `-XX:+ExplicitGCInvokesConcurrent`).
- `jira_jvm_minimum_memory` and `jira_jvm_maximum_memory` The minimum and maximum size of the heap (default: `384m` and `2048m`).
- `jira_jvm_initial_code_cache_size` and `jira_jvm_reserved_code_cache_size` The size of JVM code cache (default: `32m` and `512m`). A high value of reserved size allows Jira to work with more installed apps.
- `jira_jvm_required_args` The following are the required arguments for Jira.
- `jira_db_configuration` DB connection configuration (default: `false`).
- `jira_db_address` IP address or DNS name of DB server.
- `jira_db_port` DB port.
Expand Down
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ jira_root_path: '/opt/atlassian/jira'
jira_home_path: '/var/atlassian/application-data/jira'

# Jira environment configuration.
jira_min_nofiles_limit: 16384
jira_jvm_support_recommends_args: ''
jira_jvm_gc_args: '-XX:+ExplicitGCInvokesConcurrent'
jira_jvm_minimum_memory: '384m'
jira_jvm_maximum_memory: '2048m'
jira_jvm_initial_code_cache_size: '32m'
jira_jvm_reserved_code_cache_size: '512m'
jira_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'

# Jira database connection settings.
jira_db_configuration: false
Expand Down
27 changes: 13 additions & 14 deletions templates/setenv.sh.j2
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
{{ ansible_managed | comment }}
#
# If the limit of files that Jira can open is too low, it will be set to this value.
#
MIN_NOFILES_LIMIT=16384
MIN_NOFILES_LIMIT={{ jira_min_nofiles_limit }}

#
# 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.
#
JIRA_HOME="{{ jira_home_path }}"
JIRA_HOME='{{ jira_home_path }}'

#
# Occasionally Atlassian Support may recommend that you set some specific JVM arguments. You can use this variable below to do that.
#
JVM_SUPPORT_RECOMMENDED_ARGS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
JVM_SUPPORT_RECOMMENDED_ARGS='{{ jira_jvm_support_recommends_args }}'

#
# 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
# 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_GC_ARGS="-XX:+ExplicitGCInvokesConcurrent"
JVM_GC_ARGS='{{ jira_jvm_gc_args }}'

#
# 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="{{ jira_jvm_minimum_memory }}"
JVM_MAXIMUM_MEMORY="{{ jira_jvm_maximum_memory }}"
JVM_MINIMUM_MEMORY='{{ jira_jvm_minimum_memory }}'
JVM_MAXIMUM_MEMORY='{{ jira_jvm_maximum_memory }}'

#
# The following setting configures the size of JVM code cache. A high value of reserved size allows Jira to work with more installed apps.
#
JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=32m -XX:ReservedCodeCacheSize=512m'
JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize={{ jira_jvm_initial_code_cache_size }} -XX:ReservedCodeCacheSize={{ jira_jvm_reserved_code_cache_size }}'

#
# 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 -Dorg.dom4j.factory=com.atlassian.core.xml.InterningDocumentFactory'
JVM_REQUIRED_ARGS='{{ jira_jvm_required_args }}'

# Uncomment this setting if you want to import data without notifications
#
Expand All @@ -53,7 +52,7 @@ JVM_REQUIRED_ARGS='-Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.ap
# 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:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT"
JVM_EXTRA_ARGS='-XX:-OmitStackTraceInFastThrow -Djava.locale.providers=COMPAT'

CURRENT_NOFILES_LIMIT=$( ulimit -Hn )
ulimit -Sn $CURRENT_NOFILES_LIMIT
Expand Down

0 comments on commit d0434a5

Please sign in to comment.