Puppet Class: jira

Inherits:
jira::params
Inherited by:
jira::config
Defined in:
manifests/init.pp

Overview


Copyright (c) 2012 Bryce Johnson

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Class: jira

This module is used to install Jira.

See README.md for more details

Authors

Bryce Johnson Merritt Krakowitzer

Copyright © 2012 Bryce Johnson

Published under the Apache License, Version 2.0

Parameters:

  • version (String) (defaults to: '6.4.1')
  • product (String) (defaults to: 'jira')
  • format (String) (defaults to: 'tar.gz')
  • installdir (Stdlib::Absolutepath) (defaults to: '/opt/jira')
  • homedir (Stdlib::Absolutepath) (defaults to: '/home/jira')
  • manage_user (Boolean) (defaults to: true)
  • user (String) (defaults to: 'jira')
  • group (String) (defaults to: 'jira')
  • uid (Any) (defaults to: undef)
  • gid (Any) (defaults to: undef)
  • shell (Stdlib::Absolutepath) (defaults to: '/bin/true')
  • enable_secure_admin_sessions (Boolean) (defaults to: true)
  • jira_config_properties (Hash) (defaults to: {})
  • datacenter (Boolean) (defaults to: false)
  • shared_homedir (Any) (defaults to: undef)
  • ehcache_listener_host (Optional[Stdlib::Host]) (defaults to: undef)
  • ehcache_listener_port (Optional[Stdlib::Port]) (defaults to: undef)
  • ehcache_object_port (Optional[Stdlib::Port]) (defaults to: undef)
  • db (Enum['postgresql','mysql','sqlserver','oracle','h2']) (defaults to: 'postgresql')
  • dbuser (Any) (defaults to: 'jiraadm')
  • dbpassword (Any) (defaults to: 'mypassword')
  • dbserver (Any) (defaults to: 'localhost')
  • dbname (Any) (defaults to: 'jira')
  • dbport (Optional[Variant[Integer,String]]) (defaults to: undef)
  • dbdriver (Optional[String]) (defaults to: undef)
  • dbtype (Optional[String]) (defaults to: undef)
  • dburl (Optional[String]) (defaults to: undef)
  • poolsize (Any) (defaults to: '20')
  • dbschema (Any) (defaults to: 'public')
  • mysql_connector_manage (Any) (defaults to: true)
  • mysql_connector_version (Any) (defaults to: '5.1.34')
  • mysql_connector_product (Any) (defaults to: 'mysql-connector-java')
  • mysql_connector_format (Any) (defaults to: 'tar.gz')
  • mysql_connector_install (Stdlib::Absolutepath) (defaults to: '/opt/MySQL-connector')
  • mysql_connector_url (Stdlib::HTTPUrl) (defaults to: 'https://dev.mysql.com/get/Downloads/Connector-J')
  • enable_connection_pooling (Any) (defaults to: false)
  • pool_min_size (Any) (defaults to: 20)
  • pool_max_size (Any) (defaults to: 20)
  • pool_max_wait (Any) (defaults to: 30000)
  • validation_query (Any) (defaults to: undef)
  • min_evictable_idle_time (Any) (defaults to: 60000)
  • time_between_eviction_runs (Any) (defaults to: undef)
  • pool_max_idle (Any) (defaults to: 20)
  • pool_remove_abandoned (Any) (defaults to: true)
  • pool_remove_abandoned_timeout (Any) (defaults to: 300)
  • pool_test_while_idle (Any) (defaults to: true)
  • pool_test_on_borrow (Any) (defaults to: false)
  • javahome (Any) (defaults to: undef)
  • jvm_xms (Any) (defaults to: '256m')
  • jvm_xmx (Any) (defaults to: '1024m')
  • jvm_permgen (Any) (defaults to: '256m')
  • jvm_optional (Any) (defaults to: '-XX:-HeapDumpOnOutOfMemoryError')
  • java_opts (Any) (defaults to: '')
  • catalina_opts (Any) (defaults to: '')
  • download_url (Stdlib::HTTPUrl) (defaults to: 'https://product-downloads.atlassian.com/software/jira/downloads')
  • checksum (Any) (defaults to: undef)
  • disable_notifications (Any) (defaults to: false)
  • deploy_module (Any) (defaults to: 'archive')
  • proxy_server (Any) (defaults to: undef)
  • proxy_type (Optional[Enum['none','http','https','ftp']]) (defaults to: undef)
  • service_manage (Any) (defaults to: true)
  • service_ensure (Any) (defaults to: running)
  • service_enable (Any) (defaults to: true)
  • service_notify (Any) (defaults to: undef)
  • service_subscribe (Any) (defaults to: undef)
  • stop_jira (Any) (defaults to: 'service jira stop && sleep 15')
  • script_check_java_manage (Any) (defaults to: false)
  • script_check_java_template (Any) (defaults to: 'jira/check-java.sh.erb')
  • tomcat_address (Any) (defaults to: undef)
  • tomcat_port (Any) (defaults to: 8080)
  • tomcat_shutdown_port (Any) (defaults to: 8005)
  • tomcat_max_http_header_size (Any) (defaults to: '8192')
  • tomcat_min_spare_threads (Any) (defaults to: '25')
  • tomcat_connection_timeout (Any) (defaults to: '20000')
  • tomcat_enable_lookups (Any) (defaults to: false)
  • tomcat_native_ssl (Any) (defaults to: false)
  • tomcat_https_port (Any) (defaults to: 8443)
  • tomcat_redirect_https_port (Optional[Integer]) (defaults to: undef)
  • tomcat_protocol (Any) (defaults to: 'HTTP/1.1')
  • tomcat_protocol_ssl (Any) (defaults to: undef)
  • tomcat_use_body_encoding_for_uri (Any) (defaults to: true)
  • tomcat_disable_upload_timeout (Any) (defaults to: true)
  • tomcat_key_alias (Any) (defaults to: 'jira')
  • tomcat_keystore_file (Stdlib::Absolutepath) (defaults to: '/home/jira/jira.jks')
  • tomcat_keystore_pass (Any) (defaults to: 'changeit')
  • tomcat_keystore_type (Enum['JKS', 'JCEKS', 'PKCS12']) (defaults to: 'JKS')
  • tomcat_accesslog_format (Any) (defaults to: '%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"')
  • tomcat_max_threads (Any) (defaults to: '150')
  • tomcat_accept_count (Any) (defaults to: '100')
  • proxy (Hash) (defaults to: {})
  • ajp (Hash) (defaults to: {})
  • contextpath (String) (defaults to: '')
  • resources (Hash) (defaults to: {})
  • enable_sso (Boolean) (defaults to: false)
  • application_name (String) (defaults to: 'crowd')
  • application_password (String) (defaults to: '1234')
  • application_login_url (Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]) (defaults to: 'https://crowd.example.com/console/')
  • crowd_server_url (Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]) (defaults to: 'https://crowd.example.com/services/')
  • crowd_base_url (Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]) (defaults to: 'https://crowd.example.com/')
  • session_isauthenticated (String) (defaults to: 'session.isauthenticated')
  • session_tokenkey (String) (defaults to: 'session.tokenkey')
  • session_validationinterval (Integer) (defaults to: 5)
  • session_lastvalidation (String) (defaults to: 'session.lastvalidation')


