AZURE-211 SQL Server support for Azure Quick Start

This commit is contained in:
dbacon
2020-05-20 14:14:05 +01:00
parent e78af09b8b
commit 3e3d83d162
16 changed files with 244 additions and 815 deletions

View File

@@ -11,13 +11,13 @@
atl_startup_systemd_params: atl_startup_systemd_params:
- "Environment=JDBC_DRIVER={{ atl_db_driver }}" - "Environment=JDBC_DRIVER={{ atl_db_driver }}"
- "Environment=JDBC_DIALECT=org.hibernate.dialect.PostgreSQLDialect" - "Environment=JDBC_DIALECT={{atl_jdbc_dialect}}"
- "Environment=JDBC_USER={{ atl_db_root_user_login }}" - "Environment=JDBC_USER={{ atl_jdbc_user }}"
- "Environment=JDBC_PASSWORD={{ atl_jdbc_password }}" - "Environment=JDBC_PASSWORD={{ atl_jdbc_password }}"
- "Environment=JDBC_URL={{ atl_jdbc_url }}" - "Environment=JDBC_URL={{ atl_jdbc_url }}"
atl_jdbc_encoding: 'UNICODE' atl_jdbc_encoding: 'UNICODE'
atl_jdbc_collation: 'C' atl_jdbc_collation: 'Latin1_General_CS_AS'
atl_jdbc_ctype: 'C' atl_jdbc_ctype: 'C'
atl_jdbc_template: 'template0' atl_jdbc_template: 'template0'

View File

@@ -77,13 +77,23 @@ atl_aws_iam_role_arn: "{{ lookup('env', 'ATL_AWS_IAM_ROLE_ARN') }}"
atl_aws_enable_cloudwatch: "{{ lookup('env', 'ATL_AWS_ENABLE_CLOUDWATCH')|bool or false }}" atl_aws_enable_cloudwatch: "{{ lookup('env', 'ATL_AWS_ENABLE_CLOUDWATCH')|bool or false }}"
atl_aws_enable_cloudwatch_logs: "{{ lookup('env', 'ATL_AWS_ENABLE_CLOUDWATCH_LOGS')|bool or false }}" atl_aws_enable_cloudwatch_logs: "{{ lookup('env', 'ATL_AWS_ENABLE_CLOUDWATCH_LOGS')|bool or false }}"
atl_db_engine: "{{ lookup('env', 'ATL_DB_ENGINE') }}" atl_db_engine: "{{ lookup('env', 'ATL_DB_ENGINE') or 'rds_postgres' }}"
atl_dbms_for_db_engine:
aurora_postgres: "postgres"
rds_postgres: "postgres"
postgres: "postgres"
sql_server: "sql_server"
azure_sql: "sql_server"
atl_dbms: "{{ atl_dbms_for_db_engine[atl_db_engine] }}"
atl_db_host: "{{ lookup('env', 'ATL_DB_HOST') }}" atl_db_host: "{{ lookup('env', 'ATL_DB_HOST') }}"
atl_db_port: "{{ lookup('env', 'ATL_DB_PORT') or '5432' }}" atl_db_port: "{{ lookup('env', 'ATL_DB_PORT') or '5432' }}"
atl_db_root_db_name: "{{ lookup('env', 'ATL_DB_ROOT_DB_NAME') or 'postgres' }}" atl_db_root_db_name: "{{ lookup('env', 'ATL_DB_ROOT_DB_NAME') or 'postgres' }}"
atl_db_root_user: "{{ lookup('env', 'ATL_DB_ROOT_USER') or 'postgres' }}" atl_db_root_user: "{{ lookup('env', 'ATL_DB_ROOT_USER') or 'postgres' }}"
atl_db_root_password: "{{ lookup('env', 'ATL_DB_ROOT_PASSWORD') }}" atl_db_root_password: "{{ lookup('env', 'ATL_DB_ROOT_PASSWORD') }}"
atl_db_driver: "{{ lookup('env', 'ATL_DB_DRIVER') or 'org.postgresql.Driver' }}" atl_db_driver_for_dbms:
postgres: "org.postgresql.Driver"
sql_server: "net.sourceforge.jtds.jdbc.Driver"
atl_db_driver: "{{ lookup('env', 'ATL_DB_DRIVER') or atl_db_driver_for_dbms[atl_dbms] }}"
atl_db_poolminsize: "{{ lookup('env', 'ATL_DB_POOLMINSIZE') or '20' }}" atl_db_poolminsize: "{{ lookup('env', 'ATL_DB_POOLMINSIZE') or '20' }}"
atl_db_poolmaxsize: "{{ lookup('env', 'ATL_DB_POOLMAXSIZE') or '100' }}" atl_db_poolmaxsize: "{{ lookup('env', 'ATL_DB_POOLMAXSIZE') or '100' }}"
@@ -101,6 +111,7 @@ atl_db_engine_to_db_type_map:
aurora_postgres: "postgresaurora96" aurora_postgres: "postgresaurora96"
rds_postgres: "postgres72" rds_postgres: "postgres72"
atl_db_type: "{{ atl_db_engine_to_db_type_map[atl_db_engine] | default('postgres72') }}" atl_db_type: "{{ atl_db_engine_to_db_type_map[atl_db_engine] | default('postgres72') }}"
atl_db_sql_collation: "{{ lookup('env', 'ATL_SQL_SERVER_COLLATION') or 'Latin1_General_CS_AS' }}"
atl_jdbc_db_name: "{{ lookup('env', 'ATL_JDBC_DB_NAME') }}" atl_jdbc_db_name: "{{ lookup('env', 'ATL_JDBC_DB_NAME') }}"
atl_jdbc_user: "{{ lookup('env', 'ATL_JDBC_USER') }}" atl_jdbc_user: "{{ lookup('env', 'ATL_JDBC_USER') }}"
@@ -109,9 +120,14 @@ 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_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_ctype: "{{ lookup('env', 'ATL_JDBC_CTYPE') or 'en_US.UTF-8' }}"
atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}" atl_jdbc_template: "{{ lookup('env', 'ATL_JDBC_TEMPLATE') or 'template1' }}"
atl_jdbc_query_params_for_engine: atl_jdbc_url_subprotocol_for_dbms:
aurora_postgres: "?targetServerType=master" postgres: "jdbc:postgresql"
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('') }}" sql_server: "jdbc:jtds:sqlserver"
atl_jdbc_dialect_for_dbms:
postgres: "org.hibernate.dialect.PostgreSQLDialect"
sql_server: "com.atlassian.crowd.util.persistence.hibernate.SQLServerIntlDialect"
atl_jdbc_dialect: "{{ atl_jdbc_dialect_for_dbms[atl_dbms] }}"
atl_jdbc_url: "{{ atl_jdbc_url_subprotocol_for_dbms[atl_dbms]}}://{{ 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_jvm_heap: "{{ lookup('env', 'ATL_JVM_HEAP') or '2048m' }}"
atl_jvm_opts: "{{ lookup('env', 'ATL_JVM_OPTS') or '' }}" atl_jvm_opts: "{{ lookup('env', 'ATL_JVM_OPTS') or '' }}"

