From 25c2ebb563960d28a5b1d9533d92058cbdc3507c Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 24 Aug 2020 13:05:42 +1000 Subject: [PATCH] DCD-1020: Add installation and linking of Google Noto fonts as JVM fallbacks. --- roles/confluence_config/defaults/main.yml | 4 ++++ .../molecule/default/tests/test_default.py | 11 ++++++++++- roles/confluence_config/tasks/amazon_fonts.yml | 15 +++++++++++++++ roles/confluence_config/tasks/main.yml | 10 ++++++++++ roles/confluence_config/tasks/ubuntu_fonts.yml | 15 +++++++++++++++ 5 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 roles/confluence_config/tasks/amazon_fonts.yml create mode 100644 roles/confluence_config/tasks/ubuntu_fonts.yml diff --git a/roles/confluence_config/defaults/main.yml b/roles/confluence_config/defaults/main.yml index 86502fc..4bd4d10 100644 --- a/roles/confluence_config/defaults/main.yml +++ b/roles/confluence_config/defaults/main.yml @@ -1,6 +1,10 @@ --- atl_jvm_heap: "2048m" +atl_fonts_fallback_dirs: + - "{{ atl_java_home }}/lib/fonts/fallback/" + - "{{ atl_jre_home }}/lib/fonts/fallback/" + atl_autologin_cookie_age: "{{ lookup('env', 'ATL_AUTOLOGIN_COOKIE_AGE') }}" diff --git a/roles/confluence_config/molecule/default/tests/test_default.py b/roles/confluence_config/molecule/default/tests/test_default.py index 39e69c5..d3ff80e 100644 --- a/roles/confluence_config/molecule/default/tests/test_default.py +++ b/roles/confluence_config/molecule/default/tests/test_default.py @@ -78,4 +78,13 @@ def test_confluence_config_file(host): assert f.contains('ec2.amazonaws.com') assert f.contains('jdbc:postgresql://postgres-db.ap-southeast-2.rds.amazonaws.com:5432/confluence') assert f.contains('molecule_password') - assert f.contains('select 1;') \ No newline at end of file + assert f.contains('select 1;') + +@pytest.mark.parametrize('font', [ +# '/usr/lib/jvm/java/lib/fonts/fallback/NotoSansJavanese-Regular.ttf', +# '/usr/lib/jvm/jre/lib/fonts/fallback/NotoSansJavanese-Regular.ttf' + '/opt/atlassian/confluence/current/jre/lib/fonts/fallback/NotoSansJavanese-Regular.ttf' +]) +def test_fonts_installed_and_linked(host, font): + f = host.file(font) + assert f.exists diff --git a/roles/confluence_config/tasks/amazon_fonts.yml b/roles/confluence_config/tasks/amazon_fonts.yml new file mode 100644 index 0000000..4fc5302 --- /dev/null +++ b/roles/confluence_config/tasks/amazon_fonts.yml @@ -0,0 +1,15 @@ +--- + +- name: Install Google Noto fonts for language coverage + yum: + name: + - "google-noto-*" + +- name: Link the language fonts into the JDK/JRE + # Not idiomatic, but cleaner that messing with nested lookups... + shell: + cmd: "ln -sf /usr/share/fonts/google-noto*/* {{ item }}/" + creates: "{{ item }}/NotoSansJavanese-Regular.ttf" + warn: false + with_items: "{{ atl_fonts_fallback_dirs }}" + changed_when: false # For Molecule idempotence check diff --git a/roles/confluence_config/tasks/main.yml b/roles/confluence_config/tasks/main.yml index d9c4af2..07b202c 100644 --- a/roles/confluence_config/tasks/main.yml +++ b/roles/confluence_config/tasks/main.yml @@ -125,3 +125,13 @@ tags: - skip_on_stack_update ignore_errors: yes # For Molecule as it has no db test framework included + +- name: Create JVM font fallback directories + file: + path: "{{ item }}" + state: directory + mode: 0755 + with_items: "{{ atl_fonts_fallback_dirs }}" + +- name: Install & configure distro language fonts + include_tasks: "{{ ansible_distribution|lower }}_fonts.yml" diff --git a/roles/confluence_config/tasks/ubuntu_fonts.yml b/roles/confluence_config/tasks/ubuntu_fonts.yml new file mode 100644 index 0000000..084aa3f --- /dev/null +++ b/roles/confluence_config/tasks/ubuntu_fonts.yml @@ -0,0 +1,15 @@ +--- + +- name: Install Google Noto fonts for language coverage + package: + name: + - "fonts-noto" + +- name: Link the language fonts into the JDK/JRE + # Not idiomatic, but cleaner that messing with nested lookups... + shell: + cmd: "ln -sf /usr/share/fonts/truetype/noto/* {{ item }}/" + creates: "{{ item }}/NotoSansJavanese-Regular.ttf" + warn: false + with_items: "{{ atl_fonts_fallback_dirs }}" + changed_when: false # For Molecule idempotence check