mirror of
https://bitbucket.org/atlassian-docker/docker-atlassian-confluence-server.git
synced 2024-08-30 18:22:16 +00:00
DCD-545: Add generation of server.xml.
This commit is contained in:
parent
4c01753833
commit
e079baa776
47
README.md
47
README.md
@ -43,27 +43,52 @@ If you need to override Confluence Server's default memory allocation, you can c
|
||||
|
||||
## Reverse Proxy Settings
|
||||
|
||||
If Confluence is run behind a reverse proxy server, then you need to specify extra options to make Confluence aware of the setup. They can be controlled via the below environment variables.
|
||||
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
|
||||
of the setup. They can be controlled via the below environment variables.
|
||||
|
||||
* `CATALINA_CONNECTOR_PROXYNAME` (default: NONE)
|
||||
* `ATL_PROXY_NAME` (default: NONE)
|
||||
|
||||
The reverse proxy's fully qualified hostname.
|
||||
The reverse proxy's fully qualified hostname. `CATALINA_CONNECTOR_PROXYNAME`
|
||||
is also supported for backwards compatability.
|
||||
|
||||
* `CATALINA_CONNECTOR_PROXYPORT` (default: NONE)
|
||||
* `ATL_PROXY_PORT` (default: NONE)
|
||||
|
||||
The reverse proxy's port number via which Confluence is accessed.
|
||||
The reverse proxy's port number via which Jira is
|
||||
accessed. `CATALINA_CONNECTOR_PROXYPORT` is also supported for backwards
|
||||
compatability.
|
||||
|
||||
* `CATALINA_CONNECTOR_SCHEME` (default: http)
|
||||
* `ATL_TOMCAT_PORT` (default: 8090)
|
||||
|
||||
The protocol via which Confluence is accessed.
|
||||
The port for Tomcat/Jira to listen on. Depending on your container
|
||||
deployment method this port may need to be
|
||||
[exposed and published][docker-expose].
|
||||
|
||||
* `CATALINA_CONNECTOR_SECURE` (default: false)
|
||||
* `ATL_TOMCAT_SCHEME` (default: http)
|
||||
|
||||
Set 'true' if CATALINA_CONNECTOR_SCHEME is 'https'.
|
||||
The protocol via which Jira is accessed. `CATALINA_CONNECTOR_SCHEME` is also
|
||||
supported for backwards compatability.
|
||||
|
||||
* `CATALINA_CONTEXT_PATH` (default: NONE)
|
||||
* `ATL_TOMCAT_SECURE` (default: false)
|
||||
|
||||
The context path the application is served over.
|
||||
Set 'true' if `ATL_TOMCAT_SCHEME` is 'https'. `CATALINA_CONNECTOR_SECURE` is
|
||||
also supported for backwards compatability.
|
||||
|
||||
* `ATL_TOMCAT_CONTEXTPATH` (default: NONE)
|
||||
|
||||
The context path the application is served over. `CATALINA_CONTEXT_PATH` is
|
||||
also supported for backwards compatability.
|
||||
|
||||
The following Tomcat/Catalina options are also supported. For more information,
|
||||
see https://tomcat.apache.org/tomcat-7.0-doc/config/index.html.
|
||||
|
||||
* `ATL_TOMCAT_MGMT_PORT` (default: 8000)
|
||||
* `ATL_TOMCAT_MAXTHREADS` (default: 200)
|
||||
* `ATL_TOMCAT_MINSPARETHREADS` (default: 10)
|
||||
* `ATL_TOMCAT_CONNECTIONTIMEOUT` (default: 20000)
|
||||
* `ATL_TOMCAT_ENABLELOOKUPS` (default: false)
|
||||
* `ATL_TOMCAT_PROTOCOL` (default: HTTP/1.1)
|
||||
* `ATL_TOMCAT_ACCEPTCOUNT` (default: 10)
|
||||
|
||||
## JVM configuration
|
||||
|
||||
|
@ -1,7 +1,16 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Setup Catalina Opts
|
||||
function log {
|
||||
echo '[Entrypoint]' $*
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# Generate server.xml for Tomcat. We lower-case these vars to be
|
||||
# compatible with the Ansible templates in
|
||||
# https://bitbucket.org/atlassian/dc-deployments-automation
|
||||
|
||||
# Previous names for parameters, preserved for backwards compatability
|
||||
: ${CATALINA_CONNECTOR_PROXYNAME:=}
|
||||
: ${CATALINA_CONNECTOR_PROXYPORT:=}
|
||||
: ${CATALINA_CONNECTOR_SCHEME:=http}
|
||||
@ -9,15 +18,31 @@ set -euo pipefail
|
||||
: ${CATALINA_CONTEXT_PATH:=}
|
||||
|
||||
: ${CATALINA_OPTS:=}
|
||||
|
||||
CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorProxyName=${CATALINA_CONNECTOR_PROXYNAME}"
|
||||
CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorProxyPort=${CATALINA_CONNECTOR_PROXYPORT}"
|
||||
CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorScheme=${CATALINA_CONNECTOR_SCHEME}"
|
||||
CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaConnectorSecure=${CATALINA_CONNECTOR_SECURE}"
|
||||
CATALINA_OPTS="${CATALINA_OPTS} -DcatalinaContextPath=${CATALINA_CONTEXT_PATH}"
|
||||
|
||||
export CATALINA_OPTS
|
||||
|
||||
# Use new var name, or previous var name, or default...
|
||||
export atl_proxy_name=${ATL_PROXY_NAME:=$CATALINA_CONNECTOR_PROXYNAME}
|
||||
export atl_proxy_port=${ATL_PROXY_PORT:=$CATALINA_CONNECTOR_PROXYPORT}
|
||||
export atl_tomcat_secure=${ATL_TOMCAT_SECURE:=$CATALINA_CONNECTOR_SECURE}
|
||||
export atl_tomcat_scheme=${ATL_TOMCAT_SCHEME:=$CATALINA_CONNECTOR_SCHEME}
|
||||
export atl_tomcat_contextpath=${ATL_TOMCAT_CONTEXTPATH:=$CATALINA_CONTEXT_PATH}
|
||||
|
||||
export atl_tomcat_port=${ATL_TOMCAT_PORT:=8090}
|
||||
export atl_tomcat_mgmt_port=${ATL_TOMCAT_MGMT_PORT:=8000}
|
||||
export atl_tomcat_maxthreads=${ATL_TOMCAT_MAXTHREADS:=200}
|
||||
export atl_tomcat_minsparethreads=${ATL_TOMCAT_MINSPARETHREADS:=10}
|
||||
export atl_tomcat_connectiontimeout=${ATL_TOMCAT_CONNECTIONTIMEOUT:=20000}
|
||||
export atl_tomcat_enablelookups=${ATL_TOMCAT_ENABLELOOKUPS:=false}
|
||||
export atl_tomcat_protocol=${ATL_TOMCAT_PROTOCOL:=HTTP/1.1}
|
||||
export atl_tomcat_redirectport=${ATL_TOMCAT_REDIRECTPORT:=8443}
|
||||
export atl_tomcat_acceptcount=${ATL_TOMCAT_ACCEPTCOUNT:=10}
|
||||
|
||||
log "Generating ${CONFLUENCE_INSTALL_DIR}/conf/server.xml"
|
||||
/opt/atlassian/bin/templater.sh \
|
||||
/opt/atlassian/etc/server.xml.j2 \
|
||||
> ${CONFLUENCE_INSTALL_DIR}/conf/server.xml
|
||||
|
||||
|
||||
|
||||
# Start Confluence as the correct user
|
||||
if [ "${UID}" -eq 0 ]; then
|
||||
|
@ -91,66 +91,65 @@ def test_first_run_state(docker_cli, image):
|
||||
raise TimeoutError
|
||||
|
||||
|
||||
def test_server_xml_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/conf/server.xml').content)
|
||||
connector = xml.find('.//Connector')
|
||||
context = xml.find('.//Context')
|
||||
|
||||
assert connector.get('port') == '8090'
|
||||
assert connector.get('maxThreads') == '200'
|
||||
assert connector.get('minSpareThreads') == '10'
|
||||
assert connector.get('connectionTimeout') == '20000'
|
||||
assert connector.get('enableLookups') == 'false'
|
||||
assert connector.get('protocol') == 'HTTP/1.1'
|
||||
assert connector.get('acceptCount') == '10'
|
||||
assert connector.get('secure') == 'false'
|
||||
assert connector.get('scheme') == 'http'
|
||||
assert connector.get('proxyName') == ''
|
||||
assert connector.get('proxyPort') == ''
|
||||
|
||||
def test_server_xml_params(docker_cli, image):
|
||||
environment = {
|
||||
'ATL_TOMCAT_MGMT_PORT': '8006',
|
||||
'ATL_TOMCAT_PORT': '9090',
|
||||
'ATL_TOMCAT_MAXTHREADS': '201',
|
||||
'ATL_TOMCAT_MINSPARETHREADS': '11',
|
||||
'ATL_TOMCAT_CONNECTIONTIMEOUT': '20001',
|
||||
'ATL_TOMCAT_ENABLELOOKUPS': 'true',
|
||||
'ATL_TOMCAT_PROTOCOL': 'HTTP/2',
|
||||
'ATL_TOMCAT_ACCEPTCOUNT': '11',
|
||||
'ATL_TOMCAT_SECURE': 'true',
|
||||
'ATL_TOMCAT_SCHEME': 'https',
|
||||
'ATL_PROXY_NAME': 'jira.atlassian.com',
|
||||
'ATL_PROXY_PORT': '443',
|
||||
'ATL_TOMCAT_CONTEXTPATH': '/myjira',
|
||||
}
|
||||
container = run_image(docker_cli, image, environment=environment)
|
||||
_jvm = wait_for_proc(container, "org.apache.catalina.startup.Bootstrap")
|
||||
|
||||
xml = etree.fromstring(container.file('/opt/atlassian/confluence/conf/server.xml').content)
|
||||
connector = xml.find('.//Connector')
|
||||
context = xml.find('.//Context')
|
||||
|
||||
assert xml.get('port') == environment.get('ATL_TOMCAT_MGMT_PORT')
|
||||
|
||||
assert connector.get('port') == environment.get('ATL_TOMCAT_PORT')
|
||||
assert connector.get('maxThreads') == environment.get('ATL_TOMCAT_MAXTHREADS')
|
||||
assert connector.get('minSpareThreads') == environment.get('ATL_TOMCAT_MINSPARETHREADS')
|
||||
assert connector.get('connectionTimeout') == environment.get('ATL_TOMCAT_CONNECTIONTIMEOUT')
|
||||
assert connector.get('enableLookups') == environment.get('ATL_TOMCAT_ENABLELOOKUPS')
|
||||
assert connector.get('protocol') == environment.get('ATL_TOMCAT_PROTOCOL')
|
||||
assert connector.get('acceptCount') == environment.get('ATL_TOMCAT_ACCEPTCOUNT')
|
||||
assert connector.get('secure') == environment.get('ATL_TOMCAT_SECURE')
|
||||
assert connector.get('scheme') == environment.get('ATL_TOMCAT_SCHEME')
|
||||
assert connector.get('proxyName') == environment.get('ATL_PROXY_NAME')
|
||||
assert connector.get('proxyPort') == environment.get('ATL_PROXY_PORT')
|
||||
|
||||
assert context.get('path') == environment.get('ATL_TOMCAT_CONTEXTPATH')
|
||||
|
||||
# def test_server_xml_defaults(docker_cli, image):
|
||||
# container = docker_cli.containers.run(image, detach=True)
|
||||
# server_xml = get_fileobj_from_container(container, '/opt/atlassian/jira/conf/server.xml')
|
||||
# xml = etree.parse(server_xml)
|
||||
# connector = xml.find('.//Connector')
|
||||
# context = xml.find('.//Context')
|
||||
#
|
||||
# assert connector.get('port') == '8090'
|
||||
# assert connector.get('maxThreads') == '200'
|
||||
# assert connector.get('minSpareThreads') == '10'
|
||||
# assert connector.get('connectionTimeout') == '20000'
|
||||
# assert connector.get('enableLookups') == 'false'
|
||||
# assert connector.get('protocol') == 'HTTP/1.1'
|
||||
# assert connector.get('acceptCount') == '10'
|
||||
# assert connector.get('secure') == 'false'
|
||||
# assert connector.get('scheme') == 'http'
|
||||
# assert connector.get('proxyName') == ''
|
||||
# assert connector.get('proxyPort') == ''
|
||||
#
|
||||
#
|
||||
# def test_server_xml_params(docker_cli, image):
|
||||
# environment = {
|
||||
# 'ATL_TOMCAT_MGMT_PORT': '8006',
|
||||
# 'ATL_TOMCAT_PORT': '9090',
|
||||
# 'ATL_TOMCAT_MAXTHREADS': '201',
|
||||
# 'ATL_TOMCAT_MINSPARETHREADS': '11',
|
||||
# 'ATL_TOMCAT_CONNECTIONTIMEOUT': '20001',
|
||||
# 'ATL_TOMCAT_ENABLELOOKUPS': 'true',
|
||||
# 'ATL_TOMCAT_PROTOCOL': 'HTTP/2',
|
||||
# 'ATL_TOMCAT_ACCEPTCOUNT': '11',
|
||||
# 'ATL_TOMCAT_SECURE': 'true',
|
||||
# 'ATL_TOMCAT_SCHEME': 'https',
|
||||
# 'ATL_PROXY_NAME': 'jira.atlassian.com',
|
||||
# 'ATL_PROXY_PORT': '443',
|
||||
# 'ATL_TOMCAT_CONTEXTPATH': '/myjira',
|
||||
# }
|
||||
# container = docker_cli.containers.run(image, environment=environment, detach=True)
|
||||
# server_xml = get_fileobj_from_container(container, '/opt/atlassian/jira/conf/server.xml')
|
||||
# xml = etree.parse(server_xml)
|
||||
# server = xml.getroot()
|
||||
# connector = xml.find('.//Connector')
|
||||
# context = xml.find('.//Context')
|
||||
#
|
||||
# assert server.get('port') == environment.get('ATL_TOMCAT_MGMT_PORT')
|
||||
#
|
||||
# assert connector.get('port') == environment.get('ATL_TOMCAT_PORT')
|
||||
# assert connector.get('maxThreads') == environment.get('ATL_TOMCAT_MAXTHREADS')
|
||||
# assert connector.get('minSpareThreads') == environment.get('ATL_TOMCAT_MINSPARETHREADS')
|
||||
# assert connector.get('connectionTimeout') == environment.get('ATL_TOMCAT_CONNECTIONTIMEOUT')
|
||||
# assert connector.get('enableLookups') == environment.get('ATL_TOMCAT_ENABLELOOKUPS')
|
||||
# assert connector.get('protocol') == environment.get('ATL_TOMCAT_PROTOCOL')
|
||||
# assert connector.get('acceptCount') == environment.get('ATL_TOMCAT_ACCEPTCOUNT')
|
||||
# assert connector.get('secure') == environment.get('ATL_TOMCAT_SECURE')
|
||||
# assert connector.get('scheme') == environment.get('ATL_TOMCAT_SCHEME')
|
||||
# assert connector.get('proxyName') == environment.get('ATL_PROXY_NAME')
|
||||
# assert connector.get('proxyPort') == environment.get('ATL_PROXY_PORT')
|
||||
#
|
||||
# assert context.get('path') == environment.get('ATL_TOMCAT_CONTEXTPATH')
|
||||
#
|
||||
#
|
||||
# def test_confluence_cfg_xml_defaults(docker_cli, image):
|
||||
# environment = {
|
||||
|
Loading…
Reference in New Issue
Block a user