From edc980d70a843bc777e2fbcd4f4a356132388932 Mon Sep 17 00:00:00 2001 From: Dave Chevell Date: Sun, 16 Aug 2020 21:19:43 +1000 Subject: [PATCH 1/9] Don't write python bytecode --- entrypoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.py b/entrypoint.py index e0bfd40..cb55735 100755 --- a/entrypoint.py +++ b/entrypoint.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python3 -B from entrypoint_helpers import env, gen_cfg, str2bool, start_app From 359f56dd4d94501308afaea25f64c0e557157609 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Tue, 18 Aug 2020 11:06:26 +1000 Subject: [PATCH 2/9] DCD-1053: Add ability to specify the Lucene index directory. --- README.md | 5 +++++ config/confluence.cfg.xml.j2 | 2 ++ tests/test_image.py | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 60a4cbc..01dbb05 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,11 @@ Example: should be writable by the user `confluence`. See note below about UID mappings. +* `ATL_LUCENE_INDEX_DIR` + + The directory where [Lucene](https://lucene.apache.org/) search indexes should + be stored. Defaults to `index` under the Confluence home directory. + ## Database configuration It is optionally possible to configure the database from the environment, diff --git a/config/confluence.cfg.xml.j2 b/config/confluence.cfg.xml.j2 index 9b38128..c235f12 100644 --- a/config/confluence.cfg.xml.j2 +++ b/config/confluence.cfg.xml.j2 @@ -11,6 +11,8 @@ ${localHome}/temp ${confluenceHome}/attachments + {{ atl_lucene_index_dir | default('${confluenceHome}/index') }} + {% if atl_jdbc_url is defined %} {% set databases = { "mysql": ["com.mysql.jdbc.Driver", "MySQLDialect"], diff --git a/tests/test_image.py b/tests/test_image.py index 1d65ec1..8322b49 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -172,6 +172,15 @@ def test_confluence_xml_default(docker_cli, image): assert xml.findall('.//buildNumber')[0].text == "0" assert xml.findall('.//property[@name="hibernate.connection.url"]') == [] assert xml.findall('.//property[@name="confluence.cluster.home"]') == [] + assert xml.findall('.//property[@name="lucene.index.dir"]')[0].text == '${confluenceHome}/index' + + +def test_confluence_lucene_index(docker_cli, image): + container = run_image(docker_cli, image, environment={'ATL_LUCENE_INDEX_DIR': '/some/other/dir'}) + _jvm = wait_for_proc(container, get_bootstrap_proc(container)) + + xml = parse_xml(container, f'{get_app_home(container)}/confluence.cfg.xml') + assert xml.findall('.//property[@name="lucene.index.dir"]')[0].text == '/some/other/dir' def test_confluence_xml_postgres(docker_cli, image, run_user): From 49fde15797468f884f4c2d7ae86be80c714b27e4 Mon Sep 17 00:00:00 2001 From: Atlassian Docker Bot Date: Mon, 24 Aug 2020 03:52:42 +0000 Subject: [PATCH 3/9] Update shared components --- shared-components | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-components b/shared-components index bbfb0cf..e7d2687 160000 --- a/shared-components +++ b/shared-components @@ -1 +1 @@ -Subproject commit bbfb0cfaed3967383a2b15e30dd05a65842c8d3f +Subproject commit e7d26879d37c695adf2e7228dd414e060706f6bf From e6204bab7afe8a7b36a4e6702b985430806346f1 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 24 Aug 2020 13:24:52 +1000 Subject: [PATCH 4/9] DCD-1086: Add Google Noto fonts and install as JVM fallback for server-side rendering of non-Latin languages. --- Dockerfile | 7 +++++-- tests/test_image.py | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index de0ad57..be6698a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,7 @@ CMD ["/entrypoint.py"] ENTRYPOINT ["/sbin/tini", "--"] RUN apt-get update && apt-get upgrade -y \ - && apt-get install -y --no-install-recommends fontconfig python3 python3-jinja2 \ + && apt-get install -y --no-install-recommends fontconfig fonts-noto python3 python3-jinja2 \ && apt-get clean autoclean && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* ARG TINI_VERSION=v0.18.0 @@ -45,7 +45,10 @@ RUN groupadd --gid ${RUN_GID} ${RUN_GROUP} \ \ && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ - && sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh + && sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + \ + && mkdir -p /opt/java/openjdk/lib/fonts/fallback/ \ + && ln -sf /usr/share/fonts/truetype/noto/* /opt/java/openjdk/lib/fonts/fallback/ VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms diff --git a/tests/test_image.py b/tests/test_image.py index 8322b49..aec99c9 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -331,3 +331,12 @@ def test_jvm_support_recommended_args_order(docker_cli, image): procs_list = get_procs(container) jvm = [proc for proc in procs_list if get_bootstrap_proc(container) in proc][0] assert jvm.index(ENABLE_PRINTGCDETAILS) > jvm.index(DISABLE_PRINTGCDETAILS) + +def test_jvm_fallback_fonts(docker_cli, image): + container = run_image(docker_cli, image) + _jvm = wait_for_proc(container, get_bootstrap_proc(container)) + + init = container.file("/opt/java/openjdk/lib/fonts/fallback/NotoSansGujarati-Regular.ttf") + assert init.exists + assert init.is_symlink + assert init.linked_to == '/usr/share/fonts/truetype/noto/NotoSansGujarati-Regular.ttf' From 12bbe6b36e4c3d6f5f2f9360aff01dc4f22c6667 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 24 Aug 2020 13:55:25 +1000 Subject: [PATCH 5/9] DCD-1086: Add Noto fonts to Alpine too. --- Dockerfile-alpine | 7 +++++-- tests/test_image.py | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Dockerfile-alpine b/Dockerfile-alpine index 176b935..c427c4c 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -19,7 +19,7 @@ EXPOSE 8091 CMD ["/entrypoint.py"] ENTRYPOINT ["/sbin/tini", "--"] -RUN apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl ttf-dejavu tini python3 py3-jinja2 +RUN apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl ttf-dejavu font-noto tini python3 py3-jinja2 # Workaround for AdoptOpenJDK Alpine fontconfig bug RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so \ @@ -44,7 +44,10 @@ RUN addgroup -g ${RUN_GID} ${RUN_GROUP} \ \ && sed -i -e 's/-Xms\([0-9]\+[kmg]\) -Xmx\([0-9]\+[kmg]\)/-Xms\${JVM_MINIMUM_MEMORY:=\1} -Xmx\${JVM_MAXIMUM_MEMORY:=\2} -Dconfluence.home=\${CONFLUENCE_HOME}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ && sed -i -e 's/-XX:ReservedCodeCacheSize=\([0-9]\+[kmg]\)/-XX:ReservedCodeCacheSize=${JVM_RESERVED_CODE_CACHE_SIZE:=\1}/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ - && sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh + && sed -i -e 's/export CATALINA_OPTS/CATALINA_OPTS="\${CATALINA_OPTS} \${JVM_SUPPORT_RECOMMENDED_ARGS}"\n\nexport CATALINA_OPTS/g' ${CONFLUENCE_INSTALL_DIR}/bin/setenv.sh \ + \ + && mkdir -p /opt/java/openjdk/lib/fonts/fallback/ \ + && ln -sf /usr/share/fonts/noto/* /opt/java/openjdk/lib/fonts/fallback/ VOLUME ["${CONFLUENCE_HOME}"] # Must be declared after setting perms diff --git a/tests/test_image.py b/tests/test_image.py index aec99c9..367062c 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -336,7 +336,7 @@ def test_jvm_fallback_fonts(docker_cli, image): container = run_image(docker_cli, image) _jvm = wait_for_proc(container, get_bootstrap_proc(container)) - init = container.file("/opt/java/openjdk/lib/fonts/fallback/NotoSansGujarati-Regular.ttf") - assert init.exists - assert init.is_symlink - assert init.linked_to == '/usr/share/fonts/truetype/noto/NotoSansGujarati-Regular.ttf' + font = container.file("/opt/java/openjdk/lib/fonts/fallback/NotoSansGujarati-Regular.ttf") + assert font.exists + assert font.is_symlink + assert font.linked_to == '/usr/share/fonts/truetype/noto/NotoSansGujarati-Regular.ttf' From 2a44a5f82bab511492a1ba11965c8d4dc5b75fb5 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 24 Aug 2020 14:13:26 +1000 Subject: [PATCH 6/9] DCD-1086: See need to all the Noto sub-packages too. --- Dockerfile-alpine | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile-alpine b/Dockerfile-alpine index c427c4c..a3a4bdf 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -19,7 +19,8 @@ EXPOSE 8091 CMD ["/entrypoint.py"] ENTRYPOINT ["/sbin/tini", "--"] -RUN apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl ttf-dejavu font-noto tini python3 py3-jinja2 +RUN apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl tini python3 py3-jinja2 \ + ttf-dejavu `apk search -qe 'font-noto*'` # Workaround for AdoptOpenJDK Alpine fontconfig bug RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so \ From 8bed033516d6564628197a2545fe67099722faec Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Mon, 24 Aug 2020 15:05:23 +1000 Subject: [PATCH 7/9] DCD-1086: We need to fetch & clean the cache to get all the fonts. --- Dockerfile-alpine | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile-alpine b/Dockerfile-alpine index a3a4bdf..b994e29 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -19,8 +19,9 @@ EXPOSE 8091 CMD ["/entrypoint.py"] ENTRYPOINT ["/sbin/tini", "--"] -RUN apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl tini python3 py3-jinja2 \ - ttf-dejavu `apk search -qe 'font-noto*'` +RUN apk update \ + && apk add --no-cache ca-certificates wget curl openssh bash procps openssl perl tini python3 py3-jinja2 ttf-dejavu `apk search -qe 'font-noto*'` \ + && rm -f /var/cache/apk/APKINDEX* # Workaround for AdoptOpenJDK Alpine fontconfig bug RUN ln -s /usr/lib/libfontconfig.so.1 /usr/lib/libfontconfig.so \ From 49890f0225aa9237cd83961bdbd17211e5628441 Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Tue, 25 Aug 2020 08:56:20 +1000 Subject: [PATCH 8/9] DCD-1086: Don't check link location as it's platform-specific. --- tests/test_image.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_image.py b/tests/test_image.py index 367062c..2b4c423 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -339,4 +339,3 @@ def test_jvm_fallback_fonts(docker_cli, image): font = container.file("/opt/java/openjdk/lib/fonts/fallback/NotoSansGujarati-Regular.ttf") assert font.exists assert font.is_symlink - assert font.linked_to == '/usr/share/fonts/truetype/noto/NotoSansGujarati-Regular.ttf' From 29289ac63ef30df17107cf0ab6e3d4a7235439fe Mon Sep 17 00:00:00 2001 From: Steve Smith Date: Tue, 25 Aug 2020 10:44:55 +1000 Subject: [PATCH 9/9] DCD-1086: Try timeoutincrease. --- tests/test_image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_image.py b/tests/test_image.py index 2b4c423..52b0abe 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -40,7 +40,7 @@ def test_first_run_state(docker_cli, image, run_user): container = run_image(docker_cli, image, user=run_user, ports={PORT: PORT}) - wait_for_http_response(URL, expected_status=200, expected_state=('STARTING', 'FIRST_RUN')) + wait_for_http_response(URL, expected_status=200, expected_state=('STARTING', 'FIRST_RUN'), max_wait=120) def test_server_xml_defaults(docker_cli, image):