From e03ef9b56435707c6e72e82bec21e307f21b974d Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Tue, 29 Dec 2020 13:49:12 +1100 Subject: [PATCH 01/10] ITPLAT-387 ensure service unit file defaults write to catalina.out --- roles/product_startup/templates/product.service.j2 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/roles/product_startup/templates/product.service.j2 b/roles/product_startup/templates/product.service.j2 index a99636a..2d1235d 100644 --- a/roles/product_startup/templates/product.service.j2 +++ b/roles/product_startup/templates/product.service.j2 @@ -5,12 +5,14 @@ After=network-online.target [Service] User={{ atl_product_user }} Group={{ atl_product_user }} +StandardOutput=journal+console +StandardError=journal+console {% for p in atl_startup_systemd_params -%} {{ p }} {% endfor %} -ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %} +ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %} >{{ atl_product_installation_current }}/logs/catalina.out 2>{{ atl_product_installation_current }}/logs/catalina.err Restart=on-failure From 75c905fe7d54285e02fe06f6cd9480090815d57f Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Tue, 29 Dec 2020 21:10:47 +1100 Subject: [PATCH 02/10] ITPLAT-387 ensure service log dir exists --- roles/product_startup/tasks/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/roles/product_startup/tasks/main.yml b/roles/product_startup/tasks/main.yml index 99a40e4..23713e0 100644 --- a/roles/product_startup/tasks/main.yml +++ b/roles/product_startup/tasks/main.yml @@ -1,4 +1,12 @@ --- +- name: "Ensure startup log dir exists" + file: + path: "{{ atl_product_installation_current }}/logs" + state: directory + mode: 0750 + owner: "{{ atl_product_user }}" + group: "{{ atl_product_user }}" + changed_when: false # For Molecule idempotence check - name: "Install systemd service file" template: From d270cb75cbd1ad29893336979d8d2674148573bd Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Thu, 31 Dec 2020 12:20:09 +1100 Subject: [PATCH 03/10] ITPLAT-387 move logdir creation to somewhere that doesnt break tests and mod the service test --- roles/product_install/tasks/main.yml | 1 + .../molecule/default/tests/test_default.py | 2 +- roles/product_startup/tasks/main.yml | 9 --------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/roles/product_install/tasks/main.yml b/roles/product_install/tasks/main.yml index e2773c1..f48858b 100644 --- a/roles/product_install/tasks/main.yml +++ b/roles/product_install/tasks/main.yml @@ -132,6 +132,7 @@ - "{{ atl_product_installation_versioned }}" - "{{ atl_product_version_cache_dir }}" - "{{ atl_product_home_shared_download_dir }}" + - "{{ atl_product_installation_current }}/logs" changed_when: false # For Molecule idempotence check # At this point atl_product_version should be set, cache if necessary. diff --git a/roles/product_startup/molecule/default/tests/test_default.py b/roles/product_startup/molecule/default/tests/test_default.py index d3b1994..aadbb03 100644 --- a/roles/product_startup/molecule/default/tests/test_default.py +++ b/roles/product_startup/molecule/default/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/jira-software.service') - assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg$") + assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg >/opt/atlassian/jira-software/current/logs/catalina.out 2>/opt/atlassian/jira-software/current/logs/catalina.err$") assert f.user == 'root' assert f.group == 'root' assert f.mode == 0o0640 diff --git a/roles/product_startup/tasks/main.yml b/roles/product_startup/tasks/main.yml index 23713e0..a5b59e1 100644 --- a/roles/product_startup/tasks/main.yml +++ b/roles/product_startup/tasks/main.yml @@ -1,13 +1,4 @@ --- -- name: "Ensure startup log dir exists" - file: - path: "{{ atl_product_installation_current }}/logs" - state: directory - mode: 0750 - owner: "{{ atl_product_user }}" - group: "{{ atl_product_user }}" - changed_when: false # For Molecule idempotence check - - name: "Install systemd service file" template: src: "product.service.j2" From c2f18294f4abef39b0f4d1cdc3d062510f7a10a3 Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Thu, 31 Dec 2020 13:09:42 +1100 Subject: [PATCH 04/10] ITPLAT-387 let create logdir from the versioned path --- roles/product_install/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/product_install/tasks/main.yml b/roles/product_install/tasks/main.yml index f48858b..9d5bd07 100644 --- a/roles/product_install/tasks/main.yml +++ b/roles/product_install/tasks/main.yml @@ -132,7 +132,7 @@ - "{{ atl_product_installation_versioned }}" - "{{ atl_product_version_cache_dir }}" - "{{ atl_product_home_shared_download_dir }}" - - "{{ atl_product_installation_current }}/logs" + - "{{ atl_product_installation_versioned }}/logs" changed_when: false # For Molecule idempotence check # At this point atl_product_version should be set, cache if necessary. From 83da0b07dcf827a4cb030728c0f2b487f634240e Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Thu, 31 Dec 2020 13:56:33 +1100 Subject: [PATCH 05/10] ITPLAT-387 moving the logdir creation to after the install has completed --- roles/product_install/tasks/main.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/roles/product_install/tasks/main.yml b/roles/product_install/tasks/main.yml index 9d5bd07..6051fdc 100644 --- a/roles/product_install/tasks/main.yml +++ b/roles/product_install/tasks/main.yml @@ -132,7 +132,6 @@ - "{{ atl_product_installation_versioned }}" - "{{ atl_product_version_cache_dir }}" - "{{ atl_product_home_shared_download_dir }}" - - "{{ atl_product_installation_versioned }}/logs" changed_when: false # For Molecule idempotence check # At this point atl_product_version should be set, cache if necessary. @@ -266,6 +265,15 @@ state: link force: true +- name: "Ensure catalina.out log dir exists after product is installed" + file: + path: "{{ atl_product_installation_current }}/logs" + state: directory + mode: 0750 + owner: "{{ atl_product_user }}" + group: "{{ atl_product_user }}" + changed_when: false # For Molecule idempotence check + - name: Include if jsd is requested to be installed from OBR include_tasks: "jira-servicedesk_as_obr.yml" when: From 25ec58381e1faa4504dae8969b2ec6f3e4ff877e Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Thu, 31 Dec 2020 14:34:29 +1100 Subject: [PATCH 06/10] ITPLAT-387 fixed the bitbucket and synchrony tests --- roles/product_startup/molecule/bitbucket/tests/test_default.py | 2 +- roles/product_startup/molecule/synchrony/tests/test_default.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/product_startup/molecule/bitbucket/tests/test_default.py b/roles/product_startup/molecule/bitbucket/tests/test_default.py index c895f75..a8b6cf6 100644 --- a/roles/product_startup/molecule/bitbucket/tests/test_default.py +++ b/roles/product_startup/molecule/bitbucket/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/bitbucket.service') - assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search$") + assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search >/opt/atlassian/bitbucket/current/logs/catalina.out 2>/opt/atlassian/bitbucket/current/logs/catalina.err$") assert f.contains("^UMask=0027$") assert f.contains("^LimitNOFILE=4096$") assert f.contains("^Environment=BITBUCKET_HOME=/media/atl/bitbucket$") diff --git a/roles/product_startup/molecule/synchrony/tests/test_default.py b/roles/product_startup/molecule/synchrony/tests/test_default.py index 0e748f5..f6217d6 100644 --- a/roles/product_startup/molecule/synchrony/tests/test_default.py +++ b/roles/product_startup/molecule/synchrony/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/synchrony.service') - assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony$") + assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony >/opt/atlassian/confluence/current/logs/catalina.out 2>/opt/atlassian/confluence/current/logs/catalina.err$") assert f.contains("^EnvironmentFile=/etc/atl$") assert f.contains("^EnvironmentFile=/etc/atl.synchrony$") assert f.contains("^WorkingDirectory=/opt/atlassian/confluence/current/logs/$") From d219dea4ba2621abcf8c55ca54bf6533e151fa0d Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Mon, 4 Jan 2021 08:41:28 +1100 Subject: [PATCH 07/10] ITPLAT-387 restored accidentally trimmed blank line --- roles/product_startup/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/product_startup/tasks/main.yml b/roles/product_startup/tasks/main.yml index a5b59e1..99a40e4 100644 --- a/roles/product_startup/tasks/main.yml +++ b/roles/product_startup/tasks/main.yml @@ -1,4 +1,5 @@ --- + - name: "Install systemd service file" template: src: "product.service.j2" From f3e3853cbdd27f6384b54b892d8923f2ef327b0d Mon Sep 17 00:00:00 2001 From: Denise Unterwurzacher Date: Mon, 4 Jan 2021 16:57:42 -0600 Subject: [PATCH 08/10] ITPLAT-387 catalina.err isn't a standard log file - standard Tomcat logging directs both stdout and stderr to catalina.out. See https://tomcat.apache.org/tomcat-8.0-doc/logging.html --- roles/product_startup/molecule/bitbucket/tests/test_default.py | 2 +- roles/product_startup/molecule/default/tests/test_default.py | 2 +- roles/product_startup/molecule/synchrony/tests/test_default.py | 2 +- roles/product_startup/templates/product.service.j2 | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/roles/product_startup/molecule/bitbucket/tests/test_default.py b/roles/product_startup/molecule/bitbucket/tests/test_default.py index a8b6cf6..9b87f78 100644 --- a/roles/product_startup/molecule/bitbucket/tests/test_default.py +++ b/roles/product_startup/molecule/bitbucket/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/bitbucket.service') - assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search >/opt/atlassian/bitbucket/current/logs/catalina.out 2>/opt/atlassian/bitbucket/current/logs/catalina.err$") + assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search >/opt/atlassian/bitbucket/current/logs/catalina.out 2>&1$") assert f.contains("^UMask=0027$") assert f.contains("^LimitNOFILE=4096$") assert f.contains("^Environment=BITBUCKET_HOME=/media/atl/bitbucket$") diff --git a/roles/product_startup/molecule/default/tests/test_default.py b/roles/product_startup/molecule/default/tests/test_default.py index aadbb03..da1819b 100644 --- a/roles/product_startup/molecule/default/tests/test_default.py +++ b/roles/product_startup/molecule/default/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/jira-software.service') - assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg >/opt/atlassian/jira-software/current/logs/catalina.out 2>/opt/atlassian/jira-software/current/logs/catalina.err$") + assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg >/opt/atlassian/jira-software/current/logs/catalina.out 2>&1$") assert f.user == 'root' assert f.group == 'root' assert f.mode == 0o0640 diff --git a/roles/product_startup/molecule/synchrony/tests/test_default.py b/roles/product_startup/molecule/synchrony/tests/test_default.py index f6217d6..52a98fb 100644 --- a/roles/product_startup/molecule/synchrony/tests/test_default.py +++ b/roles/product_startup/molecule/synchrony/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/synchrony.service') - assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony >/opt/atlassian/confluence/current/logs/catalina.out 2>/opt/atlassian/confluence/current/logs/catalina.err$") + assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony >/opt/atlassian/confluence/current/logs/catalina.out 2>&1$") assert f.contains("^EnvironmentFile=/etc/atl$") assert f.contains("^EnvironmentFile=/etc/atl.synchrony$") assert f.contains("^WorkingDirectory=/opt/atlassian/confluence/current/logs/$") diff --git a/roles/product_startup/templates/product.service.j2 b/roles/product_startup/templates/product.service.j2 index 2d1235d..53deb26 100644 --- a/roles/product_startup/templates/product.service.j2 +++ b/roles/product_startup/templates/product.service.j2 @@ -12,7 +12,7 @@ StandardError=journal+console {{ p }} {% endfor %} -ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %} >{{ atl_product_installation_current }}/logs/catalina.out 2>{{ atl_product_installation_current }}/logs/catalina.err +ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %} >{{ atl_product_installation_current }}/logs/catalina.out 2>&1 Restart=on-failure From d3e6ba137c2ba44736e7f140e5df2c6c3eea8840 Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Tue, 2 Feb 2021 10:14:22 +1100 Subject: [PATCH 09/10] ITPLAT-387 exclude bitbucket from catalina.out fix --- roles/product_install/tasks/main.yml | 3 ++- roles/product_startup/molecule/bitbucket/tests/test_default.py | 2 +- roles/product_startup/molecule/default/tests/test_default.py | 2 +- roles/product_startup/molecule/synchrony/tests/test_default.py | 2 +- roles/product_startup/templates/product.service.j2 | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/roles/product_install/tasks/main.yml b/roles/product_install/tasks/main.yml index 6051fdc..1e2fb65 100644 --- a/roles/product_install/tasks/main.yml +++ b/roles/product_install/tasks/main.yml @@ -265,13 +265,14 @@ state: link force: true -- name: "Ensure catalina.out log dir exists after product is installed" +- name: "Ensure catalina.out log dir exists after product is installed (except bitbucket)" file: path: "{{ atl_product_installation_current }}/logs" state: directory mode: 0750 owner: "{{ atl_product_user }}" group: "{{ atl_product_user }}" + when: atl_product_family != "stash" changed_when: false # For Molecule idempotence check - name: Include if jsd is requested to be installed from OBR diff --git a/roles/product_startup/molecule/bitbucket/tests/test_default.py b/roles/product_startup/molecule/bitbucket/tests/test_default.py index a8b6cf6..c895f75 100644 --- a/roles/product_startup/molecule/bitbucket/tests/test_default.py +++ b/roles/product_startup/molecule/bitbucket/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/bitbucket.service') - assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search >/opt/atlassian/bitbucket/current/logs/catalina.out 2>/opt/atlassian/bitbucket/current/logs/catalina.err$") + assert f.contains("^ExecStart=/opt/atlassian/bitbucket/current/bin/start-bitbucket.sh -fg --no-search$") assert f.contains("^UMask=0027$") assert f.contains("^LimitNOFILE=4096$") assert f.contains("^Environment=BITBUCKET_HOME=/media/atl/bitbucket$") diff --git a/roles/product_startup/molecule/default/tests/test_default.py b/roles/product_startup/molecule/default/tests/test_default.py index aadbb03..da1819b 100644 --- a/roles/product_startup/molecule/default/tests/test_default.py +++ b/roles/product_startup/molecule/default/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/jira-software.service') - assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg >/opt/atlassian/jira-software/current/logs/catalina.out 2>/opt/atlassian/jira-software/current/logs/catalina.err$") + assert f.contains("^ExecStart=/opt/atlassian/jira-software/current/bin/start-jira.sh -fg >/opt/atlassian/jira-software/current/logs/catalina.out 2>&1$") assert f.user == 'root' assert f.group == 'root' assert f.mode == 0o0640 diff --git a/roles/product_startup/molecule/synchrony/tests/test_default.py b/roles/product_startup/molecule/synchrony/tests/test_default.py index f6217d6..52a98fb 100644 --- a/roles/product_startup/molecule/synchrony/tests/test_default.py +++ b/roles/product_startup/molecule/synchrony/tests/test_default.py @@ -9,7 +9,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_service_file(host): systemd_prefix = "/lib" if host.system_info.distribution == "ubuntu" else "/usr/lib" f = host.file(systemd_prefix+'/systemd/system/synchrony.service') - assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony >/opt/atlassian/confluence/current/logs/catalina.out 2>/opt/atlassian/confluence/current/logs/catalina.err$") + assert f.contains("^ExecStart=/opt/atlassian/bin/start-synchrony >/opt/atlassian/confluence/current/logs/catalina.out 2>&1$") assert f.contains("^EnvironmentFile=/etc/atl$") assert f.contains("^EnvironmentFile=/etc/atl.synchrony$") assert f.contains("^WorkingDirectory=/opt/atlassian/confluence/current/logs/$") diff --git a/roles/product_startup/templates/product.service.j2 b/roles/product_startup/templates/product.service.j2 index 2d1235d..fd1e620 100644 --- a/roles/product_startup/templates/product.service.j2 +++ b/roles/product_startup/templates/product.service.j2 @@ -12,7 +12,7 @@ StandardError=journal+console {{ p }} {% endfor %} -ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %} >{{ atl_product_installation_current }}/logs/catalina.out 2>{{ atl_product_installation_current }}/logs/catalina.err +ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %}{% if (atl_product_family != "stash") %} >{{ atl_product_installation_current }}/logs/catalina.out 2>&1{% endif %} Restart=on-failure From 362bc07ac61bf637401507af3463a6cbc6fc73d5 Mon Sep 17 00:00:00 2001 From: Brett Meehan Date: Thu, 4 Feb 2021 16:29:53 +1100 Subject: [PATCH 10/10] ITPLAT-387 add comment about bbdc exclusion --- roles/product_startup/templates/product.service.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/product_startup/templates/product.service.j2 b/roles/product_startup/templates/product.service.j2 index ead13f1..ce2dff8 100644 --- a/roles/product_startup/templates/product.service.j2 +++ b/roles/product_startup/templates/product.service.j2 @@ -12,6 +12,7 @@ StandardError=journal+console {{ p }} {% endfor %} +{# Bitbucket DC sets up its service start/stop logging in a different way to all our other DC offerings and so we exclude it from having the catalina.out redirect #} ExecStart={{ atl_startup_exec_path }}{% for c in atl_startup_exec_options %} {{ c }}{% endfor %}{% if (atl_product_family != "stash") %} >{{ atl_product_installation_current }}/logs/catalina.out 2>&1{% endif %} Restart=on-failure