Skip to content

Commit

Permalink
Merge branch 'master' into 'mssql'.
Browse files Browse the repository at this point in the history
  • Loading branch information
smsearcy committed Jan 23, 2015
2 parents 4f97437 + 5ebcbc6 commit 9129d7b
Show file tree
Hide file tree
Showing 22 changed files with 469 additions and 85 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
##2014-01-21 - Release 1.1.5
- Add beaker tests for MySQL
- Added support for Oracle and Scientific Linux
- Bump jira version to 6.3.13
- Add support for parameter 'contextpath'
- Add class to install MySQL Java connector from mysql.com
- Add support for oracle database

Thanks to Oliver Bertuch for his contributions.

##2014-01-17 - Release 1.1.4
- Parameterize the lockfile variable in the init script
- Autoinstall MySql Connector/J Driver
- Add parameter stop_jira
- Fix bug on RHEL7 where updating the systemd script does not take effect without refreshing systemd

Thanks to MasonM for his contributions

##2014-11-17 - Release 1.1.3
- Refactor beaker tests to that they are portable and other people can run them
- Remove unnecessary comments from init.pp
Expand Down
74 changes: 54 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ This module installs/upgrades Atlassian's Enterprise Issue Tracking and project
<a name="JIRA-prerequisites">
###JIRA Prerequisites

* JIRA requires a Java Developers Kit (JDK) or Java Run-time Environment (JRE) platform to be installed on your server's operating system. Oracle JDK / JRE (formerly Sun JDK / JRE) versions 7 and 8 are currently supported by Atlassian.
* JIRA requires a Java Developers Kit (JDK) or Java Run-time Environment (JRE) platform to be installed on your server's operating system. Oracle JDK / JRE (formerly Sun JDK / JRE) versions 7 and 8 are currently supported by Atlassian.

* JIRA requires a relational database to store its issue data. This module currently supports PostgreSQL 8.4 to 9.x and MySQL 5.x. We suggest using puppetlabs-postgresql/puppetlabs-mysql modules to configure/manage the database. The module uses PostgreSQL as a default.
* JIRA requires a relational database to store its issue data. This module currently supports PostgreSQL 8.4 to 9.x and MySQL 5.x and Oracle 11g. We suggest using puppetlabs-postgresql/puppetlabs-mysql modules to configure/manage the database. The module uses PostgreSQL as a default.

* Whilst not required, for production use we recommend using nginx/apache as a reverse proxy to JIRA. We suggest using the jfryman/nginx puppet module.

Expand All @@ -42,10 +42,12 @@ This module installs/upgrades Atlassian's Enterprise Issue Tracking and project

If installing to an existing JIRA instance, it is your responsibility to backup your database. We also recommend that you backup your JIRA home directory and that you align your current JIRA version with the version you intend to use with puppet JIRA module.

You must have your database setup with the account user that JIRA will use. This can be done using the puppetlabs-postgresql and puppetlabs-mysql modules.
You must have your database setup with the account user that JIRA will use. This can be done using the puppetlabs-postgresql and puppetlabs-mysql modules.

When using this module to upgrade JIRA, please make sure you have a database/JIRA home backup.

When using MySQL, We call the jira::mysql_connector class to install the MySQL java connector directory from mysql.com as per Atlassian's documented recommendations.

<a name="beginning-with-JIRA">
###Beginning with JIRA

Expand Down Expand Up @@ -102,6 +104,7 @@ mkrakowitzer-deploy has been replaced with nanliu-staging as the default module
* `jira::install`: Installs JIRA binaries
* `jira::config`: Modifies jira/tomcat configuration files
* `jira::service`: Manage the JIRA service.
* `jira::mysql_connector`: Install/Manage the MySQL Java connector

###Parameters

Expand All @@ -113,7 +116,7 @@ Specifies the version of JIRA to install, defaults to latest available at time o

#####`$product`

Product name, defaults to JIRA
Product name, defaults to jira

#####`$format`

Expand Down Expand Up @@ -147,7 +150,7 @@ The gid of the JIRA user, defaults to next available (undef)

#####`$db`

Which database to use for JIRA, defaults to 'postgresql'
Which database to use for JIRA, defaults to 'postgresql'. Can be 'postgresql', 'mysql' or 'oracle'.

#####`$dbuser`

Expand All @@ -163,31 +166,26 @@ The hostname of the database server, defaults to 'localhost'

#####`$dbname`

The name of the database, defaults to 'jira'
The name of the database, defaults to 'jira'. If using oracle this should be the SID.

#####`$dbport`

The port of the database, defaults to '5432'
The port of the database, defaults to '5432'. MySQL runs on '3306'. Oracle runs on '1521'.

