DCD-558: Add generation of confluence.cfg.xml, with DB setup.

This commit is contained in:
Steve Smith 2019-08-13 09:03:57 +10:00
parent a6c7607bff
commit 442a29e9ea
7 changed files with 59 additions and 61 deletions

View File

@ -1,16 +0,0 @@
<!-- Start confluence.cfg.cluster.xml.j2 -->
<property name="confluence.cluster">true</property>
<property name="shared-home">{{ atl_product_home_shared }}</property>
<property name="confluence.cluster.home">{{ atl_product_home_shared }}</property>
<property name="confluence.cluster.aws.iam.role">{{ atl_hazelcast_network_aws_iam_role }}</property>
<property name="confluence.cluster.aws.region">{{ atl_hazelcast_network_aws_iam_region }}</property>
<property name="confluence.cluster.aws.host.header">{{ atl_hazelcast_network_aws_host_header }}</property>
<property name="confluence.cluster.aws.tag.key">{{ atl_hazelcast_network_aws_tag_key }}</property>
<property name="confluence.cluster.aws.tag.value">{{ atl_hazelcast_network_aws_tag_value }}</property>
<property name="confluence.cluster.join.type">aws</property>
<property name="confluence.cluster.name">{{ atl_aws_stack_name }}</property>
<property name="confluence.cluster.ttl">1</property>
<!-- End confluence.cfg.cluster.xml.j2 -->

View File

@ -1,19 +0,0 @@
<!-- Start confluence.cfg.db.xml.j2 -->
<property name="confluence.database.choice">{{ atl_db_choice }}</property>
<property name="hibernate.dialect">{{ atl_db_dialect }}</property>
<property name="hibernate.connection.driver_class">{{ atl_db_driver }}</property>
<property name="hibernate.connection.url">{{ atl_jdbc_url }}</property>
<property name="hibernate.connection.username">{{ atl_jdbc_user }}</property>
<property name="hibernate.connection.password">{{ atl_jdbc_password }}</property>
<property name="hibernate.c3p0.min_size">{{ atl_db_poolminsize }}</property>
<property name="hibernate.c3p0.max_size">{{ atl_db_poolmaxsize }}</property>
<property name="hibernate.c3p0.timeout">{{ atl_db_timeout }}</property>
<property name="hibernate.c3p0.idle_test_period">{{ atl_db_idletestperiod }}</property>
<property name="hibernate.c3p0.max_statements">{{ atl_db_maxstatements }}</property>
<property name="hibernate.c3p0.validate">{{ atl_db_validate }}</property>
<property name="hibernate.c3p0.acquire_increment">{{ atl_db_acquireincrement }}</property>
<property name="hibernate.c3p0.preferredTestQuery">{{ atl_db_validationquery }}</property>
<!-- End confluence.cfg.db.xml.j2 -->

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Start confluence.cfg.head.xml.j2 -->
<confluence-configuration>
<setupStep>setupstart</setupStep>
<setupType>custom</setupType>
<buildNumber>0</buildNumber>
<properties>
<property name="confluence.database.connection.type">database-type-standard</property>
<property name="webwork.multipart.saveDir">${localHome}/temp</property>
<property name="attachments.dir">${confluenceHome}/attachments</property>
<!-- End confluence.cfg.head.xml.j2 -->

View File

