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 (Any) (defaults to: '6.4.1')
  • product (Any) (defaults to: 'jira')
  • format (Any) (defaults to: 'tar.gz')
  • installdir (Any) (defaults to: '/opt/jira')
  • homedir (Any) (defaults to: '/home/jira')
  • user (Any) (defaults to: 'jira')
  • group (Any) (defaults to: 'jira')
  • uid (Any) (defaults to: undef)
  • gid (Any) (defaults to: undef)
  • shell (Any) (defaults to: '/bin/true')
  • db (Any) (defaults to: 'postgresql')
  • dbuser (Any) (defaults to: 'jiraadm')
  • dbpassword (Any) (defaults to: 'mypassword')
  • dbserver (Any) (defaults to: 'localhost')
  • dbname (Any) (defaults to: 'jira')
  • dbport (Any) (defaults to: '5432')
  • dbdriver (Any) (defaults to: 'org.postgresql.Driver')
  • dbtype (Any) (defaults to: 'postgres72')
  • dburl (Any) (defaults to: undef)
  • poolsize (Any) (defaults to: '20')
  • 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 (Any) (defaults to: '/opt/MySQL-connector')
  • mysql_connector_URL (Any) (defaults to: 'http://cdn.mysql.com/Downloads/Connector-J')
  • enable_connection_pooling (Any) (defaults to: false)
  • poolMinSize (Any) (defaults to: 20)
  • poolMaxSize (Any) (defaults to: 20)
  • poolMaxWait (Any) (defaults to: 30000)
  • validationQuery (Any) (defaults to: undef)
  • minEvictableIdleTime (Any) (defaults to: 60000)
  • timeBetweenEvictionRuns (Any) (defaults to: undef)
  • poolMaxIdle (Any) (defaults to: 20)
  • poolRemoveAbandoned (Any) (defaults to: true)
  • poolRemoveAbandonedTimout (Any) (defaults to: 300)
  • poolTestWhileIdle (Any) (defaults to: true)
  • poolTestOnBorrow (Any) (defaults to: true)
  • javahome (Any)
  • 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: '')
  • downloadURL (Any) (defaults to: 'http://www.atlassian.com/software/jira/downloads/binary/')
  • staging_or_deploy (Any) (defaults to: 'staging')
  • 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')
  • tomcatAddress (Any) (defaults to: undef)
  • tomcatPort (Any) (defaults to: 8080)
  • tomcatMaxThreads (Any) (defaults to: '150')
  • tomcatAcceptCount (Any) (defaults to: '100')
  • proxy (Any) (defaults to: {})
  • ajp (Any) (defaults to: {})
  • contextpath (Any) (defaults to: '')
  • resources (Any) (defaults to: {})


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
# File 'manifests/init.pp', line 33

class jira (

  # Jira Settings
  $version      = '6.4.1',
  $product      = 'jira',
  $format       = 'tar.gz',
  $installdir   = '/opt/jira',
  $homedir      = '/home/jira',
  $user         = 'jira',
  $group        = 'jira',
  $uid          = undef,
  $gid          = undef,
  $shell        = '/bin/true',

  # Database Settings
  $db                      = 'postgresql',
  $dbuser                  = 'jiraadm',
  $dbpassword              = 'mypassword',
  $dbserver                = 'localhost',
  $dbname                  = 'jira',
  $dbport                  = '5432',
  $dbdriver                = 'org.postgresql.Driver',
  $dbtype                  = 'postgres72',
  $dburl                   = undef,
  $poolsize                = '20',

  # MySQL Connector Settings
  $mysql_connector_manage  = true,
  $mysql_connector_version = '5.1.34',
  $mysql_connector_product = 'mysql-connector-java',
  $mysql_connector_format  = 'tar.gz',
  $mysql_connector_install = '/opt/MySQL-connector',
  $mysql_connector_URL     = 'http://cdn.mysql.com/Downloads/Connector-J',


  # Configure database settings if you are pooling connections
  $enable_connection_pooling = false,
  $poolMinSize               = 20,
  $poolMaxSize               = 20,
  $poolMaxWait               = 30000,
  $validationQuery           = undef,
  $minEvictableIdleTime      = 60000,
  $timeBetweenEvictionRuns   = undef,
  $poolMaxIdle               = 20,
  $poolRemoveAbandoned       = true,
  $poolRemoveAbandonedTimout = 300,
  $poolTestWhileIdle         = true,
  $poolTestOnBorrow          = true,

  # JVM Settings
  $javahome,
  $jvm_xms      = '256m',
  $jvm_xmx      = '1024m',
  $jvm_permgen  = '256m',
  $jvm_optional = '-XX:-HeapDumpOnOutOfMemoryError',
  $java_opts    = '',

  # Misc Settings
  $downloadURL  = 'http://www.atlassian.com/software/jira/downloads/binary/',

  # Choose whether to use nanliu-staging, or mkrakowitzer-deploy
  # Defaults to nanliu-staging as it is puppetlabs approved.
  $staging_or_deploy = 'staging',

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

  # Tomcat
  $tomcatAddress = undef,
  $tomcatPort = 8080,

  # Tomcat Tunables
  $tomcatMaxThreads  = '150',
  $tomcatAcceptCount = '100',
  
  # Reverse https proxy
  $proxy = {},
  # Options for the AJP connector
  $ajp   = {},
  # Context path (usualy used in combination with a reverse proxy)
  $contextpath = '',

  # Resources for context.xml
  $resources = {},

) inherits jira::params {

  # Parameter validations
  validate_re($db, ['^postgresql','^mysql','^sqlserver','^oracle'], 'The JIRA $db parameter must be "postgresql", "mysql", "sqlserver".')
  validate_hash($proxy)
  validate_re($contextpath, ['^$', '^/.*'])
  validate_hash($resources)
  validate_hash($ajp)

  if $::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 => Anchor['jira::start'] }
    }
  }

  $webappdir    = "${installdir}/atlassian-${product}-${version}-standalone"
  if $dburl {
    $dburl_real = $dburl
  }
  else {
    $dburl_real = $db ? {
      'postgresql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}",
      'mysql'      => "jdbc:${db}://${dbserver}:${dbport}/${dbname}?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB",
      'oracle'     => "jdbc:${db}:thin:@${dbserver}:${dbport}:${dbname}",
      'sqlserver'  => "jdbc:jtds:${db}://${dbserver}:${dbport}/${dbname}"
    }
  }

  if ! empty($ajp) {
    if ! has_key($ajp, 'port') {
      fail('You need to specify a valid port for the AJP connector.')
    } else {
      validate_re($ajp['port'], '^\d+$')
    }
    if ! has_key($ajp, 'protocol') {
      fail('You need to specify a valid protocol for the AJP connector.')
    } else {
      validate_re($ajp['protocol'], ['^AJP/1.3$', '^org.apache.coyote.ajp'])
    }
  }

  anchor { 'jira::start':
  } ->
  class { 'jira::install':
  } ->
  class { 'jira::config':
  } ~>
  class { 'jira::service':
  } ->
  anchor { 'jira::end': }

}