Skip to content

Commit 8a122ab

Browse files
authored
Refactor database configuration and make the main API typed (voxpupuli#352)
Unify dbconfig.xml across databases and use JIRA's built-in defaults when not overridden by user This removes the use_connection_pooling parameter since for most databases, it does nothing useful. The poolsize parameter is also deprecated, and is just an alias for pool_max_size now It also sets the default values for 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. While here, add types to the main API; some things which accepted integer-looking strings previously will now require actual integers, but otherwise nothing changes.
1 parent 94fb51e commit 8a122ab

17 files changed

Lines changed: 169 additions & 247 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'

examples/jira_mysql_install.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
-> class { 'jira':
1414
javahome => '/opt/java/latest',
1515
db => 'mysql',
16-
dbport => '3306',
16+
dbport => 3306,
1717
dbdriver => 'com.mysql.jdbc.Driver',
1818
dbtype => 'mysql',
1919
}

examples/jira_mysql_nativessl_install.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131

3232
java_ks { 'jira':
33-
ensure => present,
33+
ensure => 'present',
3434
name => 'jira',
3535
certificate => '/etc/ssl/jira_cert.pem',
3636
private_key => '/etc/ssl/jira_key.pem',

examples/jira_postgres_install.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
node default {
22
class { 'postgresql::globals':
33
manage_package_repo => true,
4-
version => '9.3',
4+
version => '11',
55
}
66

77
-> class { 'postgresql::server': }

examples/jira_postgres_nginx_install.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
-> class { 'postgresql::globals':
55
manage_package_repo => true,
6-
version => '9.3',
6+
version => '11',
77
}
88

99
-> class { 'postgresql::server': }
@@ -18,7 +18,7 @@
1818
proxy => {
1919
scheme => 'http',
2020
proxyName => $facts['networking']['fqdn'],
21-
proxyPort => '80',
21+
proxyPort => 80,
2222
},
2323
}
2424

examples/jira_postgres_nginx_ssl_install.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
-> class { 'postgresql::globals':
55
manage_package_repo => true,
6-
version => '9.3',
6+
version => '11',
77
}
88

99
-> class { 'postgresql::server': }
@@ -18,7 +18,7 @@
1818
proxy => {
1919
scheme => 'https',
2020
proxyName => $facts['networking']['fqdn'],
21-
proxyPort => '443',
21+
proxyPort => 443,
2222
},
2323
}
2424

jira.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ jira::dbschema: 'public'
6565
# Default for mssql
6666
#jira::dbschema: 'dbo'
6767

68-
# The connection pool size
69-
jira::poolsize: 20
70-
jira::enable_connection_pooling: false
68+
# The connection pool parameters
7169
jira::pool_min_size: 20
7270
jira::pool_max_size: 20
7371
jira::pool_max_wait: 30000
@@ -102,8 +100,8 @@ jira::service_ensure: running
102100
jira::service_enable: true
103101

104102
# Tomcat settings
105-
jira::tomcat_max_threads: '150'
106-
jira::tomcat_accept_count: '100'
103+
jira::tomcat_max_threads: 150
104+
jira::tomcat_accept_count: 100
107105

108106
# Configure reverse ssl proxy
109107
jira::proxy:

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'],

0 commit comments

Comments
 (0)