Skip to content

Commit

Permalink
Refactor database configuration and make the main API typed (voxpupul…
Browse files Browse the repository at this point in the history
…i#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.
  • Loading branch information
oranenj authored Apr 13, 2021
1 parent bca4365 commit ec85b18
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 247 deletions.
38 changes: 16 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,64 +270,59 @@ NOTE: Atlassian only supports Oracle 11g/12g, even so this value should be as do

Set the schema

The Default value is 'public'

##### `$poolsize`

The connection pool size to the database, defaults to 20
The default value is 'public' for PostgreSQL, and undef for others

##### `$dburl`

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

##### `$enable_connection_pooling`
##### `$pool_max_size`

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

##### `$pool_min_size`
defaults to undef

defaults to 20 (requires `enable_connection_pooling => true`)

##### `$pool_max_size`
##### `$pool_min_size`

defaults to 20 (requires `enable_connection_pooling => true`)
defaults to undef

##### `$pool_max_wait`

defaults to 30000 (requires `enable_connection_pooling => true`)
defaults to undef

##### `$validation_query`

defaults to undef (requires `enable_connection_pooling => true`)
defaults to undef

##### `$min_evictable_idle_time`

defaults to 60000 (requires `enable_connection_pooling => true`)
defaults to undef

##### `$time_between_eviction_runs`

defaults to undef (requires `enable_connection_pooling => true`)
defaults to undef

##### `$pool_max_idle`

defaults to 20 (requires `enable_connection_pooling => true`)
defaults to undef

##### `$pool_remove_abandoned`

defaults to true (requires `enable_connection_pooling => true`)
defaults to undef

##### `$pool_remove_abandoned_timeout`

defaults to 300 (requires `enable_connection_pooling => true`)
defaults to undef

##### `$pool_test_while_idle`

defaults to true (requires `enable_connection_pooling => true`)
defaults to undef

##### `$pool_test_on_borrow`

defaults to false (requires `enable_connection_pooling => true`)
defaults to undef

#### MySQL Java Connector parameters

Expand Down Expand Up @@ -666,7 +661,6 @@ jira::jvm_xms: '1G'
jira::jvm_xmx: '3G'
jira::jvm_permgen: '384m'
jira::service_manage: false
jira::enable_connection_pooling: 'true'
jira::env:
- 'http_proxy=proxy.example.co.za:8080'
- 'https_proxy=proxy.example.co.za:8080'
Expand Down
2 changes: 1 addition & 1 deletion examples/jira_mysql_install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
-> class { 'jira':
javahome => '/opt/java/latest',
db => 'mysql',
dbport => '3306',
dbport => 3306,
dbdriver => 'com.mysql.jdbc.Driver',
dbtype => 'mysql',
}
Expand Down
2 changes: 1 addition & 1 deletion examples/jira_mysql_nativessl_install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

java_ks { 'jira':
ensure => present,
ensure => 'present',
name => 'jira',
certificate => '/etc/ssl/jira_cert.pem',
private_key => '/etc/ssl/jira_key.pem',
Expand Down
2 changes: 1 addition & 1 deletion examples/jira_postgres_install.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node default {
class { 'postgresql::globals':
manage_package_repo => true,
version => '9.3',
version => '11',
}

-> class { 'postgresql::server': }
Expand Down
4 changes: 2 additions & 2 deletions examples/jira_postgres_nginx_install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-> class { 'postgresql::globals':
manage_package_repo => true,
version => '9.3',
version => '11',
}

-> class { 'postgresql::server': }
Expand All @@ -18,7 +18,7 @@
proxy => {
scheme => 'http',
proxyName => $facts['networking']['fqdn'],
proxyPort => '80',
proxyPort => 80,
},
}

Expand Down
4 changes: 2 additions & 2 deletions examples/jira_postgres_nginx_ssl_install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-> class { 'postgresql::globals':
manage_package_repo => true,
version => '9.3',
version => '11',
}

-> class { 'postgresql::server': }
Expand All @@ -18,7 +18,7 @@
proxy => {
scheme => 'https',
proxyName => $facts['networking']['fqdn'],
proxyPort => '443',
proxyPort => 443,
},
}

Expand Down
8 changes: 3 additions & 5 deletions jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ jira::dbschema: 'public'
# Default for mssql
#jira::dbschema: 'dbo'

# The connection pool size
jira::poolsize: 20
jira::enable_connection_pooling: false
# The connection pool parameters
jira::pool_min_size: 20
jira::pool_max_size: 20
jira::pool_max_wait: 30000
Expand Down Expand Up @@ -102,8 +100,8 @@ jira::service_ensure: running
jira::service_enable: true

# Tomcat settings
jira::tomcat_max_threads: '150'
jira::tomcat_accept_count: '100'
jira::tomcat_max_threads: 150
jira::tomcat_accept_count: 100

# Configure reverse ssl proxy
jira::proxy:
Expand Down
25 changes: 7 additions & 18 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,14 @@
group => $jira::group,
}

if $jira::validation_query == undef {
$validation_query = $jira::db ? {
'postgresql' => 'select version();',
'mysql' => 'select 1',
'oracle' => 'select 1 from dual',
'sqlserver' => 'select 1',
'h2' => 'select 1',
}
}
if $jira::time_between_eviction_runs == undef {
$time_between_eviction_runs = $jira::db ? {
'postgresql' => '30000',
'mysql' => '300000',
'oracle' => '300000',
'sqlserver' => '300000',
'h2' => '5000',
}
$dbschema_default = $jira::db ? {
'postgresql' => 'public',
default => undef
}

# can't use pick_default: https://tickets.puppetlabs.com/browse/MODULES-11018
$dbschema = if $jira::dbschema { $jira::dbschema } else { $dbschema_default }

file { "${jira::webappdir}/bin/user.sh":
content => template('jira/user.sh.erb'),
mode => '0755',
Expand All @@ -56,7 +45,7 @@
}

-> file { "${jira::homedir}/dbconfig.xml":
content => template("jira/dbconfig.${jira::db}.xml.erb"),
content => epp('jira/dbconfig.xml.epp'),
mode => '0600',
require => [Class['jira::install'],File[$jira::homedir]],
notify => Class['jira::service'],
Expand Down
Loading

0 comments on commit ec85b18

Please sign in to comment.