Skip to content

Commit 5f0e931

Browse files
committed
Make dbconfig.xml use JIRA built-in defaults when not overridden by user
This removes the use_connection_pooling parameter since for most databases, it does nothing useful. It also sets most parameters to "undef" and omits them from the configuration if the user doesn't override them. The previous module defaults mostly match JIRA's built-in ones anyway.
1 parent bca4365 commit 5f0e931

9 files changed

Lines changed: 88 additions & 179 deletions

README.md

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -270,64 +270,59 @@ NOTE: Atlassian only supports Oracle 11g/12g, even so this value should be as do
270270

271271
Set the schema
272272

273-
The Default value is 'public'
274-
275-
##### `$poolsize`
276-
277-
The connection pool size to the database, defaults to 20
273+
The default value is 'public' for PostgreSQL, and undef for others
278274

279275
##### `$dburl`
280276

281277
This parameter is not required nor do we recommend setting it. However it can be
282278
used to customize the database connection string.
283279

284-
##### `$enable_connection_pooling`
280+
##### `$pool_max_size`
285281

286-
Configure database settings if you are pooling connections, defaults to 'false'
282+
Setting most of the advanced JDBC parameters is not required unless you want to tune JIRA
283+
settings.
287284

288-
##### `$pool_min_size`
285+
defaults to undef
289286

290-
defaults to 20 (requires `enable_connection_pooling => true`)
291-
292-
##### `$pool_max_size`
287+
##### `$pool_min_size`
293288

294-
defaults to 20 (requires `enable_connection_pooling => true`)
289+
defaults to undef
295290

296291
##### `$pool_max_wait`
297292

298-
defaults to 30000 (requires `enable_connection_pooling => true`)
293+
defaults to undef
299294

300295
##### `$validation_query`
301296

302-
defaults to undef (requires `enable_connection_pooling => true`)
297+
defaults to undef
303298

304299
##### `$min_evictable_idle_time`
305300

306-
defaults to 60000 (requires `enable_connection_pooling => true`)
301+
defaults to undef
307302

308303
##### `$time_between_eviction_runs`
309304

310-
defaults to undef (requires `enable_connection_pooling => true`)
305+
defaults to undef
311306

312307
##### `$pool_max_idle`
313308

314-
defaults to 20 (requires `enable_connection_pooling => true`)
309+
defaults to undef
315310

316311
##### `$pool_remove_abandoned`
317312

318-
defaults to true (requires `enable_connection_pooling => true`)
313+
defaults to undef
319314

320315
##### `$pool_remove_abandoned_timeout`
321316

322-
defaults to 300 (requires `enable_connection_pooling => true`)
317+
defaults to undef
323318

324319
##### `$pool_test_while_idle`
325320

326-
defaults to true (requires `enable_connection_pooling => true`)
321+
defaults to undef
327322

328323
##### `$pool_test_on_borrow`
329324

330-
defaults to false (requires `enable_connection_pooling => true`)
325+
defaults to undef
331326

332327
#### MySQL Java Connector parameters
333328

@@ -666,7 +661,6 @@ jira::jvm_xms: '1G'
666661
jira::jvm_xmx: '3G'
667662
jira::jvm_permgen: '384m'
668663
jira::service_manage: false
669-
jira::enable_connection_pooling: 'true'
670664
jira::env:
671665
- 'http_proxy=proxy.example.co.za:8080'
672666
- 'https_proxy=proxy.example.co.za:8080'

manifests/config.pp

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,14 @@
1919
group => $jira::group,
2020
}
2121

