mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 08:23:06 -06:00
Merged in DCD-407-jdbc-url-for-aurora (pull request #3)
Allow for JDBC Query params and include stderr in bootstrap logs Approved-by: Steve Smith <ssmith@atlassian.com>
This commit is contained in:
@@ -18,4 +18,4 @@ if [[ -f .venv/bin/ansible ]]; then
|
||||
source .venv/bin/activate
|
||||
fi
|
||||
|
||||
ansible-playbook -v -i $INV $PLAYBOOK | tee --append $LOG_FILE
|
||||
ansible-playbook -v -i $INV $PLAYBOOK 2>&1 | tee --append $LOG_FILE
|
||||
|
||||
@@ -44,6 +44,7 @@ atl_aws_stack_name: "{{ lookup('env', 'ATL_AWS_STACK_NAME') }}"
|
||||
atl_aws_region: "{{ lookup('env', 'ATL_AWS_REGION') }}"
|
||||
atl_aws_iam_role: "{{ lookup('env', 'ATL_AWS_IAM_ROLE') }}"
|
||||
|
||||
atl_db_engine: "{{ lookup('env', 'ATL_DB_ENGINE') }}"
|
||||
atl_db_host: "{{ lookup('env', 'ATL_DB_HOST') }}"
|
||||
atl_db_port: "{{ lookup('env', 'ATL_DB_PORT') or '5432' }}"
|
||||
atl_db_root_user: "{{ lookup('env', 'ATL_DB_ROOT_USER') or 'postgres' }}"
|
||||
@@ -70,7 +71,9 @@ atl_jdbc_encoding: "{{ lookup('env', 'ATL_JDBC_ENCODING') or 'UTF-8' }}"
|
||||
atl_jdbc_collation: "{{ lookup('env', 'ATL_JDBC_COLLATION') or 'en_US.UTF-8' }}"
|
||||
atl_jdbc_ctype: "{{ lookup('env', 'ATL_JDBC_CTYPE') or 'en_US.UTF-8' }}"
|
||||
atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}"
|
||||
atl_jdbc_url: "jdbc:postgresql://{{ atl_db_host }}:{{ atl_db_port }}/{{ atl_jdbc_db_name }}"
|
||||
atl_jdbc_query_params_for_engine:
|
||||
aurora_postgres: "?targetServerType=master"
|
||||
atl_jdbc_url: "jdbc:postgresql://{{ atl_db_host }}:{{ atl_db_port }}/{{ atl_jdbc_db_name }}{{ atl_jdbc_query_params_for_engine[atl_db_engine]| default('') }}"
|
||||
|
||||
atl_jvm_heap: "{{ lookup('env', 'ATL_JVM_HEAP') or '2048m' }}"
|
||||
atl_catalina_opts: "{{ lookup('env', 'ATL_CATALINA_OPTS') or '' }}"
|
||||
|
||||
14
roles/confluence_config/molecule/aurora/Dockerfile.j2
Normal file
14
roles/confluence_config/molecule/aurora/Dockerfile.j2
Normal file
@@ -0,0 +1,14 @@
|
||||
# Molecule managed
|
||||
|
||||
{% if item.registry is defined %}
|
||||
FROM {{ item.registry.url }}/{{ item.image }}
|
||||
{% else %}
|
||||
FROM {{ item.image }}
|
||||
{% endif %}
|
||||
|
||||
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
|
||||
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
|
||||
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
|
||||
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
|
||||
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
|
||||
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
|
||||
32
roles/confluence_config/molecule/aurora/molecule.yml
Normal file
32
roles/confluence_config/molecule/aurora/molecule.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
lint:
|
||||
name: yamllint
|
||||
platforms:
|
||||
- name: amazon_linux2
|
||||
image: amazonlinux:2
|
||||
groups:
|
||||
- aws_node_local
|
||||
- name: ubuntu_lts
|
||||
image: ubuntu:bionic
|
||||
groups:
|
||||
- aws_node_local
|
||||
provisioner:
|
||||
name: ansible
|
||||
options:
|
||||
skip-tags: runtime_pkg
|
||||
lint:
|
||||
name: ansible-lint
|
||||
options:
|
||||
x: ["701"]
|
||||
inventory:
|
||||
links:
|
||||
group_vars: ../../../../group_vars/
|
||||
verifier:
|
||||
name: testinfra
|
||||
lint:
|
||||
name: flake8
|
||||
enabled: false
|
||||
23
roles/confluence_config/molecule/aurora/playbook.yml
Normal file
23
roles/confluence_config/molecule/aurora/playbook.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
atl_product_family: "confluence"
|
||||
atl_product_edition: "confluence"
|
||||
atl_product_user: "confluence"
|
||||
atl_product_version: "latest"
|
||||
atl_db_engine: "aurora_postgres"
|
||||
atl_db_host: "aurora-postgres-db.ap-southeast-2.rds.amazonaws.com"
|
||||
atl_jdbc_db_name: "confluence"
|
||||
atl_jdbc_user: 'confluence'
|
||||
atl_jvm_heap: 'PLACEHOLDER'
|
||||
atl_cluster_node_id: 'FAKEID'
|
||||
atl_autologin_cookie_age: "COOKIEAGE"
|
||||
atl_local_ipv4: "1.1.1.1"
|
||||
|
||||
roles:
|
||||
- role: linux_common
|
||||
- role: product_common
|
||||
- role: product_install
|
||||
- role: confluence_common
|
||||
- role: confluence_config
|
||||
68
roles/confluence_config/molecule/aurora/tests/test_aurora.py
Normal file
68
roles/confluence_config/molecule/aurora/tests/test_aurora.py
Normal file
@@ -0,0 +1,68 @@
|
||||
import os
|
||||
import pytest
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
||||
def test_seraph_file(host):
|
||||
f = host.file('/opt/atlassian/confluence/current/confluence/WEB-INF/classes/seraph-config.xml')
|
||||
assert f.exists
|
||||
assert f.contains('<param-value>COOKIEAGE</param-value>')
|
||||
|
||||
def test_conf_init_file(host):
|
||||
f = host.file('/opt/atlassian/confluence/current/confluence/WEB-INF/classes/confluence-init.properties')
|
||||
assert f.exists
|
||||
assert f.contains('confluence.home = /var/atlassian/application-data/confluence')
|
||||
|
||||
def test_setenv_file(host):
|
||||
f = host.file('/opt/atlassian/confluence/current/bin/setenv.sh')
|
||||
assert f.exists
|
||||
assert f.contains('-XmsPLACEHOLDER')
|
||||
assert f.contains('-XmxPLACEHOLDER')
|
||||
assert f.contains('-Dconfluence.cluster.node.name=1.1.1.1')
|
||||
|
||||
def test_server_file(host):
|
||||
f = host.file('/opt/atlassian/confluence/current/conf/server.xml')
|
||||
assert f.exists
|
||||
assert f.contains('Connector port="8080"')
|
||||
assert f.contains('Server port="8005"')
|
||||
assert f.contains('<Context path=""')
|
||||
assert f.contains('maxThreads="200"')
|
||||
assert f.contains('minSpareThreads="10"')
|
||||
assert f.contains('connectionTimeout="20000"')
|
||||
assert f.contains('enableLookups="false"')
|
||||
assert f.contains('protocol="HTTP/1.1"')
|
||||
assert f.contains('redirectPort=""')
|
||||
assert f.contains('acceptCount="10"')
|
||||
assert f.contains('secure="false"')
|
||||
assert f.contains('scheme="http"')
|
||||
assert not f.contains('proxyName=')
|
||||
assert not f.contains('proxyPort=')
|
||||
|
||||
def test_install_permissions(host):
|
||||
assert host.file('/opt/atlassian/confluence/current/conf/server.xml').user == 'root'
|
||||
assert host.file('/opt/atlassian/confluence/current/confluence/WEB-INF/web.xml').user == 'root'
|
||||
|
||||
assert host.file('/opt/atlassian/confluence/current/logs/').user == 'confluence'
|
||||
assert host.file('/opt/atlassian/confluence/current/work/').user == 'confluence'
|
||||
assert host.file('/opt/atlassian/confluence/current/temp/').user == 'confluence'
|
||||
|
||||
@pytest.mark.parametrize('directory', [
|
||||
'/var/atlassian/application-data/confluence/',
|
||||
'/media/atl/confluence/shared-home/'
|
||||
])
|
||||
def test_home_directories(host, directory):
|
||||
d = host.file(directory)
|
||||
assert d.exists
|
||||
assert d.user == 'confluence'
|
||||
|
||||
def test_confluence_config_file(host):
|
||||
f = host.file('/var/atlassian/application-data/confluence/confluence.cfg.xml')
|
||||
assert f.exists
|
||||
assert f.user == 'confluence'
|
||||
assert f.contains('<property name="confluence.cluster.home">/media/atl/confluence/shared-home</property>')
|
||||
assert f.contains('<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>')
|
||||
assert f.contains('<property name="confluence.cluster.aws.host.header">ec2.amazonaws.com</property>')
|
||||
assert f.contains('<property name="hibernate.connection.url">jdbc:postgresql://aurora-postgres-db.ap-southeast-2.rds.amazonaws.com:5432/confluence?targetServerType=master</property>')
|
||||
@@ -6,6 +6,9 @@
|
||||
atl_product_edition: "confluence"
|
||||
atl_product_user: "confluence"
|
||||
atl_product_version: "latest"
|
||||
atl_db_engine: "postgres"
|
||||
atl_db_host: "postgres-db.ap-southeast-2.rds.amazonaws.com"
|
||||
atl_jdbc_db_name: "confluence"
|
||||
atl_jdbc_user: 'confluence'
|
||||
atl_jvm_heap: 'PLACEHOLDER'
|
||||
atl_cluster_node_id: 'FAKEID'
|
||||
|
||||
@@ -65,3 +65,4 @@ def test_confluence_config_file(host):
|
||||
assert f.contains('<property name="confluence.cluster.home">/media/atl/confluence/shared-home</property>')
|
||||
assert f.contains('<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>')
|
||||
assert f.contains('<property name="confluence.cluster.aws.host.header">ec2.amazonaws.com</property>')
|
||||
assert f.contains('<property name="hibernate.connection.url">jdbc:postgresql://postgres-db.ap-southeast-2.rds.amazonaws.com:5432/confluence</property>')
|
||||
|
||||
Reference in New Issue
Block a user