@ -1,7 +0,0 @@
<!-- Start confluence.cfg.tail.xml.j2 -->
</properties>
</confluence-configuration>
<!-- End confluence.cfg.tail.xml.j2 -->

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<confluence-configuration>
<setupStep>setupstart</setupStep>
<setupType>custom</setupType>
<buildNumber>0</buildNumber>
<properties>
<property name="confluence.database.connection.type">database-type-standard</property>
<property name="webwork.multipart.saveDir">${localHome}/temp</property>
<property name="attachments.dir">${confluenceHome}/attachments</property>
{% if atl_jdbc_url is defined %}
{% set databases = {
"mysql": ["com.mysql.jdbc.Driver", "MySQLDialect"],
"postgresql": ["org.postgresql.Driver", "PostgreSQLDialect"],
"mssql": ["com.microsoft.sqlserver.jdbc.SQLServerDriver", "SQLServerDialect"],
"oracle12c": ["oracle.jdbc.driver.OracleDriver", "OracleDialect"]
} %}
<property name="confluence.database.choice">{{ atl_db_type }}</property>
<property name="hibernate.connection.url">{{ atl_jdbc_url }}</property>
<property name="hibernate.connection.username">{{ atl_jdbc_user }}</property>
<property name="hibernate.connection.password">{{ atl_jdbc_password }}</property>
<property name="hibernate.connection.driver_class">{{ databases[atl_db_type][0] }}</property>
<property name="hibernate.dialect">com.atlassian.confluence.impl.hibernate.dialect.{{ databases[atl_db_type][1] }}</property>
<property name="hibernate.c3p0.min_size">{{ atl_db_poolminsize | default('20') }}</property>
<property name="hibernate.c3p0.max_size">{{ atl_db_poolmaxsize | default('100') }}</property>
<property name="hibernate.c3p0.timeout">{{ atl_db_timeout | default('30') }}</property>
<property name="hibernate.c3p0.idle_test_period">{{ atl_db_idletestperiod | default('100') }}</property>
<property name="hibernate.c3p0.max_statements">{{ atl_db_maxstatements | default('0') }}</property>
<property name="hibernate.c3p0.validate">{{ atl_db_validate | default('false') }}</property>
<property name="hibernate.c3p0.acquire_increment">{{ atl_db_acquireincrement | default('1') }}</property>
<property name="hibernate.c3p0.preferredTestQuery">{{ atl_db_validationquery | default('select 1') }}</property>
{% endif %}
{# <property name="shared-home">{{ atl_product_home_shared | default('') }}</property> #}
{# <property name="confluence.cluster">true</property> #}
{# <property name="confluence.cluster.home">{{ atl_product_home_shared | default('') }}</property> #}
{# <property name="confluence.cluster.aws.iam.role">{{ atl_hazelcast_network_aws_iam_role | default('') }}</property> #}
{# <property name="confluence.cluster.aws.region">{{ atl_hazelcast_network_aws_iam_region | default('') }}</property> #}
{# <property name="confluence.cluster.aws.host.header">{{ atl_hazelcast_network_aws_host_header | default('') }}</property> #}
{# <property name="confluence.cluster.aws.tag.key">{{ atl_hazelcast_network_aws_tag_key | default('') }}</property> #}
{# <property name="confluence.cluster.aws.tag.value">{{ atl_hazelcast_network_aws_tag_value | default('') }}</property> #}
{# <property name="confluence.cluster.join.type">aws</property> #}
{# <property name="confluence.cluster.name">{{ atl_aws_stack_name | default('') }}</property> #}
{# <property name="confluence.cluster.ttl">1</property> #}
</properties>
</confluence-configuration>

View File

@ -94,6 +94,12 @@ env['atl_product_home'] = confluence_home
gen_cfg('confluence-init.properties.j2', confluence_install_dir+'/confluence/WEB-INF/classes/confluence-init.properties', env)
######################################################################
# Configure confluence.cfg.xml
gen_cfg('confluence.cfg.xml.j2', confluence_home+'/confluence.cfg.xml', env,
user=user, group=group, mode=0o640)
######################################################################
# Start Confluence as the correct user

View File

@ -226,10 +226,9 @@ def test_confluence_xml_postgres_all_set(docker_cli, image):
'ATL_DB_VALIDATIONQUERY': 'xselect 1'
}
container = run_image(docker_cli, image, environment=environment)
wait_for_file(container, "/opt/atlassian/confluence/confluence/WEB-INF/classes/confluence-init.properties")
wait_for_file(container, "/var/atlassian/application-data/confluence/confluence.cfg.xml")
xml = etree.fromstring(container.file('/var/atlassian/application-data/confluence/confluence.cfg.xml').content)
assert xml.xpath('//property[@name="hibernate.c3p0.min_size"]')[0].text == "x20"
assert xml.xpath('//property[@name="hibernate.c3p0.max_size"]')[0].text == "x100"
assert xml.xpath('//property[@name="hibernate.c3p0.timeout"]')[0].text == "x30"