22-
if $jira::validation_query == undef {
23-
$validation_query = $jira::db ? {
24-
'postgresql' => 'select version();',
25-
'mysql' => 'select 1',
26-
'oracle' => 'select 1 from dual',
27-
'sqlserver' => 'select 1',
28-
'h2' => 'select 1',
29-
}
30-
}
31-
if $jira::time_between_eviction_runs == undef {
32-
$time_between_eviction_runs = $jira::db ? {
33-
'postgresql' => '30000',
34-
'mysql' => '300000',
35-
'oracle' => '300000',
36-
'sqlserver' => '300000',
37-
'h2' => '5000',
38-
}
22+
$dbschema_default = $jira::db ? {
23+
'postgresql' => 'public',
24+
default => undef
3925
}
4026

27+
# can't use pick_default: https://tickets.puppetlabs.com/browse/MODULES-11018
28+
$dbschema = if $jira::dbschema { $jira::dbschema } else { $dbschema_default }
29+
4130
file { "${jira::webappdir}/bin/user.sh":
4231
content => template('jira/user.sh.erb'),
4332
mode => '0755',
@@ -56,7 +45,7 @@
5645
}
5746

5847
-> file { "${jira::homedir}/dbconfig.xml":
59-
content => template("jira/dbconfig.${jira::db}.xml.erb"),
48+
content => epp('jira/dbconfig.xml.epp'),
6049
mode => '0600',
6150
require => [Class['jira::install'],File[$jira::homedir]],
6251
notify => Class['jira::service'],

manifests/init.pp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,26 @@
6262
Optional[String] $dbdriver = undef,
6363
Optional[String] $dbtype = undef,
6464
Optional[String] $dburl = undef,
65-
$poolsize = '20',
66-
$dbschema = 'public',
65+
$dbschema = undef,
6766
# MySQL Connector Settings
6867
$mysql_connector_manage = true,
6968
$mysql_connector_version = '5.1.34',
7069
$mysql_connector_product = 'mysql-connector-java',
7170
$mysql_connector_format = 'tar.gz',
7271
Stdlib::Absolutepath $mysql_connector_install = '/opt/MySQL-connector',
7372
Stdlib::HTTPUrl $mysql_connector_url = 'https://dev.mysql.com/get/Downloads/Connector-J',
74-
# Configure database settings if you are pooling connections
75-
$enable_connection_pooling = false,
76-
$pool_min_size = 20,
77-
$pool_max_size = 20,
78-
$pool_max_wait = 30000,
73+
$pool_min_size = undef,
74+
$pool_max_size = undef,
75+
$pool_max_wait = undef,
7976
$validation_query = undef,
80-
$min_evictable_idle_time = 60000,
77+
Optional[Integer[0]] $validation_query_timeout = undef,
78+
$min_evictable_idle_time = undef,
8179
$time_between_eviction_runs = undef,
82-
$pool_max_idle = 20,
83-
$pool_remove_abandoned = true,
84-
$pool_remove_abandoned_timeout = 300,
85-
$pool_test_while_idle = true,
86-
$pool_test_on_borrow = false,
80+
$pool_max_idle = undef,
81+
$pool_remove_abandoned = undef,
82+
$pool_remove_abandoned_timeout = undef,
83+
$pool_test_while_idle = undef,
84+
$pool_test_on_borrow = undef,
8785
# JVM Settings
8886
$javahome = undef,
8987
Jira::Jvm_types $jvm_type = 'openjdk-11',

templates/dbconfig.h2.xml.erb

Lines changed: 0 additions & 23 deletions
This file was deleted.

templates/dbconfig.mysql.xml.erb

Lines changed: 0 additions & 26 deletions
This file was deleted.

templates/dbconfig.oracle.xml.erb

Lines changed: 0 additions & 24 deletions
This file was deleted.

templates/dbconfig.postgresql.xml.erb

Lines changed: 0 additions & 28 deletions
This file was deleted.

templates/dbconfig.sqlserver.xml.erb

Lines changed: 0 additions & 25 deletions
This file was deleted.

templates/dbconfig.xml.epp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<%# Some default are set in jira::config based on DB -%>
4+
<jira-database-config>
5+
<name>defaultDS</name>
6+
<delegator-name>default</delegator-name>
7+
<database-type><%= $jira::dbtype_real %></database-type>
8+
<% if $jira::config::dbschema != undef { -%>
9+
<schema-name><%= $jira::config::dbschema %></schema-name>
10+
<% } -%>
11+
<jdbc-datasource>
12+
<url><%= $jira::dburl_real %></url>
13+
<driver-class><%= $jira::dbdriver_real %></driver-class>
14+
<username><%= $jira::dbuser %></username>
15+
<password><%= $jira::dbpassword %></password>
16+
<%# For most of these, Jira defaults are better... -%>
17+
<% if $jira::pool_min_size != undef { -%>
18+
<pool-min-size><%= $jira::pool_min_size %></pool-min-size>
19+
<% } -%>
20+
<% if $jira::pool_max_size != undef { -%>
21+
<pool-max-size><%= $jira::pool_max_size %></pool-max-size>
22+
<% } -%>
23+
<% if $jira::pool_max_idle != undef { -%>
24+
<pool-max-idle><%= $jira::pool_max_idle %></pool-max-idle>
25+
<% } -%>
26+
<% if $jira::pool_max_wait != undef { -%>
27+
<pool-max-wait><%= $jira::pool_max_wait %></pool-max-wait>
28+
<% } -%>
29+
<% if $jira::min_evictable_idle_time != undef { -%>
30+
<min-evictable-idle-time-millis><%= $jira::min_evictable_idle_time %></min-evictable-idle-time-millis>
31+
<% } -%>
32+
<% if $jira::pool_remove_abandoned != undef { -%>
33+
<pool-remove-abandoned><%= $jira::pool_remove_abandoned %></pool-remove-abandoned>
34+
<% } -%>
35+
<% if $jira::pool_remove_abandoned_timeout != undef { -%>
36+
<pool-remove-abandoned-timeout><%= $jira::pool_remove_abandoned_timeout %></pool-remove-abandoned-timeout>
37+
<% } -%>
38+
<% if $jira::pool_test_while_idle != undef { -%>
39+
<pool-test-while-idle><%= $jira::pool_test_while_idle %></pool-test-while-idle>
40+
<% } -%>
41+
<% if $jira::pool_test_on_borrow != undef { -%>
42+
<pool-test-on-borrow><%= $jira::pool_test_on_borrow %></pool-test-on-borrow>
43+
<% } -%>
44+
<% if $jira::validation_query != undef { -%>
45+
<validation-query><%= $jira::validation_query %></validation-query>
46+
<% } -%>
47+
<% if $jira::validation_query_timeout != undef { -%>
48+
<validation-query-timeout><%= $jira::validation_query_timeout %></validation-query-timeout>
49+
<% } -%>
50+
<% if $jira::time_between_eviction_runs != undef { -%>
51+
<time-between-eviction-runs-millis><%= $jira::time_between_eviction_runs %></time-between-eviction-runs-millis>
52+
<% } -%>
53+
</jdbc-datasource>
54+
</jira-database-config>

0 commit comments

Comments
 (0)