diff --git a/roles/product_install/tasks/main.yml b/roles/product_install/tasks/main.yml index 712173c..73c7e7b 100644 --- a/roles/product_install/tasks/main.yml +++ b/roles/product_install/tasks/main.yml @@ -265,6 +265,16 @@ state: link force: true +- 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 include_tasks: "jira-servicedesk_as_obr.yml" when: atl_install_jsd_as_obr diff --git a/roles/product_startup/molecule/default/tests/test_default.py b/roles/product_startup/molecule/default/tests/test_default.py index d3b1994..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$") + 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 0e748f5..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$") + 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 a99636a..ce2dff8 100644 --- a/roles/product_startup/templates/product.service.j2 +++ b/roles/product_startup/templates/product.service.j2 @@ -5,12 +5,15 @@ 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 %} +{# 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