View File

@@ -1,12 +1,12 @@
extends: default extends: default
rules: rules:
line-length: disable
braces: braces:
max-spaces-inside: 1 max-spaces-inside: 1
level: error level: error
brackets: brackets:
max-spaces-inside: 1 max-spaces-inside: 1
level: error level: error
line-length: disable
truthy: disable truthy: disable
trailing-spaces: false trailing-spaces: false

View File

@@ -1,5 +1,5 @@
--- ---
app_insights_version: "{{ lookup('env', 'APPINSIGHTS_VER') or '2.3.1' }}" app_insights_version: "{{ lookup('env', 'APPINSIGHTS_VER') or '2.6.0' }}"
app_insights_instrumentation_key: "{{ lookup('env', 'APPINSIGHTS_INSTRUMENTATION_KEY') or 'XXX' }}" app_insights_instrumentation_key: "{{ lookup('env', 'APPINSIGHTS_INSTRUMENTATION_KEY') or 'XXX' }}"
app_insights_jaxb_version: 2.3.1 app_insights_jaxb_version: 2.3.1

View File

@@ -20,19 +20,19 @@ def test_jaxb_installed(host):
f = host.file('/usr/share/collectd/java/jaxb-api-2.3.1.jar') f = host.file('/usr/share/collectd/java/jaxb-api-2.3.1.jar')
assert f.exists assert f.exists
# @pytest.mark.parametrize('filename', [ @pytest.mark.parametrize('filename', [
# '/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/lib/applicationinsights-core-2.3.1.jar', '/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/lib/applicationinsights-core-2.6.0.jar',
# '/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/lib/applicationinsights-web-2.3.1.jar', '/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/lib/applicationinsights-web-2.6.0.jar',
# '/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/lib/applicationinsights-collectd-2.3.1.jar' '/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/lib/applicationinsights-agent-2.6.0.jar'
# ]) ])
# def test_app_insight_jars_downloaded(host, filename): def test_app_insight_jars_downloaded(host, filename):
# f = host.file(filename) f = host.file(filename)
# assert f.exists
def test_app_insights_collectd_file(host):
f = host.file('/usr/share/collectd/java/applicationinsights-collectd-2.3.1.jar')
assert f.exists assert f.exists
# def test_applicationinsights_xml_installed(host): def test_app_insights_collectd_file(host):
# f = host.file('/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/classes/ApplicationInsights.xml') f = host.file('/usr/share/collectd/java/applicationinsights-collectd-2.6.0.jar')
# assert f.exists assert f.exists
def test_applicationinsights_xml_installed(host):
f = host.file('/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/classes/ApplicationInsights.xml')
assert f.exists

View File

