diff --git a/group_vars/all.yml b/group_vars/all.yml index 2177239..34de359 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -45,5 +45,5 @@ atl_jdbc_ctype: "{{ lookup('env', 'ATL_JDBC_CTYPE') or 'en_US.UTF-8' }}" atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}" atl_jdbc_url: "jdbc:postgresql://{{ atl_db_host }}:{{ atl_db_port }}/{{ atl_jdbc_db_name }}" -atl_jvm_heap: "{{ lookup('env', 'ATL_JVM_HEAP) }}" -atl_catalina_opts: "{{ lookup('env', 'ATL_CATALINA_OPTS) }}" +atl_jvm_heap: "{{ lookup('env', 'ATL_JVM_HEAP) or '2048m' }}" +atl_catalina_opts: "{{ lookup('env', 'ATL_CATALINA_OPTS) or '' }}" diff --git a/roles/jira_config/molecule/default/playbook.yml b/roles/jira_config/molecule/default/playbook.yml index 0b419ea..2637d7b 100644 --- a/roles/jira_config/molecule/default/playbook.yml +++ b/roles/jira_config/molecule/default/playbook.yml @@ -7,6 +7,7 @@ atl_product_user: "jira" atl_product_version: "7.13.2" atl_jdbc_user: 'atljira' + atl_jvm_heap: 'PLACEHOLDER' roles: - role: linux_common - role: product_common diff --git a/roles/jira_config/molecule/default/tests/test_default.py b/roles/jira_config/molecule/default/tests/test_default.py index 92ecfb1..885cdfa 100644 --- a/roles/jira_config/molecule/default/tests/test_default.py +++ b/roles/jira_config/molecule/default/tests/test_default.py @@ -6,10 +6,16 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') -def test_hosts_file(host): +def test_dbconfig_file(host): f = host.file('/var/atlassian/application-data/jira/dbconfig.xml') assert f.exists assert f.user == 'jira' assert f.contains("org.postgresql.Driver") assert f.contains("atljira") assert f.contains("20") + +def test_setenv_file(host): + f = host.file('/opt/atlassian/jira-software/current/bin/setenv.sh') + assert f.exists + assert f.contains('JVM_MINIMUM_MEMORY="PLACEHOLDER"') + assert f.contains('JVM_MAXIMUM_MEMORY="PLACEHOLDER"') diff --git a/roles/jira_config/tasks/main.yml b/roles/jira_config/tasks/main.yml index 9a17ccd..d7a56c6 100644 --- a/roles/jira_config/tasks/main.yml +++ b/roles/jira_config/tasks/main.yml @@ -5,3 +5,14 @@ src: dbconfig.xml.j2 dest: "{{ atl_product_home }}/dbconfig.xml" owner: "{{ atl_product_user }}" + +- name: Override JVM memory settings. + # Ugly but necessary as the product installs this file so we need to make the change here. + lineinfile: + path: "{{ atl_product_installation_target }}/bin/setenv.sh" + backrefs: true + regexp: "^{{ item }}=" + line: "{{ item }}=\"{{ atl_jvm_heap }}\"" + with_items: + - 'JVM_MINIMUM_MEMORY' + - 'JVM_MAXIMUM_MEMORY'