From 0d717205ef3801bc166886ccd3779bc615b5edca Mon Sep 17 00:00:00 2001 From: Merritt Krakowitzer Date: Sat, 17 Jan 2015 20:28:53 +0200 Subject: [PATCH 1/5] Prep for 1.1.5 jira release --- CHANGELOG.md | 7 ++++++- README.md | 7 +++++-- metadata.json | 16 +++++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1826bd37..8cfd6a4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ -##2014-11-18 - Release 1.1.4 +##2014-XX-XX - Release 1.1.5 +- TODO - Add beaker tests for MySQL +- Added support for Oracle and Scientific Linux +- Validate all parameters + +##2014-01-17 - Release 1.1.4 - Parameterize the lockfile variable in the init script - Autoinstall MySql Connector/J Driver - Add parameter stop_jira diff --git a/README.md b/README.md index 7d247393..d14ccc88 100644 --- a/README.md +++ b/README.md @@ -387,8 +387,11 @@ 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 +* OracleLinux 6/7 +* Ubuntu 12.04/14.04 * Debian 7 We plan to support other Linux distributions and possibly Windows in the near future. diff --git a/metadata.json b/metadata.json index f66dee54..39ecd003 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "mkrakowitzer-jira", - "version": "1.1.4", + "version": "1.1.5", "author": "brycejohnson", "summary": "Module to install Jira", "license": "Apache-2.0", @@ -47,6 +47,20 @@ "7" ] }, + { + "operatingsystem": "OracleLinux", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "Scientific", + "operatingsystemrelease": [ + "6", + "7" + ] + }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ From ff353688fe7c513277b7f9930d54c915a31aa6ff Mon Sep 17 00:00:00 2001 From: Merritt Krakowitzer Date: Sat, 17 Jan 2015 20:38:41 +0200 Subject: [PATCH 2/5] Bump jira version to 6.3.13 --- CHANGELOG.md | 1 + manifests/init.pp | 2 +- spec/classes/jira_upgrade_spec.rb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cfd6a4a..6b10918a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - TODO - Add beaker tests for MySQL - Added support for Oracle and Scientific Linux - Validate all parameters +- Bump jira version to 6.3.13 ##2014-01-17 - Release 1.1.4 - Parameterize the lockfile variable in the init script diff --git a/manifests/init.pp b/manifests/init.pp index 298dfb17..013b9efb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,7 +33,7 @@ class jira ( # Jira Settings - $version = '6.3.4a', + $version = '6.3.13', $product = 'jira', $format = 'tar.gz', $installdir = '/opt/jira', diff --git a/spec/classes/jira_upgrade_spec.rb b/spec/classes/jira_upgrade_spec.rb index 4d946903..d4892324 100644 --- a/spec/classes/jira_upgrade_spec.rb +++ b/spec/classes/jira_upgrade_spec.rb @@ -7,7 +7,7 @@ :javahome => '/opt/java', }} let(:facts) { { - :jira_version => "5.0.0", + :jira_version => '6.3.4a', }} it { should contain_exec('service jira stop && sleep 15') } end @@ -17,7 +17,7 @@ :stop_jira => 'stop service please' }} let(:facts) { { - :jira_version => "5.0.0", + :jira_version => '6.3.4a', }} it { should contain_exec('stop service please') } end From dbc279a7f40c2c587a82a3f805badb27b117bf4f Mon Sep 17 00:00:00 2001 From: Merritt Krakowitzer Date: Sun, 18 Jan 2015 20:13:37 +0200 Subject: [PATCH 3/5] For consistency we should use the dbtype paramater for dbconfig.mysql.xml.erb --- templates/dbconfig.mysql.xml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/dbconfig.mysql.xml.erb b/templates/dbconfig.mysql.xml.erb index d4cdbebb..b06ba9fb 100644 --- a/templates/dbconfig.mysql.xml.erb +++ b/templates/dbconfig.mysql.xml.erb @@ -3,7 +3,7 @@ defaultDS default - mysql + <%= scope.lookupvar('jira::dbtype') %> <%= scope.lookupvar('jira::dburl_real') %> <%= scope.lookupvar('jira::dbdriver') %> From 451d1159032e28d54986858f3f67a52455ce637c Mon Sep 17 00:00:00 2001 From: Merritt Krakowitzer Date: Mon, 19 Jan 2015 07:12:13 +0200 Subject: [PATCH 4/5] Manage the installation of the Mysql Java Connector with jira module Resolve issue #45 This particular issue [1] happens in both Ubuntu 12.04 and RHEL/Centos 6 by default when using the na [1] https://confluence.atlassian.com/display/JIRAKB/%27NullPointerException+at+com.mysql.jdbc.Connect [2] https://confluence.atlassian.com/display/JIRA/Connecting+JIRA+to+MySQL [3] http://dev.mysql.com/downloads/connector/j --- README.md | 42 +++++--- manifests/init.pp | 11 ++- manifests/install.pp | 17 ++-- manifests/mysql_connector.pp | 38 +++++++ manifests/params.pp | 6 -- spec/acceptance/default_parameters_spec.rb | 38 +++---- spec/acceptance/mysql_spec.rb | 110 +++++++++++++++++++++ spec/classes/jira_config_spec.rb | 26 ----- spec/classes/jira_install_deploy_spec.rb | 4 + spec/classes/jira_mysql_connector_spec.rb | 67 +++++++++++++ spec/spec_helper_acceptance.rb | 3 +- 11 files changed, 281 insertions(+), 81 deletions(-) create mode 100644 manifests/mysql_connector.pp create mode 100644 spec/acceptance/mysql_spec.rb create mode 100644 spec/classes/jira_mysql_connector_spec.rb diff --git a/README.md b/README.md index d14ccc88..a071951a 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,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` @@ -147,7 +147,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' or 'mysql'. #####`$dbuser` @@ -163,31 +163,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'. #####`$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'. #####`$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 recomend setting it. However it can be used to customize the database connection string. #####`$enable_connection_pooling` @@ -237,6 +232,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` diff --git a/manifests/init.pp b/manifests/init.pp index 013b9efb..688da99c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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, diff --git a/manifests/install.pp b/manifests/install.pp index db326187..ee01f3c4 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -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], + } } } } diff --git a/manifests/mysql_connector.pp b/manifests/mysql_connector.pp new file mode 100644 index 00000000..53469224 --- /dev/null +++ b/manifests/mysql_connector.pp @@ -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", + } + +} diff --git a/manifests/params.pp b/manifests/params.pp index bd3d1c7d..56d47be1 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -9,24 +9,18 @@ case "${::osfamily}${::operatingsystemmajrelease}" { /RedHat7/: { $json_packages = 'rubygem-json' - $mysql_connector_package = 'mysql-connector-java' - $mysql_connector_jar = '/usr/share/java/mysql-connector-java.jar' $service_file_location = '/usr/lib/systemd/system/jira.service' $service_file_template = 'jira/jira.service.erb' $service_lockfile = '/var/lock/subsys/jira' } /Debian/: { $json_packages = [ 'rubygem-json', 'ruby-json' ] - $mysql_connector_package = 'libmysql-java' - $mysql_connector_jar = '/usr/share/java/mysql.jar' $service_file_location = '/etc/init.d/jira' $service_file_template = 'jira/jira.initscript.erb' $service_lockfile = '/var/lock/jira' } default: { $json_packages = [ 'rubygem-json', 'ruby-json' ] - $mysql_connector_package = 'mysql-connector-java' - $mysql_connector_jar = '/usr/share/java/mysql-connector-java.jar' $service_file_location = '/etc/init.d/jira' $service_file_template = 'jira/jira.initscript.erb' $service_lockfile = '/var/lock/subsys/jira' diff --git a/spec/acceptance/default_parameters_spec.rb b/spec/acceptance/default_parameters_spec.rb index 17f1c051..e50b55da 100644 --- a/spec/acceptance/default_parameters_spec.rb +++ b/spec/acceptance/default_parameters_spec.rb @@ -15,7 +15,7 @@ java_url = download_url end -describe 'jira', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do +describe 'jira postgresql', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do it 'installs with defaults' do pp = <<-EOS @@ -59,29 +59,6 @@ class { 'jira::facts': } apply_manifest(pp, :catch_changes => true) end -# Need to insert license key before upgrade -# it 'upgrades with defaults' do -# pp_update = <<-EOS -# $jh = $osfamily ? { -# 'RedHat' => '/usr/lib/jvm/java-1.7.0-openjdk.x86_64', -# 'Debian' => '/usr/lib/jvm/java-7-openjdk-amd64', -# default => '/opt/java', -# } -# class { 'stash': -# version => '3.3.1', -# downloadURL => 'http://10.43.230.24/', -# javahome => $jh, -# } -# EOS -# sleep 180 -# shell 'wget -q --tries=180 --retry-connrefused --read-timeout=10 localhost:8080', :acceptable_exit_codes => [0] -# apply_manifest(pp_update, :catch_failures => true) -# shell 'wget -q --tries=180 --retry-connrefused --read-timeout=10 localhost:8080', :acceptable_exit_codes => [0] -# sleep 180 -# shell 'wget -q --tries=180 --retry-connrefused --read-timeout=10 localhost:8080', :acceptable_exit_codes => [0] -# apply_manifest(pp_update, :catch_changes => true) -# end -# describe process("java") do it { should be_running } end @@ -92,6 +69,7 @@ class { 'jira::facts': } describe service('jira') do it { should be_enabled } + it { should be_running } end describe user('jira') do @@ -106,4 +84,16 @@ class { 'jira::facts': } it { should have_login_shell '/bin/true' } end + describe command('wget -q --tries=240 --retry-connrefused --read-timeout=10 -O- localhost:8080') do + its(:stdout) { should match /6\.2\.7/ } + end + + describe 'shutdown' do + it { shell("service jira stop", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f postgres", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f postgres", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f jira", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f jira", :acceptable_exit_codes => [0,1]) } + end + end diff --git a/spec/acceptance/mysql_spec.rb b/spec/acceptance/mysql_spec.rb new file mode 100644 index 00000000..03a94d8a --- /dev/null +++ b/spec/acceptance/mysql_spec.rb @@ -0,0 +1,110 @@ +require 'spec_helper_acceptance' + +# It is sometimes faster to host jira / java files on a local webserver. +# Set environment variable download_url to use local webserver +# export download_url = 'http://10.0.0.XXX/' +download_url = ENV['download_url'] if ENV['download_url'] +if ENV['download_url'] then + download_url = ENV['download_url'] +else + download_url = 'undef' +end +if download_url == 'undef' then + java_url = "'http://download.oracle.com/otn-pub/java/jdk/7u71-b14/'" +else + java_url = download_url +end + +describe 'jira mysql', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do + + it 'installs with mysql database' do + pp = <<-EOS + $jh = $osfamily ? { + default => '/opt/java', + } + if versioncmp($::puppetversion,'3.6.1') >= 0 { + $allow_virtual_packages = hiera('allow_virtual_packages',false) + Package { + allow_virtual => $allow_virtual_packages, + } + } + class { '::mysql::server': + root_password => 'strongpassword', + } -> + class { 'mysql::bindings': + java_enable => true, + } -> + mysql::db { 'jira': + user => 'jiraadm', + password => 'mypassword', + host => 'localhost', + grant => ['ALL'], + }-> + deploy::file { 'jdk-7u71-linux-x64.tar.gz': + target => $jh, + fetch_options => '-q -c --header "Cookie: oraclelicense=accept-securebackup-cookie"', + url => #{java_url}, + download_timout => 1800, + strip => true, + } -> + class { 'jira': + installdir => '/opt/atlassian-jira', + homedir => '/opt/jira-home', + version => '6.3.6', + downloadURL => #{download_url}, + javahome => $jh, + db => 'mysql', + dbport => '3306', + dbdriver => 'com.mysql.jdbc.Driver', + dbtype => 'mysql', + tomcatPort => '8081', + } + class { 'jira::facts': } + EOS + apply_manifest(pp, :catch_failures => true) + sleep 60 + shell 'wget -q --tries=240 --retry-connrefused --read-timeout=10 localhost:8081', :acceptable_exit_codes => [0,8] + sleep 60 + shell 'wget -q --tries=240 --retry-connrefused --read-timeout=10 localhost:8081', :acceptable_exit_codes => [0,8] + sleep 60 + apply_manifest(pp, :catch_changes => true) + end + + describe process("java") do + it { should be_running } + end + + describe port(8081) do + it { is_expected.to be_listening } + end + + describe service('jira') do + it { should be_enabled } + it { should be_running } + end + + describe user('jira') do + it { should exist } + end + + describe user('jira') do + it { should belong_to_group 'jira' } + end + + describe user('jira') do + it { should have_login_shell '/bin/true' } + end + + describe command('wget -q --tries=240 --retry-connrefused --read-timeout=10 -O- localhost:8081') do + its(:stdout) { should match /6\.3\.6/ } + end + + describe 'shutdown' do + it { shell("service jira stop", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f mysql", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f mysql", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f jira", :acceptable_exit_codes => [0,1]) } + it { shell("pkill -f jira", :acceptable_exit_codes => [0,1]) } + end + +end diff --git a/spec/classes/jira_config_spec.rb b/spec/classes/jira_config_spec.rb index d1328df6..d54ee606 100644 --- a/spec/classes/jira_config_spec.rb +++ b/spec/classes/jira_config_spec.rb @@ -12,7 +12,6 @@ it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml')} it { should contain_file('/home/jira/dbconfig.xml') .with_content(/jdbc:postgresql:\/\/localhost:5432\/jira<\/url>/) } - end context 'mysql params' do let(:params) {{ @@ -25,30 +24,6 @@ it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml')} it { should contain_file('/home/jira/dbconfig.xml') .with_content(/jdbc:mysql:\/\/localhost:5432\/jira\?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB<\/url>/) } - it { should contain_package('mysql-connector-java').with_ensure('installed')} - it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/lib/mysql-connector-java.jar') - .with( - 'ensure' => 'link', - 'target' => '/usr/share/java/mysql-connector-java.jar', - ) - } - end - context 'mysql params on Debian' do - let(:facts) { { - :osfamily => 'Debian', - }} - let(:params) {{ - :version => '6.3.4a', - :javahome => '/opt/java', - :db => 'mysql', - }} - it { should contain_package('libmysql-java').with_ensure('installed')} - it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/lib/mysql-connector-java.jar') - .with( - 'ensure' => 'link', - 'target' => '/usr/share/java/mysql.jar', - ) - } end context 'custom dburl' do let(:params) {{ @@ -59,6 +34,5 @@ it { should contain_file('/home/jira/dbconfig.xml') .with_content(/my custom dburl<\/url>/) } end - end end diff --git a/spec/classes/jira_install_deploy_spec.rb b/spec/classes/jira_install_deploy_spec.rb index f6730e54..784d38f1 100644 --- a/spec/classes/jira_install_deploy_spec.rb +++ b/spec/classes/jira_install_deploy_spec.rb @@ -27,6 +27,7 @@ 'group' => 'jira' }) end + it { should_not contain_class('jira::mysql_connector')} end context 'overwriting params' do @@ -67,6 +68,9 @@ 'group' => 'bar' }) end + + it { should_not contain_class('jira::mysql_connector')} end + end end diff --git a/spec/classes/jira_mysql_connector_spec.rb b/spec/classes/jira_mysql_connector_spec.rb new file mode 100644 index 00000000..c3b4019c --- /dev/null +++ b/spec/classes/jira_mysql_connector_spec.rb @@ -0,0 +1,67 @@ +require 'spec_helper.rb' + +describe 'jira' do + describe 'jira::mysql_connector' do + context 'mysql connector defaults' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :db => 'mysql', + :mysql_connector_version => '5.1.34', + }} + it { should contain_file('/opt/MySQL-connector').with_ensure('directory')} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/lib/mysql-connector-java.jar') + .with( + 'ensure' => 'link', + 'target' => '/opt/MySQL-connector/mysql-connector-java-5.1.34/mysql-connector-java-5.1.34-bin.jar', + ) + } + it 'should deploy mysql connector 5.1.34 from tar.gz' do + should contain_staging__file("mysql-connector-java-5.1.34.tar.gz").with({ + 'source' => 'http://cdn.mysql.com/Downloads/Connector-J/mysql-connector-java-5.1.34.tar.gz', + }) + should contain_staging__extract("mysql-connector-java-5.1.34.tar.gz").with({ + 'target' => '/opt/MySQL-connector', + 'creates' => '/opt/MySQL-connector/mysql-connector-java-5.1.34', + }) + end + end + context 'mysql connector overwrite params' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :db => 'mysql', + :mysql_connector_version => '5.1.15', + :mysql_connector_format => 'zip', + :mysql_connector_install => '/opt/foo', + :mysql_connector_URL => 'http://example.co.za/foo', + + }} + it { should contain_file('/opt/foo').with_ensure('directory')} + it { should contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/lib/mysql-connector-java.jar') + .with( + 'ensure' => 'link', + 'target' => '/opt/foo/mysql-connector-java-5.1.15/mysql-connector-java-5.1.15-bin.jar', + ) + } + it 'should deploy mysql connector 5.1.15 from zip' do + should contain_staging__file("mysql-connector-java-5.1.15.zip").with({ + 'source' => 'http://example.co.za/foo/mysql-connector-java-5.1.15.zip', + }) + should contain_staging__extract("mysql-connector-java-5.1.15.zip").with({ + 'target' => '/opt/foo', + 'creates' => '/opt/foo/mysql-connector-java-5.1.15', + }) + end + end + context 'mysql_connector_mangage equals false' do + let(:params) {{ + :version => '6.3.4a', + :javahome => '/opt/java', + :db => 'mysql', + :mysql_connector_manage => false, + }} + it { should_not contain_class('jira::mysql_connector')} + end + end +end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 5bc7db00..a5a78452 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -39,9 +39,8 @@ end on host, puppet('module','install','puppetlabs-stdlib'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','puppetlabs-postgresql'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','yguenane-repoforge'), { :acceptable_exit_codes => [0,1] } + on host, puppet('module','install','puppetlabs-mysql'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','mkrakowitzer-deploy'), { :acceptable_exit_codes => [0,1] } - on host, puppet('module','install','puppetlabs-java'), { :acceptable_exit_codes => [0,1] } on host, puppet('module','install','nanliu-staging'), { :acceptable_exit_codes => [0,1] } end end From b7d47e2e9ae94429a41fecf150238a215d987550 Mon Sep 17 00:00:00 2001 From: Merritt Krakowitzer Date: Tue, 20 Jan 2015 23:25:15 +0200 Subject: [PATCH 5/5] Add support for Oracle 11g * Add support for Oracle 11g * TODO: Class to install the Oracle Java connector * Update documentation for Oracle and Mysql. Fix some spelling errors/typos --- CHANGELOG.md | 9 ++++++--- README.md | 29 ++++++++++++++++++----------- manifests/config.pp | 2 ++ manifests/init.pp | 1 + templates/dbconfig.oracle.xml.erb | 24 ++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 templates/dbconfig.oracle.xml.erb diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b10918a..5139836f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ -##2014-XX-XX - Release 1.1.5 -- TODO - Add beaker tests for MySQL +##2014-01-21 - Release 1.1.5 +- Add beaker tests for MySQL - Added support for Oracle and Scientific Linux -- Validate all parameters - Bump jira version to 6.3.13 +- Add support for parameter 'contextpath' +- Add class to install MySQL Java connector from mysql.com + +Thanks to Oliver Bertuch for his contributions. ##2014-01-17 - Release 1.1.4 - Parameterize the lockfile variable in the init script diff --git a/README.md b/README.md index a071951a..601c24da 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,9 @@ This module installs/upgrades Atlassian's Enterprise Issue Tracking and project ###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. @@ -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. + ###Beginning with JIRA @@ -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 @@ -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'. Can be 'postgresql' or 'mysql'. +Which database to use for JIRA, defaults to 'postgresql'. Can be 'postgresql', 'mysql' or 'oracle'. #####`$dbuser` @@ -167,7 +170,7 @@ 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'. +The port of the database, defaults to '5432'. MySQL runs on '3306'. Oracle runs on '1521'. #####`$dbdriver` @@ -175,14 +178,14 @@ The database driver to use, defaults to 'org.postgresql.Driver'. Can be 'org.pos #####`$dbtype` -Database type, defaults to 'postgres72'. Can be 'postgres72', 'mysql' or 'oracle10g'. +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 #####`$dburl` -This parameter is not required nor do we recomend setting it. However it can be used to customize the database connection string. +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` @@ -308,7 +311,7 @@ Manage the JIRA service, defaults to 'running' Defaults to 'true' #####`$stop_jira` -If the jira service is managed outside of puppet the stop_jira paramater can be used to shut down jira for upgrades. Defaults to 'service jira stop && sleep 15' +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 = {}` @@ -347,7 +350,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' @@ -406,10 +409,14 @@ http://yum.puppetlabs.com/ and http://apt.puppetlabs.com/ * RedHat 6/7 * CentOS 6/7 * Scientific 6/7 -* OracleLinux 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 @@ -447,7 +454,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/'" diff --git a/manifests/config.pp b/manifests/config.pp index 225992d9..9b5d3694 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -24,12 +24,14 @@ $validationQuery = $jira::db ? { 'postgresql' => 'select version();', 'mysql' => 'select 1', + 'oracle' => 'select 1 from dual', } } if $jira::timeBetweenEvictionRuns == undef { $timeBetweenEvictionRuns = $jira::db ? { 'postgresql' => '30000', 'mysql' => '300000', + 'oracle' => '300000', } } diff --git a/manifests/init.pp b/manifests/init.pp index 688da99c..4d07e1b3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -135,6 +135,7 @@ $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}" } } diff --git a/templates/dbconfig.oracle.xml.erb b/templates/dbconfig.oracle.xml.erb new file mode 100644 index 00000000..fb9f3574 --- /dev/null +++ b/templates/dbconfig.oracle.xml.erb @@ -0,0 +1,24 @@ + + + + defaultDS + default + <%= scope.lookupvar('jira::dbtype') %> + + <%= scope.lookupvar('jira::dburl_real') %> + <%= scope.lookupvar('jira::dbdriver') %> + <%= scope.lookupvar('jira::dbuser') %> + <%= scope.lookupvar('jira::dbpassword') %> + <%= scope.lookupvar('jira::poolMinSize') %> + <%= scope.lookupvar('jira::poolMaxSize') %> + <%= scope.lookupvar('jira::poolMaxWait') %> + <%= scope.lookupvar('jira::poolMaxIdle') %> + <%= scope.lookupvar('jira::poolRemoveAbandoned') %> + <%= scope.lookupvar('jira::poolRemoveAbandonedTimout') %> + <% if @validationQuery %><%= @validationQuery %><% else %>scope.lookupvar('jira::validationQuery')<% end %> + <%= scope.lookupvar('jira::minEvictableIdleTime') %> + <% if @timeBetweenEvictionRuns %><%= @timeBetweenEvictionRuns %><% else %><%= scope.lookupvar('jira::timeBetweenEvictionRuns') %><% end %> + <%= scope.lookupvar('jira::poolTestWhileIdle') %> + <%= scope.lookupvar('jira::poolTestOnBorrow') %> + +