mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-13 16:33:08 -06:00
DCD-352: Start of Confluence config role.
This commit is contained in:
18
aws_confluence_dc_node.yml
Normal file
18
aws_confluence_dc_node.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- hosts: aws_node_local
|
||||
become: true
|
||||
|
||||
vars:
|
||||
# See group_vars/aws_node_local.yml, which pull vars from the environment.
|
||||
atl_product_family: "confluence"
|
||||
atl_product_user: "confluence"
|
||||
atl_product_edition: "confluence"
|
||||
|
||||
roles:
|
||||
- role: linux_common
|
||||
- role: aws_common
|
||||
- role: aws_efs_config
|
||||
- role: product_common
|
||||
- role: product_install
|
||||
- role: database_init
|
||||
- role: confluence_config
|
||||
12
roles/confluence_config/.yamllint
Normal file
12
roles/confluence_config/.yamllint
Normal file
@@ -0,0 +1,12 @@
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
braces:
|
||||
max-spaces-inside: 1
|
||||
level: error
|
||||
brackets:
|
||||
max-spaces-inside: 1
|
||||
level: error
|
||||
line-length: disable
|
||||
truthy: disable
|
||||
trailing-spaces: false
|
||||
56
roles/confluence_config/defaults/atl.sh
Normal file
56
roles/confluence_config/defaults/atl.sh
Normal file
@@ -0,0 +1,56 @@
|
||||
ATL_APP_DATA_MOUNT_ENABLED=false
|
||||
ATL_AUTOLOGIN_COOKIE_AGE=
|
||||
ATL_AWS_STACK_NAME=Confluence
|
||||
ATL_CATALINA_OPTS=" "
|
||||
ATL_CONFLUENCE_DATA_CENTER=true
|
||||
ATL_CONFLUENCE_INSTALLER_DOWNLOAD_URL=
|
||||
ATL_CONFLUENCE_VERSION=6.13.2
|
||||
ATL_DB_ACQUIREINCREMENT=1
|
||||
ATL_DB_HOST=confluence.cvuoodawotyo.ap-southeast-2.rds.amazonaws.com
|
||||
ATL_DB_IDLETESTPERIOD=100
|
||||
ATL_DB_MAXSTATEMENTS=0
|
||||
ATL_DB_NAME=confluence
|
||||
ATL_DB_PASSWORD=base1name
|
||||
ATL_DB_POOLMAXSIZE=60
|
||||
ATL_DB_POOLMINSIZE=20
|
||||
ATL_DB_PORT=5432
|
||||
ATL_DB_PREFERREDTESTQUERY="select version();"
|
||||
ATL_DB_TIMEOUT=30
|
||||
ATL_DB_VALIDATE=false
|
||||
ATL_ENABLED_PRODUCTS=Confluence
|
||||
ATL_ENABLED_SHARED_HOMES=
|
||||
ATL_ENVIRONMENT=prod
|
||||
ATL_HAZELCAST_NETWORK_AWS_HOST_HEADER=ec2.amazonaws.com
|
||||
ATL_HAZELCAST_NETWORK_AWS_IAM_REGION=ap-southeast-2
|
||||
ATL_HAZELCAST_NETWORK_AWS_IAM_ROLE=Confluence-ConfluenceClusterNodeRole-ZFINZTEGMH6G
|
||||
ATL_HAZELCAST_NETWORK_AWS_TAG_KEY=Cluster
|
||||
ATL_HAZELCAST_NETWORK_AWS_TAG_VALUE=Confluence
|
||||
ATL_HOSTEDZONE=
|
||||
ATL_JDBC_DRIVER=org.postgresql.Driver
|
||||
ATL_JDBC_PASSWORD=base1name
|
||||
ATL_JDBC_URL=jdbc:postgresql://confluence.cvuoodawotyo.ap-southeast-2.rds.amazonaws.com:5432/confluence
|
||||
ATL_JDBC_USER=atlconfluence
|
||||
ATL_JVM_HEAP=2048m
|
||||
ATL_LOCALANSIBLE_REPO=
|
||||
ATL_LOCALANSIBLE_SSHKEYNAME=
|
||||
ATL_NGINX_ENABLED=false
|
||||
ATL_POSTGRES_ENABLED=false
|
||||
ATL_PROXY_NAME=ssmith-conf-old.deplops.com
|
||||
ATL_RELEASE_S3_BUCKET=atlassian-software
|
||||
ATL_RELEASE_S3_PATH=releases/confluence
|
||||
ATL_SSL_PROXY=true
|
||||
ATL_SSL_SELF_CERT_ENABLED=false
|
||||
ATL_STARTCOLLECTD=false
|
||||
ATL_SYNCHRONY_SERVICE_URL=https://ssmith-conf-old.deplops.com/synchrony/v1
|
||||
ATL_TOMCAT_ACCEPTCOUNT=10
|
||||
ATL_TOMCAT_CONNECTIONTIMEOUT=20000
|
||||
ATL_TOMCAT_CONTEXTPATH=
|
||||
ATL_TOMCAT_DEFAULTCONNECTORPORT=8080
|
||||
ATL_TOMCAT_ENABLELOOKUPS=false
|
||||
ATL_TOMCAT_MAXTHREADS=48
|
||||
ATL_TOMCAT_MINSPARETHREADS=10
|
||||
ATL_TOMCAT_PROTOCOL=HTTP/1.1
|
||||
ATL_TOMCAT_PROXYPORT=443
|
||||
ATL_TOMCAT_REDIRECTPORT=8443
|
||||
ATL_TOMCAT_SCHEME=https
|
||||
ATL_TOMCAT_SECURE=true
|
||||
34
roles/confluence_config/defaults/main.yml
Normal file
34
roles/confluence_config/defaults/main.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
|
||||
atl_jvm_heap: "2048m"
|
||||
|
||||
atl_catalina_opts: ""
|
||||
atl_catalina_opts_extra: >-
|
||||
-Datlassian.event.thread_pool_configuration.queue_size=4096
|
||||
-Datlassian.plugins.enable.wait=300
|
||||
-Dconfluence.upgrade.recovery.file.enabled=false
|
||||
-Dfile.encoding=UTF-8
|
||||
-Djava.net.preferIPv4Stack=true
|
||||
-Dshare.group.email.mapping=atlassian-all:atlassian-all@atlassian.com,atlassian-staff:atlassian-staff@atlassian.com
|
||||
-XX:+PrintAdaptiveSizePolicy
|
||||
-XX:+PrintGCDetails
|
||||
-XX:+PrintTenuringDistribution
|
||||
-Dsynchrony.proxy.enabled=false
|
||||
-Dsynchrony.service.url=${ATL_SYNCHRONY_SERVICE_URL}
|
||||
-Dconfluence.cluster.node.name=${_ATL_PRIVATE_IPV4}
|
||||
-Dconfluence.cluster.hazelcast.max.no.heartbeat.seconds=60
|
||||
|
||||
atl_tomcat_port: "8080"
|
||||
atl_tomcat_mgmt_port: "8005"
|
||||
atl_tomcat_acceptcount: "10"
|
||||
atl_tomcat_connectiontimeout: "20000"
|
||||
atl_tomcat_contextpath: ""
|
||||
atl_tomcat_maxthreads: "200"
|
||||
atl_tomcat_minsparethreads: "10"
|
||||
atl_tomcat_protocol: "HTTP/1.1"
|
||||
atl_tomcat_redirectport: ""
|
||||
atl_tomcat_scheme: "http"
|
||||
atl_tomcat_secure: "false"
|
||||
|
||||
atl_autologin_cookie_age: "{{ lookup('env', 'ATL_AUTOLOGIN_COOKIE_AGE') }}"
|
||||
atl_synchrony_service_url: "{{ lookup('env', 'ATL_SYNCHRONY_SERVICE_URL') }}"
|
||||
14
roles/confluence_config/molecule/default/Dockerfile.j2
Normal file
14
roles/confluence_config/molecule/default/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/default/molecule.yml
Normal file
32
roles/confluence_config/molecule/default/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
|
||||
18
roles/confluence_config/molecule/default/playbook.yml
Normal file
18
roles/confluence_config/molecule/default/playbook.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
atl_product_family: "confluence"
|
||||
atl_product_edition: "confluence"
|
||||
atl_product_user: "confluence"
|
||||
atl_product_version: "latest"
|
||||
atl_jdbc_user: 'confluence'
|
||||
atl_jvm_heap: 'PLACEHOLDER'
|
||||
atl_cluster_node_id: 'FAKEID'
|
||||
atl_autologin_cookie_age: "COOKIEAGE"
|
||||
|
||||
roles:
|
||||
- role: linux_common
|
||||
- role: product_common
|
||||
- role: product_install
|
||||
- role: confluence_config
|
||||
@@ -0,0 +1,58 @@
|
||||
import os
|
||||
|
||||
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_setenv_file(host):
|
||||
f = host.file('/opt/atlassian/confluence/current/bin/setenv.sh')
|
||||
assert f.exists
|
||||
assert f.contains('-XmsPLACEHOLDER')
|
||||
assert f.contains('-XmxPLACEHOLDER')
|
||||
|
||||
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'
|
||||
|
||||
# def test_dbconfig_file(host):
|
||||
# f = host.file('/var/atlassian/application-data/jira/dbconfig.xml')
|
||||
# assert f.exists
|
||||
# assert f.user == 'jira'
|
||||
# assert f.contains("<driver-class>org.postgresql.Driver</driver-class>")
|
||||
# assert f.contains("<username>atljira</username>")
|
||||
# assert f.contains("<pool-min-size>20</pool-min-size>")
|
||||
|
||||
|
||||
# def test_cluster_file(host):
|
||||
# f = host.file('/var/atlassian/application-data/jira/cluster.properties')
|
||||
# assert f.exists
|
||||
# assert f.contains('jira.node.id = FAKEID')
|
||||
# assert f.contains('jira.shared.home = /media/atl/jira/shared')
|
||||
63
roles/confluence_config/tasks/main.yml
Normal file
63
roles/confluence_config/tasks/main.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
|
||||
- name: Configure login properties
|
||||
template:
|
||||
src: seraph-config.xml.j2
|
||||
dest: "{{ atl_product_installation_versioned }}/confluence/WEB-INF/classes/seraph-config.xml"
|
||||
|
||||
- name: Override JVM memory settings.
|
||||
replace:
|
||||
path: "{{ atl_product_installation_versioned }}/bin/setenv.sh"
|
||||
regexp: "-{{ item }}\\d+m "
|
||||
replace: "-{{ item }}{{ atl_jvm_heap }} "
|
||||
with_items:
|
||||
- 'Xmx'
|
||||
- 'Xms'
|
||||
|
||||
- name: Create server config
|
||||
template:
|
||||
src: server.xml.j2
|
||||
dest: "{{ atl_product_installation_versioned }}/conf/server.xml"
|
||||
|
||||
|
||||
|
||||
- name: Create application directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ atl_product_user }}"
|
||||
group: "{{ atl_product_user }}"
|
||||
with_items:
|
||||
- "{{ atl_product_home }}"
|
||||
- "{{ atl_product_home_shared }}"
|
||||
- "{{ atl_product_shared_plugins }}"
|
||||
changed_when: false # For Molecule idempotence check
|
||||
|
||||
|
||||
- name: Limit permissions on the installation directory
|
||||
file:
|
||||
path: "{{ atl_product_installation_versioned }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "u=rwX,g=rX,o=rX"
|
||||
recurse: true
|
||||
with_items:
|
||||
- "{{ atl_installer_temp }}"
|
||||
- "{{ atl_product_installation_versioned }}"
|
||||
- "{{ atl_product_version_cache_dir }}"
|
||||
changed_when: false # For Molecule idempotence check
|
||||
|
||||
- name: Grant access to the product working directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: "u=rwX,g=rX,o-rwx"
|
||||
owner: "{{ atl_product_user }}"
|
||||
group: "{{ atl_product_user }}"
|
||||
recurse: true
|
||||
with_items:
|
||||
- "{{ atl_product_installation_versioned }}/logs"
|
||||
- "{{ atl_product_installation_versioned }}/temp"
|
||||
- "{{ atl_product_installation_versioned }}/work"
|
||||
changed_when: false # For Molecule idempotence check
|
||||
71
roles/confluence_config/templates/seraph-config.xml.j2
Normal file
71
roles/confluence_config/templates/seraph-config.xml.j2
Normal file
@@ -0,0 +1,71 @@
|
||||
<security-config>
|
||||
<parameters>
|
||||
<init-param>
|
||||
<param-name>login.url</param-name>
|
||||
<param-value>/login.action?os_destination=${originalurl}&permissionViolation=true</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>link.login.url</param-name>
|
||||
<param-value>/login.action</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>cookie.encoding</param-name>
|
||||
<param-value>cNf</param-value>
|
||||
</init-param>
|
||||
<init-param>
|
||||
<param-name>login.cookie.key</param-name>
|
||||
<param-value>seraph.confluence</param-value>
|
||||
</init-param>
|
||||
|
||||
{% if atl_autologin_cookie_age is defined and atl_autologin_cookie_age|length %}
|
||||
<init-param>
|
||||
<param-name>autologin.cookie.age</param-name>
|
||||
<param-value>{{ atl_autologin_cookie_age }}</param-value>
|
||||
</init-param>
|
||||
{% endif %}
|
||||
|
||||
<!--only basic authentication available-->
|
||||
<init-param>
|
||||
<param-name>authentication.type</param-name>
|
||||
<param-value>os_authType</param-value>
|
||||
</init-param>
|
||||
|
||||
<!-- Invalidate session on login to prevent session fixation attack -->
|
||||
<init-param>
|
||||
<param-name>invalidate.session.on.login</param-name>
|
||||
<param-value>true</param-value>
|
||||
</init-param>
|
||||
<!-- Add names for session attributes that must not be copied to a new session when the old one gets invalidated.
|
||||
Currently it is empty (i.e. all attributes will be copied). -->
|
||||
<init-param>
|
||||
<param-name>invalidate.session.exclude.list</param-name>
|
||||
<param-value></param-value>
|
||||
</init-param>
|
||||
</parameters>
|
||||
|
||||
<rolemapper class="com.atlassian.confluence.security.ConfluenceRoleMapper"/>
|
||||
<controller class="com.atlassian.confluence.setup.seraph.ConfluenceSecurityController"/>
|
||||
|
||||
<!-- Default Confluence authenticator, which uses the configured user management for authentication. -->
|
||||
<authenticator class="com.atlassian.confluence.user.ConfluenceAuthenticator"/>
|
||||
|
||||
<!-- Custom authenticators appear below. To enable one of them, comment out the default authenticator above and uncomment the one below. -->
|
||||
|
||||
<!-- Authenticator with support for Crowd single-sign on (SSO). -->
|
||||
<!-- <authenticator class="com.atlassian.confluence.user.ConfluenceCrowdSSOAuthenticator"/> -->
|
||||
|
||||
<!-- Specialised version of the default authenticator which adds authenticated users to confluence-users if they aren't already a member. -->
|
||||
<!-- <authenticator class="com.atlassian.confluence.user.ConfluenceGroupJoiningAuthenticator"/> -->
|
||||
|
||||
<services>
|
||||
<service class="com.atlassian.seraph.service.PathService">
|
||||
<init-param>
|
||||
<param-name>config.file</param-name>
|
||||
<param-value>seraph-paths.xml</param-value>
|
||||
</init-param>
|
||||
</service>
|
||||
</services>
|
||||
|
||||
<elevatedsecurityguard class="com.atlassian.confluence.security.seraph.ConfluenceElevatedSecurityGuard"/>
|
||||
|
||||
</security-config>
|
||||
67
roles/confluence_config/templates/server.xml.j2
Normal file
67
roles/confluence_config/templates/server.xml.j2
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<Server port="{{ atl_tomcat_mgmt_port }}"
|
||||
shutdown="SHUTDOWN">
|
||||
|
||||
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
|
||||
<Listener className="org.apache.catalina.core.AprLifecycleListener"
|
||||
SSLEngine="on"/>
|
||||
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
|
||||
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
|
||||
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
|
||||
|
||||
<Service name="Catalina">
|
||||
|
||||
<Connector port="{{ atl_tomcat_port }}"
|
||||
maxThreads="{{ atl_tomcat_maxthreads }}"
|
||||
minSpareThreads="{{ atl_tomcat_minsparethreads }}"
|
||||
connectionTimeout="{{ atl_tomcat_connectiontimeout }}"
|
||||
enableLookups="{{ atl_tomcat_enablelookups }}"
|
||||
protocol="{{ atl_tomcat_protocol }}"
|
||||
redirectPort="{{ atl_tomcat_redirectport }}"
|
||||
acceptCount="{{ atl_tomcat_acceptcount }}"
|
||||
secure="{{ atl_tomcat_secure }}"
|
||||
scheme="{{ atl_tomcat_scheme }}"
|
||||
{% if atl_proxy_name is defined and atl_proxy_name != '' %}
|
||||
proxyName="{{ atl_proxy_name }}"
|
||||
{% endif %}
|
||||
{% if atl_proxy_port is defined and atl_proxy_port != '' %}
|
||||
proxyPort="{{ atl_proxy_port }}"
|
||||
{% endif %}
|
||||
|
||||
relaxedPathChars="[]|"
|
||||
relaxedQueryChars="[]|{}^\`"<>"
|
||||
bindOnInit="false"
|
||||
maxHttpHeaderSize="8192"
|
||||
useBodyEncodingForURI="true"
|
||||
disableUploadTimeout="true" />
|
||||
|
||||
<Engine name="Catalina"
|
||||
defaultHost="localhost">
|
||||
<Host name="localhost"
|
||||
appBase="webapps"
|
||||
unpackWARs="true"
|
||||
autoDeploy="true">
|
||||
|
||||
<Context path="{{ atl_tomcat_contextpath }}"
|
||||
docBase="${catalina.home}/atlassian-jira"
|
||||
reloadable="false"
|
||||
useHttpOnly="true">
|
||||
<Resource name="UserTransaction"
|
||||
auth="Container"
|
||||
type="javax.transaction.UserTransaction"
|
||||
factory="org.objectweb.jotm.UserTransactionFactory"
|
||||
jotm.timeout="60"/>
|
||||
<Manager pathname=""/>
|
||||
<JarScanner scanManifest="false"/>
|
||||
<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve"
|
||||
threshold="120" />
|
||||
</Context>
|
||||
|
||||
</Host>
|
||||
<Valve className="org.apache.catalina.valves.AccessLogValve"
|
||||
pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/>
|
||||
</Engine>
|
||||
|
||||
</Service>
|
||||
</Server>
|
||||
Reference in New Issue
Block a user