From 1e0c97597be0e59c3a0ec98cd6d48e52bdf5f880 Mon Sep 17 00:00:00 2001 From: Adam Brokes Date: Tue, 5 Oct 2021 13:23:23 +1100 Subject: [PATCH] DCD-1362: Add tcpKeepAlive and socketTimeout for Jira dbconfig.xml --- roles/jira_config/defaults/main.yml | 5 +++++ roles/jira_config/molecule/default/tests/test_default.py | 2 ++ roles/jira_config/molecule/jira_config_props/converge.yml | 2 ++ .../molecule/jira_config_props/tests/test_default.py | 2 ++ roles/jira_config/templates/dbconfig.xml.j2 | 3 +++ 5 files changed, 14 insertions(+) diff --git a/roles/jira_config/defaults/main.yml b/roles/jira_config/defaults/main.yml index 0a90817..5aab24b 100644 --- a/roles/jira_config/defaults/main.yml +++ b/roles/jira_config/defaults/main.yml @@ -22,6 +22,11 @@ atl_tomcat_redirectport: "" atl_tomcat_scheme: "http" atl_tomcat_secure: "false" +# Mitigation of potentially stuck threads with certain network setup while using PostgreSQL +# https://confluence.atlassian.com/jirakb/connection-problems-to-postgresql-result-in-stuck-threads-in-jira-1047534091.html +atl_db_keepalive: 'true' +atl_db_sockettimeout: '240' + atl_db_poolminsize: '20' atl_db_poolmaxsize: '100' atl_db_minidle: '10' diff --git a/roles/jira_config/molecule/default/tests/test_default.py b/roles/jira_config/molecule/default/tests/test_default.py index 77508f0..4ec770c 100644 --- a/roles/jira_config/molecule/default/tests/test_default.py +++ b/roles/jira_config/molecule/default/tests/test_default.py @@ -15,6 +15,8 @@ def test_dbconfig_file(host): assert f.contains("atljira") assert f.contains("molecule_password") + assert f.contains("tcpKeepAlive=true;socketTimeout=240") + assert f.contains("1111") assert f.contains("1111") assert f.contains("1111") diff --git a/roles/jira_config/molecule/jira_config_props/converge.yml b/roles/jira_config/molecule/jira_config_props/converge.yml index 9ef9fa9..7e86b81 100644 --- a/roles/jira_config/molecule/jira_config_props/converge.yml +++ b/roles/jira_config/molecule/jira_config_props/converge.yml @@ -13,6 +13,8 @@ atl_jvm_heap: 'PLACEHOLDER' atl_jvm_opts: 'PLACEHOLDER' atl_cluster_node_id: 'FAKEID' + atl_db_keepalive: 'false' + atl_db_sockettimeout: '111' atl_db_poolminsize: 1111 atl_db_poolmaxsize: 1111 atl_db_minidle: 1111 diff --git a/roles/jira_config/molecule/jira_config_props/tests/test_default.py b/roles/jira_config/molecule/jira_config_props/tests/test_default.py index 70329f1..6351261 100644 --- a/roles/jira_config/molecule/jira_config_props/tests/test_default.py +++ b/roles/jira_config/molecule/jira_config_props/tests/test_default.py @@ -15,6 +15,8 @@ def test_dbconfig_file(host): assert f.contains("atljira") assert f.contains("molecule_password") + assert f.contains("tcpKeepAlive=false;socketTimeout=111") + assert f.contains("1111") assert f.contains("1111") assert f.contains("1111") diff --git a/roles/jira_config/templates/dbconfig.xml.j2 b/roles/jira_config/templates/dbconfig.xml.j2 index 992a3f6..c2b92c4 100644 --- a/roles/jira_config/templates/dbconfig.xml.j2 +++ b/roles/jira_config/templates/dbconfig.xml.j2 @@ -10,6 +10,9 @@ {{ atl_jdbc_user }} {{ atl_jdbc_password | replace("&", "&") }} {{ atl_db_driver }} + {% if 'postgres' in atl_db_type %} + tcpKeepAlive={{ atl_db_keepalive }};socketTimeout={{ atl_db_sockettimeout }} + {% endif %} {{ atl_db_poolminsize }} {{ atl_db_poolmaxsize }}