#####`$dbdriver`

The database driver to use, defaults to 'org.postgresql.Driver'
The database driver to use, defaults to 'org.postgresql.Driver'. Can be 'org.postgresql.Driver', 'com.mysql.jdbc.Driver' or 'oracle.jdbc.OracleDriver'.

#####`$dbtype`

Database type, defaults to 'postgres72'
Database type, defaults to 'postgres72'. Can be 'postgres72', 'mysql' or 'oracle10g'. Atlassian only supports Oracle 11g, even so this value should be as documented here.

#####`$poolsize`

The connection pool size to the database, defaults to 20

#####`$mysql_connector_package`

Package name for the MySQL Connector/J driver. Will be automatically installed if set and $dbtype = 'mysql'. Defaults to 'mysql-connector-java' on Redhat and 'libmysql-java' on Debian.

#####`$mysql_connector_jar`

Path to the JAR for the MySQL Connector/J driver. Defaults to '/usr/share/java/mysql-connector-java.jar' on Redhat and '/usr/share/java/mysql.jar' on Debian.
#####`$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`

Expand Down Expand Up @@ -237,6 +235,27 @@ defaults to true

defaults to true

####MySQL Java Connector parameters####

#####`mysql_connector_manage`
Manage the MySQL Java Connector with the JIRA module, defaults to 'true'

#####`mysql_connector_version`
Specifies the version of MySQL Java Connector you would like installed. Defaults to '5.1.34',

#####`$mysql_connector_product`
Product name, defaults to 'mysql-connector-java'

#####`$mysql_connector_format`
The default file format of the MySQL Java Connector install file, defaults to tar.gz

#####`$mysql_connector_install`
Installation directory of the MySQL connector. Defaults to '/opt/MySQL-connector'

#####`$mysql_connector_URL`
The URL used to download the MySQL Java Connector installation file.
Defaults to 'http://cdn.mysql.com/Downloads/Connector-J'

####JVM Java parameters####

#####`$javahome`
Expand Down Expand Up @@ -291,10 +310,17 @@ Manage the JIRA service, defaults to 'running'

Defaults to 'true'

#####`$stop_jira`
If the jira service is managed outside of puppet the stop_jira parameter can be used to shut down jira for upgrades. Defaults to 'service jira stop && sleep 15'

#####`$proxy = {}`

Defaults to {}, See examples on how to use.

#####`$contextpath = ""`

Defaults to an empty string (""). Will add a path to the Tomcat Server Context.

####Tomcat parameters####

#####`$tomcatPort`
Expand Down Expand Up @@ -328,7 +354,7 @@ Defaults to '100'

### A Hiera example

This example is used in production for 2000 users in an traditional enterprise environment. Your milage may vary. The dbpassword can be stored using eyaml hiera extension.
This example is used in production for 2000 users in an traditional enterprise environment. Your mileage may vary. The dbpassword can be stored using eyaml hiera extension.

```yaml
jira::version: '6.2.7'
Expand Down Expand Up @@ -360,6 +386,7 @@ jira::proxy:
scheme: 'https'
proxyName: 'jira.example.co.za'
proxyPort: '443'
jira::contextpath: '/jira'
```
Reverse proxy can be configured as a hash as part of the JIRA resource
Expand All @@ -384,10 +411,17 @@ Enable external facts for puppet version. These facts are required to be enabled
The puppetlabs repositories can be found at:
http://yum.puppetlabs.com/ and http://apt.puppetlabs.com/

* RedHat / CentOS 5/6/7
* Ubuntu 12.04 / 14.04
* RedHat 6/7
* CentOS 6/7
* Scientific 6/7
* Oracle Linux 6/7
* Ubuntu 12.04/14.04
* Debian 7

* PostgreSQL
* MySQL 5.x
* Oracle 11G with Oracle 11.2.x drivers

We plan to support other Linux distributions and possibly Windows in the near future.