33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# File 'manifests/init.pp', line 33

class jira (

  # Jira Settings
  String $version                                                   = '6.4.1',
  String $product                                                   = 'jira',
  String $format                                                    = 'tar.gz',
  Stdlib::Absolutepath $installdir                                  = '/opt/jira',
  Stdlib::Absolutepath $homedir                                     = '/home/jira',
  Boolean $manage_user                                              = true,
  String $user                                                      = 'jira',
  String $group                                                     = 'jira',
  $uid                                                              = undef,
  $gid                                                              = undef,
  Stdlib::Absolutepath $shell                                       = '/bin/true',
  # Advanced configuration options
  Boolean $enable_secure_admin_sessions                             = true,
  Hash $jira_config_properties                                      = {},
  Boolean $datacenter                                               = false,
  $shared_homedir                                                   = undef,
  Optional[Stdlib::Host] $ehcache_listener_host                     = undef,
  Optional[Stdlib::Port] $ehcache_listener_port                     = undef,
  Optional[Stdlib::Port] $ehcache_object_port                       = undef,
  # Database Settings
  Enum['postgresql','mysql','sqlserver','oracle','h2'] $db          = 'postgresql',
  $dbuser                                                           = 'jiraadm',
  $dbpassword                                                       = 'mypassword',
  $dbserver                                                         = 'localhost',
  $dbname                                                           = 'jira',
  Optional[Variant[Integer,String]] $dbport                         = undef,
  Optional[String] $dbdriver                                        = undef,
  Optional[String] $dbtype                                          = undef,
  Optional[String] $dburl                                           = undef,
  $poolsize                                                         = '20',
  $dbschema                                                         = 'public',
  # MySQL Connector Settings
  $mysql_connector_manage                                           = true,
  $mysql_connector_version                                          = '5.1.34',
  $mysql_connector_product                                          = 'mysql-connector-java',
  $mysql_connector_format                                           = 'tar.gz',
  Stdlib::Absolutepath $mysql_connector_install                     = '/opt/MySQL-connector',
  Stdlib::HTTPUrl $mysql_connector_url                              = 'https://dev.mysql.com/get/Downloads/Connector-J',
  # Configure database settings if you are pooling connections
  $enable_connection_pooling                                        = false,
  $pool_min_size                                                    = 20,
  $pool_max_size                                                    = 20,
  $pool_max_wait                                                    = 30000,
  $validation_query                                                 = undef,
  $min_evictable_idle_time                                          = 60000,
  $time_between_eviction_runs                                       = undef,
  $pool_max_idle                                                    = 20,
  $pool_remove_abandoned                                            = true,
  $pool_remove_abandoned_timeout                                    = 300,
  $pool_test_while_idle                                             = true,
  $pool_test_on_borrow                                              = false,
  # JVM Settings
  $javahome                                                         = undef,
  $jvm_xms                                                          = '256m',
  $jvm_xmx                                                          = '1024m',
  $jvm_permgen                                                      = '256m',
  $jvm_optional                                                     = '-XX:-HeapDumpOnOutOfMemoryError',
  $java_opts                                                        = '',
  $catalina_opts                                                    = '',
  # Misc Settings
  Stdlib::HTTPUrl $download_url                                     = 'https://product-downloads.atlassian.com/software/jira/downloads',
  $checksum                                                         = undef,
  $disable_notifications                                            = false,
  # Choose whether to use puppet-staging, or puppet-archive
  $deploy_module                                                    = 'archive',
  $proxy_server                                                     = undef,
  Optional[Enum['none','http','https','ftp']] $proxy_type           = undef,
  # Manage service
  $service_manage                                                   = true,
  $service_ensure                                                   = running,
  $service_enable                                                   = true,
  $service_notify                                                   = undef,
  $service_subscribe                                                = undef,
  # Command to stop jira in preparation to updgrade. This is configurable
  # incase the jira service is managed outside of puppet. eg: using the
  # puppetlabs-corosync module: 'crm resource stop jira && sleep 15'
  $stop_jira                                                        = 'service jira stop && sleep 15',
  # Whether to manage the 'check-java.sh' script, and where to retrieve
  # the script from.
  $script_check_java_manage                                         = false,
  $script_check_java_template                                       = 'jira/check-java.sh.erb',
  # Tomcat
  $tomcat_address                                                   = undef,
  $tomcat_port                                                      = 8080,
  $tomcat_shutdown_port                                             = 8005,
  $tomcat_max_http_header_size                                      = '8192',
  $tomcat_min_spare_threads                                         = '25',
  $tomcat_connection_timeout                                        = '20000',
  $tomcat_enable_lookups                                            = false,
  $tomcat_native_ssl                                                = false,
  $tomcat_https_port                                                = 8443,
  Optional[Integer] $tomcat_redirect_https_port                     = undef,
  $tomcat_protocol                                                  = 'HTTP/1.1',
  $tomcat_protocol_ssl                                              = undef,
  $tomcat_use_body_encoding_for_uri                                 = true,
  $tomcat_disable_upload_timeout                                    = true,
  $tomcat_key_alias                                                 = 'jira',
  Stdlib::Absolutepath $tomcat_keystore_file                        = '/home/jira/jira.jks',
  $tomcat_keystore_pass                                             = 'changeit',
  Enum['JKS', 'JCEKS', 'PKCS12'] $tomcat_keystore_type              = 'JKS',
  $tomcat_accesslog_format                                          = '%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"',
  # Tomcat Tunables
  $tomcat_max_threads                                               = '150',
  $tomcat_accept_count                                              = '100',
  # Reverse https proxy
  Hash $proxy                                                       = {},
  # Options for the AJP connector
  Hash $ajp                                                         = {},
  # Context path (usualy used in combination with a reverse proxy)
  String $contextpath                                               = '',
  # Resources for context.xml
  Hash $resources                                                   = {},
  # Enable SingleSignOn via Crowd
  Boolean $enable_sso                                               = false,
  String $application_name                                          = 'crowd',
  String $application_password                                      = '1234',
  Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $application_login_url = 'https://crowd.example.com/console/',
  Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $crowd_server_url      = 'https://crowd.example.com/services/',
  Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl] $crowd_base_url        = 'https://crowd.example.com/',
  String $session_isauthenticated                                   = 'session.isauthenticated',
  String $session_tokenkey                                          = 'session.tokenkey',
  Integer $session_validationinterval                               = 5,
  String $session_lastvalidation                                    = 'session.lastvalidation',
) inherits jira::params {

  if $datacenter and !$shared_homedir {
    fail("\$shared_homedir must be set when \$datacenter is true")
  }

  if $tomcat_redirect_https_port {
    unless ($tomcat_native_ssl) {
        fail('You need to set native_ssl to true when using tomcat_redirect_https_port')
    }
  }

  # The default Jira product starting with version 7 is 'jira-software'
  if ((versioncmp($version, '7.0.0') > 0) and ($product == 'jira')) {
    $product_name = 'jira-software'
  } else {
    $product_name = $product
  }

  if defined('$::jira_version') {
    # If the running version of JIRA is less than the expected version of JIRA
    # Shut it down in preparation for upgrade.
    if versioncmp($version, $::jira_version) > 0 {
      notify { 'Attempting to upgrade JIRA': }
      exec { $stop_jira: before => Class['jira::install'] }
    }
  }

  $extractdir = "${installdir}/atlassian-${product_name}-${version}-standalone"
  if $format == zip {
    $webappdir = "${extractdir}/atlassian-${product_name}-${version}-standalone"
  } else {
    $webappdir = $extractdir
  }

  if $dbport {
    $dbport_real = $dbport
  } else {
    $dbport_real = $db ? {
      'postgresql' => '5432',
      'mysql'      => '3306',
      'oracle'     => '1521',
      'sqlserver'  => '1433',
      'h2'         => '',
    }
  }

  if $dbdriver {
    $dbdriver_real = $dbdriver
  } else {
    $dbdriver_real = $db ? {
      'postgresql' => 'org.postgresql.Driver',
      'mysql'      => 'com.mysql.jdbc.Driver',
      'oracle'     => 'oracle.jdbc.OracleDriver',
      'sqlserver'  => 'com.microsoft.sqlserver.jdbc.SQLServerDriver',
      'h2'         => 'org.h2.Driver',
    }
  }

  if $dbtype {
    $dbtype_real = $dbtype
  } else {
    $dbtype_real = $db ? {
      'postgresql' => 'postgres72',
      'mysql'      => 'mysql',
      'oracle'     => 'oracle10g',
      'sqlserver'  => 'mssql',
      'h2'         => 'h2',
    }
  }

  if $dburl {
    $dburl_real = $dburl
  }
  else {
    $dburl_real = $db ? {
      'postgresql' => "jdbc:${db}://${dbserver}:${dbport_real}/${dbname}",
      'mysql'      => "jdbc:${db}://${dbserver}:${dbport_real}/${dbname}?useUnicode=true&characterEncoding=UTF8&sessionVariables=default_storage_engine=InnoDB",
      'oracle'     => "jdbc:${db}:thin:@${dbserver}:${dbport_real}:${dbname}",
      'sqlserver'  => "jdbc:jtds:${db}://${dbserver}:${dbport_real}/${dbname}",
      'h2'         => "jdbc:h2:file:/${jira::homedir}/database/${dbname}",
    }
  }

  if $tomcat_protocol_ssl {
    $tomcat_protocol_ssl_real = $tomcat_protocol_ssl
  } else {
    if versioncmp($version, '7.3.0') >= 0 {
      $tomcat_protocol_ssl_real = 'org.apache.coyote.http11.Http11NioProtocol'
    } else {
      $tomcat_protocol_ssl_real = 'org.apache.coyote.http11.Http11Protocol'
    }
  }

  if ! empty($ajp) {
    if ! ('port' in $ajp) {
      fail('You need to specify a valid port for the AJP connector.')
    } else {
      assert_type(Variant[Pattern[/^\d+$/], Stdlib::Port], $ajp['port'])
    }
    if ! ('protocol' in $ajp) {
      fail('You need to specify a valid protocol for the AJP connector.')
    } else {
      assert_type(Enum['AJP/1.3', 'org.apache.coyote.ajp', 'org.apache.coyote.ajp.AjpNioProtocol'], $ajp['protocol'])
    }
  }

  $merged_jira_config_properties = merge({'jira.websudo.is.disabled' => !$enable_secure_admin_sessions}, $jira_config_properties)

  if $javahome == undef {
    fail('You need to specify a value for javahome')
  }

  # Archive module checksum_verify = true; this verifies checksum if provided, doesn't if not.
  if $checksum == undef {
    $checksum_verify = false
  } else {
    $checksum_verify = true
  }

  contain jira::install
  contain jira::config
  contain jira::service

  Class['jira::install']
  -> Class['jira::config']
  ~> Class['jira::service']

  if ($enable_sso) {
    class { 'jira::sso': }
  }
}