DCD-545: Add seraph-config.xml configuration.

This commit is contained in:
Steve Smith 2019-08-08 10:48:07 +10:00
parent e079baa776
commit 3a29822bb9
4 changed files with 37 additions and 15 deletions

View File

@ -41,7 +41,7 @@ If you need to override Confluence Server's default memory allocation, you can c
The maximum heap size of the JVM
## Reverse Proxy Settings
## Tomcat and Reverse Proxy Settings
If Confluence is run behind a reverse proxy server (e.g. a load-balancer or
nginx server), then you need to specify extra options to make Confluence aware
@ -90,6 +90,12 @@ see https://tomcat.apache.org/tomcat-7.0-doc/config/index.html.
* `ATL_TOMCAT_PROTOCOL` (default: HTTP/1.1)
* `ATL_TOMCAT_ACCEPTCOUNT` (default: 10)
## Confluence-specific settings
* `ATL_AUTOLOGIN_COOKIE_AGE` (default: 1209600; two weeks, in seconds)
The maximum time a user can remain logged-in with 'Remember Me'.
## JVM configuration
If you need to pass additional JVM arguments to Confluence such as specifying a custom trust store, you can add them via the below environment variable

View File

@ -42,6 +42,16 @@ log "Generating ${CONFLUENCE_INSTALL_DIR}/conf/server.xml"
/opt/atlassian/etc/server.xml.j2 \
> ${CONFLUENCE_INSTALL_DIR}/conf/server.xml
######################################################################
# Configure login properties
# The default is two weeks, in seconds, same as the seraph default.
export atl_autologin_cookie_age=${ATL_AUTOLOGIN_COOKIE_AGE:=1209600}
log "Generating ${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/classes/seraph-config.xml"
/opt/atlassian/bin/templater.sh \
/opt/atlassian/etc/seraph-config.xml.j2 \
> ${CONFLUENCE_INSTALL_DIR}/confluence/WEB-INF/classes/seraph-config.xml
# Start Confluence as the correct user

View File

@ -18,3 +18,4 @@ wcwidth==0.1.7
websocket-client==0.56.0
zipp==0.5.2
testinfra==3.0.6
lxml==4.4.0

View File

@ -4,7 +4,7 @@ import io
import tarfile
import testinfra
import time
import xml.etree.ElementTree as etree
from lxml import etree
import requests
@ -15,19 +15,6 @@ def run_image(docker_cli, image, environment={}, ports={}):
container = docker_cli.containers.run(image, environment=environment, ports=ports, detach=True)
return testinfra.get_host("docker://"+container.id)
# Helper function to get a file-like object from an image
def get_fileobj_from_container(container, filepath):
time.sleep(0.5) # Give container a moment if just started
stream, stat = container.get_archive(filepath)
f = io.BytesIO()
for chunk in stream:
f.write(chunk)
f.seek(0)
with tarfile.open(fileobj=f, mode='r') as tar:
filename = tar.getmembers()[0].name
file = tar.extractfile(filename)
return file
# TestInfra's process command doesn't seem to work for arg matching
def get_procs(container):
ps = container.run('ps -axo args')
@ -150,6 +137,24 @@ def test_server_xml_params(docker_cli, image):
assert context.get('path') == environment.get('ATL_TOMCAT_CONTEXTPATH')
def test_seraph_defaults(docker_cli, image):
container = run_image(docker_cli, image)
_jvm = wait_for_proc(container, "org.apache.catalina.startup.Bootstrap")
xml = etree.fromstring(container.file('/opt/atlassian/confluence/confluence/WEB-INF/classes/seraph-config.xml').content)
param = xml.xpath('//param-name[text()="autologin.cookie.age"]')[0].getnext()
assert param.text == "1209600"
def test_seraph_login_set(docker_cli, image):
container = run_image(docker_cli, image, environment={"ATL_AUTOLOGIN_COOKIE_AGE": "TEST_VAL"})
_jvm = wait_for_proc(container, "org.apache.catalina.startup.Bootstrap")
xml = etree.fromstring(container.file('/opt/atlassian/confluence/confluence/WEB-INF/classes/seraph-config.xml').content)
param = xml.xpath('//param-name[text()="autologin.cookie.age"]')[0].getnext()
assert param.text == "TEST_VAL"
#
# def test_confluence_cfg_xml_defaults(docker_cli, image):
# environment = {