Skip to content

Commit

Permalink
Merge pull request #52 from smsearcy/mssql
Browse files Browse the repository at this point in the history
Added Microsoft SQL Server support
  • Loading branch information
mkrakowitzer committed Jan 30, 2015
2 parents 5ebcbc6 + 416d8e3 commit d865960
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Expand Up @@ -33,7 +33,7 @@ This module installs/upgrades Atlassian's Enterprise Issue Tracking and project

* 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 and Oracle 11g. 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 and Microsoft SQL Server 2008 & 2012. 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 Down Expand Up @@ -150,7 +150,7 @@ The gid of the JIRA user, defaults to next available (undef)

#####`$db`

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

#####`$dbuser`

Expand All @@ -170,15 +170,15 @@ The name of the database, defaults to 'jira'. If using oracle this should be the

#####`$dbport`

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

#####`$dbdriver`

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

#####`$dbtype`

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.
Database type, defaults to 'postgres72'. Can be 'postgres72', 'mysql', 'oracle10g', or 'mssql'. Atlassian only supports Oracle 11g, even so this value should be as documented here.

#####`$poolsize`

Expand Down Expand Up @@ -421,6 +421,7 @@ http://yum.puppetlabs.com/ and http://apt.puppetlabs.com/
* PostgreSQL
* MySQL 5.x
* Oracle 11G with Oracle 11.2.x drivers
* Microsoft SQL Server 2005/2008/2012 with JTDS driver (included in non-WAR version)

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

Expand Down
4 changes: 4 additions & 0 deletions jira.yaml
Expand Up @@ -38,12 +38,15 @@ jira::group: jira
jira::db: postgresql
#jira::db: mysql
#jira::db: oracle
#jira::db: sqlserver

jira::dbtype: postgres72
#jira::dbtype: mysql
#jira::dbtype: mssql

jira::dbdriver: org.postgresql.Driver
#jira::dbdriver: com.mysql.jdbc.Driver
#jira::dbdriver: net.sourceforge.jtds.jdbc.Driver

# Change these values to your jira database credentials
jira::dbuser: jiraadm
Expand All @@ -54,6 +57,7 @@ jira::dbname: jira
jira::dbport: 5432
#jira::dbport: 3306
#jira::dbport: 1521
#jira::dbport: 1433

# The connection pool size
jira::poolsize: 20
Expand Down
2 changes: 2 additions & 0 deletions manifests/config.pp
Expand Up @@ -25,13 +25,15 @@
'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
5 changes: 3 additions & 2 deletions manifests/init.pp
Expand Up @@ -117,7 +117,7 @@
) inherits jira::params {

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

Expand All @@ -138,7 +138,8 @@
$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}"
'oracle' => "jdbc::${db}:thin:@${dbserver}:${dbport}:${dbname}",
'sqlserver' => "jdbc:jtds:${db}://${dbserver}:${dbport}/${dbname}"
}
}

Expand Down
25 changes: 25 additions & 0 deletions templates/dbconfig.sqlserver.xml.erb
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>

<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type><%= scope.lookupvar('jira::dbtype') %></database-type>
<schema-name>dbo</schema-name>
<jdbc-datasource>
<url><%= scope.lookupvar('jira::dburl_real') %></url>
<driver-class><%= scope.lookupvar('jira::dbdriver') %></driver-class>
<username><%= scope.lookupvar('jira::dbuser') %></username>
<password><%= scope.lookupvar('jira::dbpassword') %></password>
<pool-min-size><%= scope.lookupvar('jira::poolMinSize') %></pool-min-size>
<pool-max-size><%= scope.lookupvar('jira::poolMaxSize') %></pool-max-size>
<pool-max-wait><%= scope.lookupvar('jira::poolMaxWait') %></pool-max-wait>
<validation-query><% if @validationQuery %><%= @validationQuery %><% else %>scope.lookupvar('jira::validationQuery')<% end %></validation-query>
<min-evictable-idle-time-millis><%= scope.lookupvar('jira::minEvictableIdleTime') %></min-evictable-idle-time-millis>
<time-between-eviction-runs-millis><% if @timeBetweenEvictionRuns %><%= @timeBetweenEvictionRuns %><% else %><%= scope.lookupvar('jira::timeBetweenEvictionRuns') %><% end %></time-between-eviction-runs-millis>
<pool-max-idle><%= scope.lookupvar('jira::poolMaxIdle') %></pool-max-idle>
<pool-remove-abandoned><%= scope.lookupvar('jira::poolRemoveAbandoned') %></pool-remove-abandoned>
<pool-remove-abandoned-timeout><%= scope.lookupvar('jira::poolRemoveAbandonedTimout') %></pool-remove-abandoned-timeout>
<pool-test-while-idle><%= scope.lookupvar('jira::poolTestWhileIdle') %></pool-test-while-idle>
<pool-test-on-borrow><%= scope.lookupvar('jira::poolTestOnBorrow') %></pool-test-on-borrow>
</jdbc-datasource>
</jira-database-config>

0 comments on commit d865960

Please sign in to comment.