Merged in keigelis/docker-atlassian-confluence-server/add_confluence_caccess_log (pull request #59)

Add confluence caccess log
This commit is contained in:
Karolis Eigelis 2020-02-28 03:17:24 +00:00 committed by Steve Smith
commit 6aea6a1cb4
2 changed files with 19 additions and 4 deletions

View File

@ -50,6 +50,10 @@
<Manager pathname=""/> <Manager pathname=""/>
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve"
threshold="60"/> threshold="60"/>
{% if atl_tomcat_access_log == 'true' %}
<Valve className="org.apache.catalina.valves.AccessLogValve" requestAttributesEnabled="true" directory="logs" prefix="confluence_access" suffix=".log" rotatable="true" pattern="%h %{X-AUSERNAME}o %t &quot;%r&quot; %s %b %D %U %I &quot;%{User-Agent}i&quot;" />
<Valve className="org.apache.catalina.valves.RemoteIpValve" proxiesHeader="x-forwarded-by" internalProxies="{{ atl_tomcat_proxy_internal_ips | default('') }}" remoteIpHeader="x-forwarded-for" protocolHeader="x-forwarded-proto" requestAttributesEnabled="true" resolveHosts="false" />
{% endif %}
</Context> </Context>
<Context path="${confluence.context.path}/synchrony-proxy" <Context path="${confluence.context.path}/synchrony-proxy"

View File

@ -50,7 +50,7 @@ def test_server_xml_defaults(docker_cli, image):
xml = parse_xml(container, f'{get_app_install_dir(container)}/conf/server.xml') xml = parse_xml(container, f'{get_app_install_dir(container)}/conf/server.xml')
connector = xml.find('.//Connector') connector = xml.find('.//Connector')
context = xml.find('.//Context') context = xml.find('.//Context')
assert connector.get('port') == '8090' assert connector.get('port') == '8090'
assert connector.get('maxThreads') == '100' assert connector.get('maxThreads') == '100'
assert connector.get('minSpareThreads') == '10' assert connector.get('minSpareThreads') == '10'
@ -62,8 +62,7 @@ def test_server_xml_defaults(docker_cli, image):
assert connector.get('scheme') == 'http' assert connector.get('scheme') == 'http'
assert connector.get('proxyName') == '' assert connector.get('proxyName') == ''
assert connector.get('proxyPort') == '' assert connector.get('proxyPort') == ''
def test_server_xml_catalina_fallback(docker_cli, image): def test_server_xml_catalina_fallback(docker_cli, image):
environment = { environment = {
'CATALINA_CONNECTOR_PROXYNAME': 'PROXYNAME', 'CATALINA_CONNECTOR_PROXYNAME': 'PROXYNAME',
@ -108,7 +107,7 @@ def test_server_xml_params(docker_cli, image):
xml = parse_xml(container, f'{get_app_install_dir(container)}/conf/server.xml') xml = parse_xml(container, f'{get_app_install_dir(container)}/conf/server.xml')
connector = xml.find('.//Connector') connector = xml.find('.//Connector')
context = xml.find('.//Context') context = xml.find('.//Context')
assert xml.get('port') == environment.get('ATL_TOMCAT_MGMT_PORT') assert xml.get('port') == environment.get('ATL_TOMCAT_MGMT_PORT')
assert connector.get('port') == environment.get('ATL_TOMCAT_PORT') assert connector.get('port') == environment.get('ATL_TOMCAT_PORT')
@ -282,6 +281,18 @@ def test_confluence_xml_cluster_tcp(docker_cli, image, run_user):
assert xml.findall('.//property[@name="confluence.cluster.name"]')[0].text == "atl_cluster_name" assert xml.findall('.//property[@name="confluence.cluster.name"]')[0].text == "atl_cluster_name"
assert xml.findall('.//property[@name="confluence.cluster.peers"]')[0].text == "1.1.1.1,99.99.99.99" assert xml.findall('.//property[@name="confluence.cluster.peers"]')[0].text == "1.1.1.1,99.99.99.99"
def test_confluence_xml_access_log(docker_cli, image, run_user):
environment = {
'ATL_TOMCAT_ACCESS_LOG': 'true',
'ATL_TOMCAT_PROXY_INTERNAL_IPS': '192.168.1.1',
}
container = run_image(docker_cli, image, user=run_user, environment=environment)
_jvm = wait_for_proc(container, get_bootstrap_proc(container))
xml = parse_xml(container, f'{get_app_home(container)}/server.cfg.xml')
valve = xml.find(".//Context/Valve[@className='org.apache.catalina.valves.RemoteIpValve']")
assert valve.get('internalProxies') == environment.get('ATL_TOMCAT_PROXY_INTERNAL_IPS')
def test_java_in_run_user_path(docker_cli, image): def test_java_in_run_user_path(docker_cli, image):
RUN_USER = 'confluence' RUN_USER = 'confluence'