@@ -5,6 +5,13 @@
name: name:
- collectd - collectd
- name: Download Collectd App Insights jar
get_url:
url: "https://github.com/Microsoft/ApplicationInsights-Java/releases/download/{{ app_insights_version }}/{{ item }}"
dest: "/usr/share/collectd/java/applicationinsights-collectd-{{ app_insights_version }}.jar"
with_items:
- "applicationinsights-collectd-{{ app_insights_version }}.jar"
- name: Configure Collectd - name: Configure Collectd
template: src=collectd.conf.j2 dest=/etc/collectd/collectd.conf template: src=collectd.conf.j2 dest=/etc/collectd/collectd.conf
notify: notify:
@@ -20,27 +27,45 @@
url: "https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/{{ app_insights_jaxb_version }}/jaxb-api-{{ app_insights_jaxb_version }}.jar" url: "https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/{{ app_insights_jaxb_version }}/jaxb-api-{{ app_insights_jaxb_version }}.jar"
dest: "/usr/share/collectd/java/" dest: "/usr/share/collectd/java/"
# - name: Download App Insights jars - name: Download App Insights jars
# get_url:
# url: "https://github.com/Microsoft/ApplicationInsights-Java/releases/download/{{ app_insights_version }}/{{ item }}"
# dest: "{{ atl_product_installation_versioned }}/crowd-webapp/WEB-INF/lib/"
# with_items:
# - "applicationinsights-core-{{ app_insights_version }}.jar"
# - "applicationinsights-web-{{ app_insights_version }}.jar"
# - "applicationinsights-collectd-{{ app_insights_version }}.jar"
#
# - name: Copy applicationinsights-collectd to collectd
# copy:
# src: "{{ atl_product_installation_versioned }}/crowd-webapp/WEB-INF/lib/applicationinsights-collectd-{{ app_insights_version }}.jar"
# dest: "/usr/share/collectd/java/applicationinsights-collectd-{{ app_insights_version }}.jar"
# remote_src: true
#
# - name: Add ApplicationInsights.xml configuration
# template: src=ApplicationInsights.xml.j2 dest={{ atl_product_installation_versioned }}/crowd-webapp/WEB-INF/classes/ApplicationInsights.xml
- name: Download applicationinsights-collectd to collectd
get_url: get_url:
url: "https://github.com/Microsoft/ApplicationInsights-Java/releases/download/{{ app_insights_version }}/{{ item }}" url: "https://github.com/Microsoft/ApplicationInsights-Java/releases/download/{{ app_insights_version }}/{{ item }}"
dest: "/usr/share/collectd/java/applicationinsights-collectd-{{ app_insights_version }}.jar" dest: "{{ atl_product_installation_versioned }}/crowd-webapp/WEB-INF/lib/"
with_items: with_items:
- "applicationinsights-collectd-{{ app_insights_version }}.jar" - "applicationinsights-core-{{ app_insights_version }}.jar"
- "applicationinsights-web-{{ app_insights_version }}.jar"
- "applicationinsights-agent-{{ app_insights_version }}.jar"
- name: Add java agent to JAVA_OPTS
lineinfile:
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
regexp: '^export JAVA_OPTS'
line: "export JAVA_OPTS=\"$JAVA_OPTS -javaagent:{{ atl_product_installation_versioned }}\
/crowd-webapp/WEB-INF/lib/applicationinsights-agent-{{ app_insights_version }}.jar\""
- name: Add ApplicationInsights.xml configuration
template: src=ApplicationInsights.xml.j2 dest={{ atl_product_installation_versioned }}/crowd-webapp/WEB-INF/classes/ApplicationInsights.xml
- name: Check for existing App Insights Filter
xml:
path: "/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/web.xml"
xpath: //*[.="ApplicationInsightsWebFilter"]
count: yes
register: appInsightsFilter
- name: Add App Insights Filter
xml:
path: "/opt/atlassian/crowd/current/crowd-webapp/WEB-INF/web.xml"
xpath: /*[name()='web-app']
input_type: xml
pretty_print: yes
add_children:
- "<filter>\
<filter-name>ApplicationInsightsWebFilter</filter-name>\
<filter-class>com.microsoft.applicationinsights.web.internal.WebRequestTrackingFilter</filter-class>\
</filter>"
- "<filter-mapping>\
<filter-name>ApplicationInsightsWebFilter</filter-name>\
<url-pattern>/*</url-pattern>\
</filter-mapping>"
when: appInsightsFilter.count < 1

View File

@@ -92,672 +92,6 @@ LoadPlugin java
InstrumentationKey "{{ app_insights_instrumentation_key }}" InstrumentationKey "{{ app_insights_instrumentation_key }}"
SDKLogger true SDKLogger true
</Plugin> </Plugin>
LoadPlugin "org.collectd.java.GenericJMX"
<Plugin "GenericJMX">
# Confluence indexing statistics
<MBean "confluence/IndexingStatistics">
ObjectName "Confluence:name=IndexingStatistics"
InstancePrefix "confluence-IndexingStatistics"
<Value>
InstancePrefix "last_elapsed_ms"
Type "total_time_in_ms"
Table false
Attribute "LastElapsedMilliseconds"
</Value>
<Value>
InstancePrefix "task_queue_length"
Type "queue_length"
Table false
Attribute "TaskQueueLength"
</Value>
</MBean>
<MBean "confluence/MailTaskQueue">
ObjectName "Confluence:name=MailTaskQueue"
InstancePrefix "confluence-MailTaskQueue"
<Value>
Type "email_count"
InstancePrefix "retry_count"
Table false
Attribute "RetryCount"
</Value>
<Value>
Type "email_count"
InstancePrefix "tasks"
Table false
Attribute "TasksSize"
</Value>
<Value>
Type "email_count"
InstancePrefix "error_queue"
Table false
Attribute "ErrorQueueSize"
</Value>
</MBean>
<MBean "confluence/RequestMetrics">
ObjectName "Confluence:name=RequestMetrics"
InstancePrefix "confluence-RequestMetrics"
<Value>
Type "requests"
InstancePrefix "avg_exec_time_for_last_ten_requests"
Table false
Attribute "AverageExecutionTimeForLastTenRequests"
</Value>
<Value>
Type "requests"
InstancePrefix "current_num_requests_being_served"
Table false
Attribute "CurrentNumberOfRequestsBeingServed"
</Value>
<Value>
Type "requests"
InstancePrefix "error_count"
Table false
Attribute "ErrorCount"
</Value>
<Value>
Type "requests"
InstancePrefix "num_requests_in_last_ten_secs"
Table false
Attribute "NumberOfRequestsInLastTenSeconds"
</Value>
<Value>
Type "requests"
InstancePrefix "requests_began"
Table false
Attribute "RequestsBegan"
</Value>
<Value>
Type "requests"
InstancePrefix "requests_served"
Table false
Attribute "RequestsServed"
</Value>
</MBean>
<MBean "confluence/SystemInformation">
ObjectName "Confluence:name=SystemInformation"
InstancePrefix "confluence-SystemInformation"
<Value>
Type "latency"
InstancePrefix "database_example_latency"
Table false
Attribute "DatabaseExampleLatency"
</Value>
<Value>
Type "response_time"
InstancePrefix "start_time"
Table false
Attribute "StartTime"
</Value>
</MBean>
# Hazelcast statistic JMX configuration
<MBean "com.hazelcast/HazelcastInstance.OperationService.hazelcast.operationServicehazelcast">
ObjectName "com.hazelcast:instance=confluence,name=operationServiceconfluence,type=HazelcastInstance.OperationService"
InstancePrefix "confluence-Hazelcast-OperationService"
<Value>
Type "derive"
InstancePrefix "executedOperationCount"
Attribute "executedOperationCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "operationThreadCount"
Attribute "operationThreadCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "remoteOperationCount"
Attribute "remoteOperationCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "responseQueueSize"
Attribute "responseQueueSize"
</Value>
<Value>
Type "gauge"
InstancePrefix "runningOperationsCount"
Attribute "runningOperationsCount"
</Value>
</MBean>
<MBean "com.hazelcast/HazelcastInstance.EventService.hazelcast.hazelcast">
ObjectName "com.hazelcast:instance=confluence,name=confluence,type=HazelcastInstance.EventService"
InstancePrefix "confluence-Hazelcast-EventService"
<Value>
Type "gauge"
InstancePrefix "eventThreadCount"
Attribute "eventThreadCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "eventQueueCapacity"
Attribute "eventQueueCapacity"
</Value>
<Value>
Type "gauge"
InstancePrefix "eventQueueSize"
Attribute "eventQueueSize"
</Value>
</MBean>
<MBean "com.atlassian.confluence/HibernateStatistics">
ObjectName "Confluence:name=HibernateStatistics"
InstancePrefix "confluence-HibernateStatistics"
<Value>
Type "gauge"
InstancePrefix "CloseStatementCount"
Attribute "CloseStatementCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "CollectionFetchCount"
Attribute "CollectionFetchCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "CollectionLoadCount"
Attribute "CollectionLoadCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "CollectionRecreateCount"
Attribute "CollectionRecreateCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "CollectionRemoveCount"
Attribute "CollectionRemoveCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "CollectionUpdateCount"
Attribute "CollectionUpdateCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "ConnectCount"
Attribute "ConnectCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "EntityDeleteCount"
Attribute "EntityDeleteCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "EntityFetchCount"
Attribute "EntityFetchCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "EntityInsertCount"
Attribute "EntityInsertCount"
</Value>
<Value>
Type "gauge"
InstancePrefix "EntityLoadCount"
Attribute "EntityLoadCount"
</Value>
# fqname = org.hibernate.core/#EntityUpdateCount
<Value>
Type "gauge"
InstancePrefix "EntityUpdateCount"
Attribute "EntityUpdateCount"
</Value>
# fqname = org.hibernate.core/#FlushCount
<Value>
Type "gauge"
InstancePrefix "FlushCount"
Attribute "FlushCount"
</Value>
# fqname = org.hibernate.core/#NaturalIdCacheHitCount
<Value>
Type "gauge"
InstancePrefix "NaturalIdCacheHitCount"
Attribute "NaturalIdCacheHitCount"
</Value>
# fqname = org.hibernate.core/#NaturalIdCacheMissCount
<Value>
Type "gauge"
InstancePrefix "NaturalIdCacheMissCount"
Attribute "NaturalIdCacheMissCount"
</Value>
# fqname = org.hibernate.core/#NaturalIdCachePutCount
<Value>
Type "gauge"
InstancePrefix "NaturalIdCachePutCount"
Attribute "NaturalIdCachePutCount"
</Value>
# fqname = org.hibernate.core/#NaturalIdQueryExecutionCount
<Value>
Type "gauge"
InstancePrefix "NaturalIdQueryExecutionCount"
Attribute "NaturalIdQueryExecutionCount"
</Value>
# fqname = org.hibernate.core/#NaturalIdQueryExecutionMaxTime
<Value>
Type "gauge"
InstancePrefix "NaturalIdQueryExecutionMaxTime"
Attribute "NaturalIdQueryExecutionMaxTime"
</Value>
# fqname = org.hibernate.core/#OptimisticFailureCount
<Value>
Type "gauge"
InstancePrefix "OptimisticFailureCount"
Attribute "OptimisticFailureCount"
</Value>
# fqname = org.hibernate.core/#PrepareStatementCount
<Value>
Type "gauge"
InstancePrefix "PrepareStatementCount"
Attribute "PrepareStatementCount"
</Value>
# fqname = org.hibernate.core/#QueryCacheHitCount
<Value>
Type "gauge"
InstancePrefix "QueryCacheHitCount"
Attribute "QueryCacheHitCount"
</Value>
# fqname = org.hibernate.core/#QueryCacheMissCount
<Value>
Type "gauge"
InstancePrefix "QueryCacheMissCount"
Attribute "QueryCacheMissCount"
</Value>
# fqname = org.hibernate.core/#QueryCachePutCount
<Value>
Type "gauge"
InstancePrefix "QueryCachePutCount"
Attribute "QueryCachePutCount"
</Value>
# fqname = org.hibernate.core/#QueryExecutionCount
<Value>
Type "gauge"
InstancePrefix "QueryExecutionCount"
Attribute "QueryExecutionCount"
</Value>
# fqname = org.hibernate.core/#QueryExecutionMaxTime
<Value>
Type "gauge"
InstancePrefix "QueryExecutionMaxTime"
Attribute "QueryExecutionMaxTime"
</Value>
# fqname = org.hibernate.core/#SecondLevelCacheHitCount
<Value>
Type "gauge"
InstancePrefix "SecondLevelCacheHitCount"
Attribute "SecondLevelCacheHitCount"
</Value>
# fqname = org.hibernate.core/#SecondLevelCacheMissCount
<Value>
Type "gauge"
InstancePrefix "SecondLevelCacheMissCount"
Attribute "SecondLevelCacheMissCount"
</Value>
# fqname = org.hibernate.core/#SecondLevelCachePutCount
<Value>
Type "gauge"
InstancePrefix "SecondLevelCachePutCount"
Attribute "SecondLevelCachePutCount"
</Value>
# fqname = org.hibernate.core/#SessionCloseCount
<Value>
Type "gauge"
InstancePrefix "SessionCloseCount"
Attribute "SessionCloseCount"
</Value>
# fqname = org.hibernate.core/#TransactionCount
<Value>
Type "gauge"
InstancePrefix "TransactionCount"
Attribute "TransactionCount"
</Value>
# fqname = org.hibernate.core/#UpdateTimestampsCacheHitCount
<Value>
Type "gauge"
InstancePrefix "UpdateTimestampsCacheHitCount"
Attribute "UpdateTimestampsCacheHitCount"
</Value>
# fqname = org.hibernate.core/#UpdateTimestampsCacheMissCount
<Value>
Type "gauge"
InstancePrefix "UpdateTimestampsCacheMissCount"
Attribute "UpdateTimestampsCacheMissCount"
</Value>
# fqname = org.hibernate.core/#UpdateTimestampsCachePutCount
<Value>
Type "gauge"
InstancePrefix "UpdateTimestampsCachePutCount"
Attribute "UpdateTimestampsCachePutCount"
</Value>
</MBean>
# C3P0 Connection pool JMX Configuration
<MBean "com.mchange.v2.c3p0/PooledDataSource">
ObjectName "com.mchange.v2.c3p0:type=PooledDataSource,*"
InstancePrefix "confluence-c3p0-PooledDataSource"
<Value>
Type "gauge"
InstancePrefix "numBusyConnections"
Attribute "numBusyConnections"
</Value>
<Value>
Type "gauge"
InstancePrefix "numIdleConnections"
Attribute "numIdleConnections"
</Value>
<Value>
Type "gauge"
InstancePrefix "threadPoolNumIdleThreads"
Attribute "threadPoolNumIdleThreads"
</Value>
<Value>
Type "gauge"
InstancePrefix "numConnections"
Attribute "numConnections"
</Value>
</MBean>
# Apache Tomcat JMX configuration
<MBean "catalina/global_request_processor">
ObjectName "*:type=GlobalRequestProcessor,*"
InstancePrefix "catalina_request_processor-"
InstanceFrom "name"
<Value>
Type "io_octets"
InstancePrefix "global"
#InstanceFrom ""
Table false
Attribute "bytesReceived"
Attribute "bytesSent"
</Value>
<Value>
Type "total_requests"
InstancePrefix "global"
#InstanceFrom ""
Table false
Attribute "requestCount"
</Value>
<Value>
Type "total_time_in_ms"
InstancePrefix "global-processing"
#InstanceFrom ""
Table false
Attribute "processingTime"
</Value>
</MBean>
<MBean "catalina/detailed_request_processor">
ObjectName "*:type=RequestProcessor,*"
InstancePrefix "catalina_request_processor-"
InstanceFrom "worker"
<Value>
Type "io_octets"
#InstancePrefix ""
InstanceFrom "name"
Table false
Attribute "bytesReceived"
Attribute "bytesSent"
</Value>
<Value>
Type "total_requests"
#InstancePrefix ""
InstanceFrom "name"
Table false
Attribute "requestCount"
</Value>
<Value>
Type "total_time_in_ms"
InstancePrefix "processing-"
InstanceFrom "name"
Table false
Attribute "processingTime"
</Value>
</MBean>
<MBean "catalina/thread_pool">
ObjectName "*:type=ThreadPool,*"
InstancePrefix "request_processor-"
InstanceFrom "name"
<Value>
Type "threads"
InstancePrefix "total"
#InstanceFrom ""
Table false
Attribute "currentThreadCount"
</Value>
<Value>
Type "threads"
InstancePrefix "running"
#InstanceFrom ""
Table false
Attribute "currentThreadsBusy"
</Value>
</MBean>
# General JVM configuration
<MBean "memory">
ObjectName "java.lang:type=Memory,*"
InstancePrefix "java_memory"
#InstanceFrom "name"
<Value>
Type "memory"
InstancePrefix "heap-"
#InstanceFrom ""
Table true
Attribute "HeapMemoryUsage"
</Value>
<Value>
Type "memory"
InstancePrefix "nonheap-"
#InstanceFrom ""
Table true
Attribute "NonHeapMemoryUsage"
</Value>
</MBean>
<MBean "memory_pool">
ObjectName "java.lang:type=MemoryPool,*"
InstancePrefix "java_memory_pool-"
InstanceFrom "name"
<Value>
Type "memory"
#InstancePrefix ""
#InstanceFrom ""
Table true
Attribute "Usage"
</Value>
</MBean>
<MBean "classes">
ObjectName "java.lang:type=ClassLoading"
InstancePrefix "java"
#InstanceFrom ""
<Value>
Type "gauge"
InstancePrefix "loaded_classes"
#InstanceFrom ""
Table false
Attribute "LoadedClassCount"
</Value>
</MBean>
<MBean "compilation">
ObjectName "java.lang:type=Compilation"
InstancePrefix "java"
#InstanceFrom ""
<Value>
Type "total_time_in_ms"
InstancePrefix "compilation_time"
#InstanceFrom ""
Table false
Attribute "TotalCompilationTime"
</Value>
</MBean>
<MBean "garbage_collector">
ObjectName "java.lang:type=GarbageCollector,*"
InstancePrefix "java_gc-"
InstanceFrom "name"
<Value>
Type "invocations"
#InstancePrefix ""
#InstanceFrom ""
Table false
Attribute "CollectionCount"
</Value>
<Value>
Type "total_time_in_ms"
InstancePrefix "collection_time"
#InstanceFrom ""
Table false
Attribute "CollectionTime"
</Value>
</MBean>
<MBean "jvm_localhost_os">
ObjectName "java.lang:type=OperatingSystem"
# Open file descriptors
<Value>
Type "gauge"
InstancePrefix "os-open_fd_count"
Table false
Attribute "OpenFileDescriptorCount"
</Value>
# Max. allowed handles for user under which the JavaVM is running
<Value>
Type "gauge"
InstancePrefix "os-max_fd_count"
Table false
Attribute "MaxFileDescriptorCount"
</Value>
# Process time used by the JavaVM
<Value>
Type "counter"
InstancePrefix "os-process_cpu_time"
Table false
Attribute "ProcessCpuTime"
</Value>
</MBean>
<Connection>
#Host "localhost"
ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:9999/jmxrmi"
User "monitorRole"
# Confluence
Collect "confluence/IndexingStatistics"
Collect "confluence/MailTaskQueue"
Collect "confluence/RequestMetrics"
Collect "confluence/SystemInformation"
# Hazelcast
Collect "com.hazelcast/HazelcastInstance.OperationService.hazelcast.operationServicehazelcast"
Collect "com.hazelcast/HazelcastInstance.EventService.hazelcast.hazelcast"
# Hibernate
Collect "com.atlassian.confluence/HibernateStatistics"
# C3P0
Collect "com.mchange.v2.c3p0/PooledDataSource"
# Tomcat
Collect "catalina/global_request_processor"
Collect "catalina/detailed_request_processor"
Collect "catalina/thread_pool"
# JVM
Collect "memory"
Collect "memory_pool"
Collect "classes"
Collect "compilation"
Collect "garbage_collector"
Collect "jvm_localhost_os"
</Connection>
</Plugin>
</Plugin> </Plugin>

View File

@@ -1,7 +0,0 @@
---
# Values taken from https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-to-an-azure-sql-database
# Windows values are milliseconds, Linux values are seconds
sysctl_config:
net.ipv4.tcp_keepalive_time: 30
net.ipv4.tcp_keepalive_intvl: 1
net.ipv6.tcp_keepalive_probes: 10

View File

@@ -19,15 +19,3 @@
atl_cluster_node_id: "{{ az_vm_id.stdout }}" atl_cluster_node_id: "{{ az_vm_id.stdout }}"
tags: tags:
- runtime_pkg - runtime_pkg
- name: Tune TCP Keep Alive
sysctl:
name: '{{ item.key }}'
value: '{{ item.value }}'
reload: yes
ignoreerrors: yes
sysctl_file: /etc/sysctl.conf
sysctl_set: yes
with_dict: '{{ sysctl_config }}'
tags:
- runtime_pkg

View File

@@ -1,5 +1,11 @@
--- ---
- debug:
msg: atl_db_engine {{ atl_db_engine }}
- debug:
msg: atl_dbms {{ atl_dbms }}
- name: Create application directories - name: Create application directories
file: file:
path: "{{ item }}" path: "{{ item }}"

View File

@@ -51,7 +51,7 @@
lineinfile: lineinfile:
path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh" path: "{{ atl_product_installation_versioned }}/apache-tomcat/bin/setenv.sh"
insertafter: "EOF" insertafter: "EOF"
line: "export JAVA_HOME={{ java_home | default('/usr/lib/jvm/jre-{{ java_version }}-openjdk')}}" line: "export JAVA_HOME={{ java_home | default('/usr/lib/jvm/jre-{{ java_version }}-openjdk') }}"
- name: Create application directories - name: Create application directories
file: file:
@@ -139,8 +139,8 @@
xpath: "/application-configuration/properties/property[@name='hibernate.connection.url']" xpath: "/application-configuration/properties/property[@name='hibernate.connection.url']"
value: "{{ atl_jdbc_url }}?reWriteBatchedInserts=true" value: "{{ atl_jdbc_url }}?reWriteBatchedInserts=true"
when: crowd_cfg_stat_result.stat.exists when: crowd_cfg_stat_result.stat.exists
- name: Remove crowd.xml to prevent duplicates from appearing in cluster reporting - name: Remove crowd.xml to prevent duplicates from appearing in cluster reporting
file: file:
path: "{{ atl_product_installation_versioned }}/apache-tomcat/conf/Catalina/localhost/crowd.xml" path: "{{ atl_product_installation_versioned }}/apache-tomcat/conf/Catalina/localhost/crowd.xml"
state: absent state: absent

View File

@@ -4,10 +4,6 @@
shutdown="SHUTDOWN"> shutdown="SHUTDOWN">
<Service name="Catalina"> <Service name="Catalina">
<!-- Add the SSL properties when the load balancer is configured
secure="{{ atl_tomcat_secure }}"
scheme="{{ atl_tomcat_scheme }}"
-->
<Connector acceptCount="{{ atl_tomcat_acceptcount }}" <Connector acceptCount="{{ atl_tomcat_acceptcount }}"
connectionTimeout="{{ atl_tomcat_connectiontimeout }}" connectionTimeout="{{ atl_tomcat_connectiontimeout }}"
disableUploadTimeout="true" disableUploadTimeout="true"
@@ -22,8 +18,14 @@
compression="on" compression="on"
sendReasonPhrase="true" sendReasonPhrase="true"
compressableMimeType="text/html,text/xml,application/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript" compressableMimeType="text/html,text/xml,application/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript"
proxyName="{{ atl_proxy_name }}" secure="{{ atl_tomcat_secure }}"
proxyPort="{{ atl_proxy_port }}" 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 %}
protocol="{{ atl_tomcat_protocol }}"> protocol="{{ atl_tomcat_protocol }}">
</Connector> </Connector>
@@ -50,6 +52,7 @@
redirectPort="{{ atl_tomcat_redirectport }}" redirectPort="{{ atl_tomcat_redirectport }}"
protocol=""AJP/1.3"" /> protocol=""AJP/1.3"" />
--> -->
{% if atl_tomcat_redirectport is defined and atl_tomcat_redirectport != '' %}
<Connector port="{{ atl_tomcat_redirectport }}" <Connector port="{{ atl_tomcat_redirectport }}"
protocol="{{ atl_tomcat_protocol }}" protocol="{{ atl_tomcat_protocol }}"
relaxedPathChars="[]|" relaxedPathChars="[]|"
@@ -61,6 +64,7 @@
compression="on" compression="on"
compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript"> compressableMimeType="text/html,text/xml,text/plain,text/css,application/json,application/javascript,application/x-javascript">
</Connector> </Connector>
{% endif %}
</Service> </Service>
<!-- Security listener. Documentation at /docs/config/listeners.html <!-- Security listener. Documentation at /docs/config/listeners.html

View File

@@ -6,4 +6,11 @@ atl_db_root_user: 'postgres'
atl_jdbc_encoding: 'UTF-8' atl_jdbc_encoding: 'UTF-8'
atl_jdbc_collation: 'C' atl_jdbc_collation: 'C'
atl_jdbc_ctype: 'C' atl_jdbc_ctype: 'C'
atl_jdbc_template: 'template1' atl_jdbc_template: 'template1'
# Values taken from https://docs.microsoft.com/en-us/sql/connect/jdbc/connecting-to-an-azure-sql-database
# Windows values are milliseconds, Linux values are seconds
sysctl_config:
net.ipv4.tcp_keepalive_time: 30
net.ipv4.tcp_keepalive_intvl: 1
net.ipv6.tcp_keepalive_probes: 10

View File

@@ -1,76 +1,4 @@
- name: Create application DB user ---
postgresql_user:
db: "{{ atl_db_root_db_name }}"
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
login_db: "{{ atl_db_root_db_name }}"
port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_user }}"
password: "{{ atl_jdbc_password }}"
expires: 'infinity'
ssl_mode: 'require'
- name: Collect dbcluster db_names - name: Perform Database Setup
postgresql_query: include_tasks: "{{ atl_dbms }}_init.yml"
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_db_root_db_name }}"
query: "SELECT datname FROM pg_database;"
register: dbcluster_db_names
- block:
- name: Update root privs for new user
postgresql_privs:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
database: postgres
roles: "{{ atl_db_root_user }}"
objs: "{{ atl_jdbc_user }}"
type: group
# RDS does not allow changing the collation on an existing DB, it only allows collation change on creation of db. If the db already exists, we need the “create new application database” task to be skipped, idempotence can not be relied upon as we cant be certain the collation of the existing db
- name: Create new application database
postgresql_db:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_db_name }}"
owner: "{{ atl_jdbc_user }}"
encoding: "{{ atl_jdbc_encoding }}"
lc_collate: "{{ atl_jdbc_collation }}"
lc_ctype: "{{ atl_jdbc_ctype }}"
template: "{{ atl_jdbc_template }}"
register: db_created
when: "atl_jdbc_db_name not in (dbcluster_db_names.query_result | map(attribute='datname') )"
tags:
- new_only
- name: Assert ownership of public schema
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: "ALTER SCHEMA public OWNER to {{ atl_db_root_user }};"
- name: Grant privs to root user on public schema
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: "GRANT ALL ON SCHEMA public TO {{ atl_db_root_user }};"
- name: Grant privs to application user on public schema
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: "GRANT ALL ON SCHEMA public TO {{ atl_jdbc_user }};"

View File

@@ -0,0 +1,76 @@
- name: Create application DB user
postgresql_user:
db: "{{ atl_db_root_db_name }}"
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
login_db: "{{ atl_db_root_db_name }}"
port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_user }}"
password: "{{ atl_jdbc_password }}"
expires: 'infinity'
ssl_mode: 'require'
- name: Collect dbcluster db_names
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_db_root_db_name }}"
query: "SELECT datname FROM pg_database;"
register: dbcluster_db_names
- block:
- name: Update root privs for new user
postgresql_privs:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
database: postgres
roles: "{{ atl_db_root_user }}"
objs: "{{ atl_jdbc_user }}"
type: group
# RDS does not allow changing the collation on an existing DB, it only allows collation change on creation of db. If the db already exists, we need the “create new application database” task to be skipped, idempotence can not be relied upon as we cant be certain the collation of the existing db
- name: Create new application database
postgresql_db:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
port: "{{ atl_db_port }}"
name: "{{ atl_jdbc_db_name }}"
owner: "{{ atl_jdbc_user }}"
encoding: "{{ atl_jdbc_encoding }}"
lc_collate: "{{ atl_jdbc_collation }}"
lc_ctype: "{{ atl_jdbc_ctype }}"
template: "{{ atl_jdbc_template }}"
register: db_created
when: "atl_jdbc_db_name not in (dbcluster_db_names.query_result | map(attribute='datname') )"
tags:
- new_only
- name: Assert ownership of public schema
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: "ALTER SCHEMA public OWNER to {{ atl_db_root_user }};"
- name: Grant privs to root user on public schema
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: "GRANT ALL ON SCHEMA public TO {{ atl_db_root_user }};"
- name: Grant privs to application user on public schema
postgresql_query:
login_host: "{{ atl_db_host }}"
login_user: "{{ atl_db_root_user_login }}"
login_password: "{{ atl_db_root_password }}"
db: "{{ atl_jdbc_db_name }}"
query: "GRANT ALL ON SCHEMA public TO {{ atl_jdbc_user }};"

View File

@@ -0,0 +1,52 @@
- name: Add an Apt signing key for MS Packages
apt_key:
url: https://packages.microsoft.com/keys/microsoft.asc
state: present
- name: Add MS repository into sources list.
apt_repository:
repo: deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main
state: present
- name: Install SQL Server utils
apt:
name: mssql-tools
update_cache: yes
environment:
ACCEPT_EULA: Y
- name: Create sqlcmd symbolic link
file:
src: /opt/mssql-tools/bin/sqlcmd
dest: /usr/bin/sqlcmd
state: link
- name: Create SQL Server DB login
shell: "sqlcmd -S {{ atl_db_host }} -U {{ atl_db_root_user }} -P {{ atl_db_root_password }} -Q \"CREATE LOGIN {{ atl_jdbc_user }} WITH PASSWORD = '{{ atl_jdbc_password }}'\""
- name: Create SQL Server DB user
shell: "sqlcmd -S {{ atl_db_host }} -U {{ atl_db_root_user }} -P {{ atl_db_root_password }} -Q \"CREATE USER {{ atl_jdbc_user }} FOR LOGIN {{ atl_jdbc_user }}\""
- name: Create new SQL Server application database
shell: "sqlcmd -S {{ atl_db_host }} -U {{ atl_db_root_user }} -P {{ atl_db_root_password }} -Q \"IF NOT EXISTS (SELECT name FROM master.sys.databases WHERE name = N'{{ atl_jdbc_db_name }}') CREATE DATABASE {{ atl_jdbc_db_name }} COLLATE {{ atl_db_sql_collation }}\""
- name: Create SQL Server DB user on application database
shell: "sqlcmd -S {{ atl_db_host }} -U {{ atl_db_root_user }} -P {{ atl_db_root_password }} -d {{ atl_jdbc_db_name }} -Q \"CREATE USER {{ atl_jdbc_user }} FOR LOGIN {{ atl_jdbc_user }}\""
- name: Update db_owner role for new user on application database
shell: "sqlcmd -S {{ atl_db_host }} -U {{ atl_db_root_user }} -P {{ atl_db_root_password }} -d {{ atl_jdbc_db_name }} -Q \"ALTER ROLE db_owner ADD MEMBER {{ atl_jdbc_user }}\""
- name: Update isolation level on application database
shell: "sqlcmd -S {{ atl_db_host }} -U {{ atl_db_root_user }} -P {{ atl_db_root_password }} -Q \"ALTER DATABASE {{ atl_jdbc_db_name }} SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK IMMEDIATE\""
- name: Tune TCP Keep Alive
sysctl:
name: '{{ item.key }}'
value: '{{ item.value }}'
reload: yes
ignoreerrors: yes
sysctl_file: /etc/sysctl.conf
sysctl_set: yes
with_dict: '{{ sysctl_config }}'
tags:
- runtime_pkg