mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 08:23:06 -06:00
Merged in DCD-1020-non-ascii-fonts (pull request #112)
DCD-1020: Add Google Noto fonts and install as JVM fallback for server-side rendering of non-Latin languages Approved-by: Ben Partridge
This commit is contained in:
@@ -18,7 +18,7 @@ pipelines:
|
||||
- step:
|
||||
name: Pre Parallelization stage
|
||||
script:
|
||||
- echo "Running tests in 37 batches"
|
||||
- echo "Running tests in 38 batches"
|
||||
- step:
|
||||
name: Check if number of batches match actual number of scenarios
|
||||
script:
|
||||
@@ -327,4 +327,12 @@ pipelines:
|
||||
- apt-get update && ./bin/install-ansible --dev
|
||||
- ./bin/run-tests-in-batches --batch 37
|
||||
|
||||
- step:
|
||||
name: Molecule Test Batch - 38
|
||||
services:
|
||||
- docker
|
||||
script:
|
||||
- apt-get update && ./bin/install-ansible --dev
|
||||
- ./bin/run-tests-in-batches --batch 38
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#
|
||||
# https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html
|
||||
|
||||
java_version: "1.8.0"
|
||||
java_major_version: "8"
|
||||
postgres_version: "9.6"
|
||||
git_version: "2.14.4"
|
||||
atl_shared_mountpoint: "/media/atl"
|
||||
@@ -34,6 +34,14 @@ atl_product_installation_versioned: "{{ atl_product_installation_base }}/{{ atl_
|
||||
atl_product_installation_current: "{{ atl_product_installation_base }}/current"
|
||||
atl_installer_temp: "{{ atl_installation_base }}/tmp"
|
||||
|
||||
# NOTE: If using the non-installer java we expect to have the full JDK
|
||||
# installed and linked to `/usr/lib/jvm/java` and # `/usr/lib/jvm/jre`.
|
||||
# See product_common/task/ubuntu.yml for an example of apropriate
|
||||
# linking using `alternatives`.
|
||||
atl_java_home: "{{ '/usr/lib/jvm/java' if atl_use_system_jdk else (atl_product_installation_current + '/jre') }}"
|
||||
atl_jre_home: "{{ '/usr/lib/jvm/jre' if atl_use_system_jdk else atl_java_home }}"
|
||||
atl_java_binary: "{{ atl_jre_home }}/bin/java"
|
||||
|
||||
atl_product_logs_default: &logs_default
|
||||
- path: "{{ atl_product_installation_current }}/logs/*"
|
||||
type: product
|
||||
|
||||
@@ -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') }}"
|
||||
|
||||
|
||||
@@ -78,4 +78,13 @@ def test_confluence_config_file(host):
|
||||
assert f.contains('<property name="confluence.cluster.aws.host.header">ec2.amazonaws.com</property>')
|
||||
assert f.contains('<property name="hibernate.connection.url">jdbc:postgresql://postgres-db.ap-southeast-2.rds.amazonaws.com:5432/confluence</property>')
|
||||
assert f.contains('<property name="hibernate.connection.password">molecule_password</property>')
|
||||
assert f.contains('<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>')
|
||||
assert f.contains('<property name="hibernate.c3p0.preferredTestQuery">select 1;</property>')
|
||||
|
||||
@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
|
||||
|
||||
14
roles/confluence_config/molecule/system_jdk/Dockerfile.j2
Normal file
14
roles/confluence_config/molecule/system_jdk/Dockerfile.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
# Molecule managed
|
||||
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
|
||||
32
roles/confluence_config/molecule/system_jdk/molecule.yml
Normal file
32
roles/confluence_config/molecule/system_jdk/molecule.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
lint:
|
||||
name: yamllint
|
||||
platforms:
|
||||
- name: amazon_linux2
|
||||
image: amazonlinux:2
|
||||
groups:
|
||||
- aws_node_local
|
||||
- name: ubuntu_lts
|
||||
image: ubuntu:bionic
|
||||
groups:
|
||||
- aws_node_local
|
||||
provisioner:
|
||||
name: ansible
|
||||
options:
|
||||
skip-tags: runtime_pkg
|
||||
lint:
|
||||
name: ansible-lint
|
||||
options:
|
||||
x: ["701"]
|
||||
inventory:
|
||||
links:
|
||||
group_vars: ../../../../group_vars/
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
||||
enabled: false
|
||||
30
roles/confluence_config/molecule/system_jdk/playbook.yml
Normal file
30
roles/confluence_config/molecule/system_jdk/playbook.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
atl_product_family: "confluence"
|
||||
atl_product_edition: "confluence"
|
||||
atl_product_user: "confluence"
|
||||
atl_product_version: "latest"
|
||||
atl_db_engine: "postgres"
|
||||
atl_db_host: "postgres-db.ap-southeast-2.rds.amazonaws.com"
|
||||
atl_jdbc_db_name: "confluence"
|
||||
atl_jdbc_user: 'confluence'
|
||||
atl_jdbc_password: 'molecule_password'
|
||||
atl_jvm_heap: 'PLACEHOLDER'
|
||||
atl_cluster_node_id: 'FAKEID'
|
||||
atl_autologin_cookie_age: "COOKIEAGE"
|
||||
atl_local_ipv4: "1.1.1.1"
|
||||
atl_tomcat_scheme: "http"
|
||||
atl_proxy_name: "localhost"
|
||||
atl_proxy_port: "80"
|
||||
atl_db_preferredtestquery: "select 1;"
|
||||
atl_use_system_jdk: true
|
||||
atl_download_format: "tarball"
|
||||
|
||||
roles:
|
||||
- role: linux_common
|
||||
- role: product_common
|
||||
- role: product_install
|
||||
- role: confluence_common
|
||||
- role: confluence_config
|
||||
@@ -0,0 +1,20 @@
|
||||
import os
|
||||
import pytest
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
||||
def test_seraph_file(host):
|
||||
f = host.file('/opt/atlassian/confluence/current/confluence/WEB-INF/classes/seraph-config.xml')
|
||||
assert f.exists
|
||||
assert f.contains('<param-value>COOKIEAGE</param-value>')
|
||||
|
||||
@pytest.mark.parametrize('font', [
|
||||
'/usr/lib/jvm/java/lib/fonts/fallback/NotoSansJavanese-Regular.ttf',
|
||||
'/usr/lib/jvm/jre/lib/fonts/fallback/NotoSansJavanese-Regular.ttf'
|
||||
])
|
||||
def test_fonts_installed_and_linked(host, font):
|
||||
f = host.file(font)
|
||||
assert f.exists
|
||||
15
roles/confluence_config/tasks/amazon_fonts.yml
Normal file
15
roles/confluence_config/tasks/amazon_fonts.yml
Normal file
@@ -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
|
||||
@@ -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"
|
||||
|
||||
15
roles/confluence_config/tasks/ubuntu_fonts.yml
Normal file
15
roles/confluence_config/tasks/ubuntu_fonts.yml
Normal file
@@ -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
|
||||
@@ -51,7 +51,7 @@
|
||||
lineinfile:
|
||||
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
|
||||
insertafter: "EOF"
|
||||
line: 'export JAVA_HOME=/usr/lib/jvm/jre-{{ java_version }}-openjdk'
|
||||
line: "export JAVA_HOME={{ atl_java_home }}"
|
||||
|
||||
- name: Create application directories
|
||||
file:
|
||||
@@ -152,4 +152,4 @@
|
||||
- name: Remove crowd.xml to prevent duplicates from appearing in cluster reporting
|
||||
file:
|
||||
path: "{{ atl_product_installation_versioned }}/apache-tomcat/conf/Catalina/localhost/crowd.xml"
|
||||
state: absent
|
||||
state: absent
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
---
|
||||
java_version: "1.8.0"
|
||||
java_major_version: "8"
|
||||
postgres_version: "9.6"
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@ def test_user_created(host):
|
||||
|
||||
@pytest.mark.parametrize('exe', [
|
||||
'/usr/bin/git',
|
||||
'/usr/bin/javac'
|
||||
'/usr/bin/javac',
|
||||
'/usr/lib/jvm/java/bin/java',
|
||||
'/usr/lib/jvm/java/jre/bin/java'
|
||||
])
|
||||
def test_package_exes(host, exe):
|
||||
assert host.file(exe).exists
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
- name: Install JDK if necessary on Amazon Linux
|
||||
yum:
|
||||
name:
|
||||
- java-{{ java_version }}-openjdk-devel
|
||||
- java-1.{{ java_major_version }}.0-openjdk-devel
|
||||
when: atl_use_system_jdk
|
||||
|
||||
- name: Install other base packages on Amazon Linux
|
||||
|
||||
@@ -1,9 +1,27 @@
|
||||
---
|
||||
|
||||
- name: Install JDK if necessary on Ubuntu
|
||||
package:
|
||||
name:
|
||||
- openjdk-{{ java_major_version }}-jdk-headless
|
||||
block:
|
||||
|
||||
- name: Install JDK package
|
||||
package:
|
||||
name:
|
||||
- openjdk-{{ java_major_version }}-jdk-headless
|
||||
|
||||
- name: Ensure common JDK symlink exists
|
||||
alternatives:
|
||||
link: "/usr/lib/jvm/java"
|
||||
name: "java_sdk"
|
||||
path: "/usr/lib/jvm/java-8-openjdk-amd64"
|
||||
priority: 99
|
||||
|
||||
- name: Ensure common JRE symlink exists
|
||||
alternatives:
|
||||
link: "/usr/lib/jvm/jre"
|
||||
name: "jre"
|
||||
path: "/usr/lib/jvm/java-8-openjdk-amd64/jre"
|
||||
priority: 99
|
||||
|
||||
when: atl_use_system_jdk
|
||||
tags:
|
||||
- runtime_pkg
|
||||
|
||||
@@ -3,6 +3,5 @@
|
||||
# FIXME: Add others as map?
|
||||
atl_synchrony_cluster_type: "aws"
|
||||
|
||||
atl_synchrony_java_binary: "{{ 'java' if atl_use_system_jdk else (atl_product_installation_current + '/jre/bin/java') }}"
|
||||
atl_synchrony_memory: "{{ lookup('env', 'ATL_SYNCHRONY_MEMORY') or '-Xmx2g' }}"
|
||||
atl_synchrony_stack_space: "{{ lookup('env', 'ATL_SYNCHRONY_STACK_SPACE') or '-Xss2048k' }}"
|
||||
|
||||
@@ -7,7 +7,7 @@ ATL_CONFLUENCE_SHARED_CONFIG_FILE="{{ atl_product_home_shared }}/confluence.cfg.
|
||||
ATL_SYNCHRONY_JAR_PATH="{{ atl_product_installation_current }}/confluence/WEB-INF/packages/synchrony-standalone.jar"
|
||||
|
||||
AWS_EC2_PRIVATE_IP="{{ atl_local_ipv4 }}"
|
||||
_RUNJAVA="{{ atl_synchrony_java_binary }}"
|
||||
_RUNJAVA="{{ atl_java_binary }}"
|
||||
|
||||
SYNCHRONY_DATABASE_USERNAME="{{ atl_jdbc_user }}"
|
||||
SYNCHRONY_DATABASE_PASSWORD="{{ atl_jdbc_password }}"
|
||||
|
||||
Reference in New Issue
Block a user