##Development
Expand Down Expand Up @@ -425,7 +459,7 @@ BEAKER_set=centos-70-x64 bundle exec rake beaker
BEAKER_set=centos-64-x64-pe bundle exec rake beaker
```

To save build time it is useful to host the installation files locally on a webserver. You can use the download_url environment variable to overwrite the default.
To save build time it is useful to host the installation files locally on a web server. You can use the download_url environment variable to overwrite the default.

```bash
export download_url="'http://my.local.server/'"
Expand Down
2 changes: 2 additions & 0 deletions jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ jira::proxy:
scheme: 'https'
proxyName: 'www.exmaple.co.za'
proxyPort: '443'
# Configure path attribute for the <Context>
jira::contextpath: '/jira'
2 changes: 2 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
$validationQuery = $jira::db ? {
'postgresql' => 'select version();',
'mysql' => 'select 1',
'oracle' => 'select 1 from dual',
'sqlserver' => 'select 1',
}
}
if $jira::timeBetweenEvictionRuns == undef {
$timeBetweenEvictionRuns = $jira::db ? {
'postgresql' => '30000',
'mysql' => '300000',
'oracle' => '300000',
'sqlserver' => '300000',
}
}
Expand Down
6 changes: 3 additions & 3 deletions manifests/facts.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# class { 'jira::facts': }
#
class jira::facts(
$ensure = 'present',
$port = $jira::tomcatPort,
$uri = '127.0.0.1',
$ensure = 'present',
$port = $jira::tomcatPort,
$uri = '127.0.0.1',
$json_packages = $jira::params::json_packages,
) inherits jira::params {

Expand Down
31 changes: 22 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
class jira (

# Jira Settings
$version = '6.3.4a',
$version = '6.3.13',
$product = 'jira',
$format = 'tar.gz',
$installdir = '/opt/jira',
Expand All @@ -54,8 +54,15 @@
$dbtype = 'postgres72',
$dburl = undef,
$poolsize = '20',
$mysql_connector_package = $jira::params::mysql_connector_package,
$mysql_connector_jar = $jira::params::mysql_connector_jar,

# 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,
Expand Down Expand Up @@ -90,6 +97,10 @@
$service_manage = true,
$service_ensure = running,
$service_enable = true,
# 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
$tomcatPort = 8080,
Expand All @@ -100,21 +111,22 @@

# Reverse https proxy
$proxy = {},
# Context path (usualy used in combination with a reverse proxy)
$contextpath = '',

) inherits jira::params {

Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

if $jira::db != 'postgresql' and $jira::db != 'mysql' and $jira::db != 'sqlserver' {
fail('jira db parameter must be postgresql or mysql or sqlserver')
}
# Parameter validations
validate_re($db, ['^postgresql','^mysql','^sqlserver'], 'The JIRA $db parameter must be "postgresql", "mysql", "sqlserver".')
validate_hash($proxy)
validate_re($contextpath, ['^$', '^/.*'])

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 { 'service jira stop && sleep 15': before => Anchor['jira::start'] }
exec { $stop_jira: before => Anchor['jira::start'] }
}
}

Expand All @@ -126,6 +138,7 @@
$dburl_real = $db ? {
'postgresql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}",
'mysql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}?useUnicode=true&amp;characterEncoding=UTF8&amp;sessionVariables=storage_engine=InnoDB",
'oracle' => "jdbc::${db}:thin:@${dbserver}:${dbport}:${dbname}"
'sqlserver' => "jdbc:jtds:${db}://${dbserver}:${dbport}/${dbname}",
}
}
Expand Down
17 changes: 9 additions & 8 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,15 @@
subscribe => User[$jira::user]
}

if $jira::db == 'mysql' and $jira::mysql_connector_package {
package { $jira::mysql_connector_package:
ensure => installed,
} ->

file { "${jira::webappdir}/lib/mysql-connector-java.jar":
ensure => link,
target => $jira::mysql_connector_jar,
if $jira::db == 'mysql' and $jira::mysql_connector_manage {
if $jira::staging_or_deploy == 'staging' {
class { 'jira::mysql_connector':
require => Staging::Extract[$file],
}
} elsif $jira::staging_or_deploy == 'deploy' {
class { 'jira::mysql_connector':
require => Deploy::File[$file],
}
}
}
}
38 changes: 38 additions & 0 deletions manifests/mysql_connector.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Class to install the MySQL Java connector
class jira::mysql_connector (
$version = $jira::mysql_connector_version,
$product = $jira::mysql_connector_product,
$format = $jira::mysql_connector_format,
$installdir = $jira::mysql_connector_install,
$downloadURL = $jira::mysql_connector_URL,
) {

require staging

$file = "${product}-${version}.${format}"

if ! defined(File[$installdir]) {
file { $installdir:
ensure => 'directory',
owner => root,
group => root,
before => Staging::File[$file]
}
}

staging::file { $file:
source => "${downloadURL}/${file}",
timeout => 300,
} ->

staging::extract { $file:
target => $installdir,
creates => "${installdir}/${product}-${version}",
} ->

file { "${jira::webappdir}/lib/mysql-connector-java.jar":
ensure => link,
target => "${installdir}/${product}-${version}/${product}-${version}-bin.jar",
}

}
Loading

0 comments on commit 9129d7b

Please sign in to comment.