Skip to content

Commit 0b202d8

Browse files
oranenjbastelfreak
andauthored
Provide option to install a java package directly via this module (#363)
* Provide option to install a java package directly via this module * Adapt acceptance test for testing with openjdk-11. Leave MySQL test to test with 1.8 still Co-authored-by: Tim Meusel <[email protected]>
1 parent 6f3ed71 commit 0b202d8

File tree

6 files changed

+54
-18
lines changed

6 files changed

+54
-18
lines changed

README.md

+23-14
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ connector directory from mysql.com as per Atlassian's documented recommendations
6969

7070
### Beginning with JIRA
7171

72-
This puppet module will automatically download the JIRA zip from Atlassian and
72+
This puppet module will automatically download the JIRA archive from Atlassian and
7373
extracts it into /opt/jira/atlassian-jira-$version. The default JIRA home is
7474
/home/jira.
7575

@@ -78,8 +78,20 @@ If you would prefer to use Hiera then see jira.yaml file for available options.
7878
#### Basic example
7979

8080
```puppet
81+
# Java 11 is managed externally and installed in /opt/java
8182
class { 'jira':
82-
javahome => '/opt/java',
83+
javahome => '/opt/java',
84+
}
85+
```
86+
87+
The module can install a package for you using your OS's package manager.
88+
Note that there's no smarts here. You need to set javahome correctly.
89+
90+
```puppet
91+
# this example works on RHEL
92+
class { 'jira':
93+
java_package => 'java-11-openjdk-headless'
94+
javahome => '/usr/lib/jvm/jre-11-opendjk/',
8395
}
8496
```
8597

@@ -94,22 +106,13 @@ The jira::facts class is required for upgrades.
94106

95107
```puppet
96108
class { 'jira':
97-
javahome => '/opt/java',
98-
version => '8.13.5',
109+
java_package => 'java-11-openjdk-headless'
110+
javahome => '/usr/lib/jvm/jre-11-opendjk/',
111+
version => '8.16.0',
99112
}
100113
class { 'jira::facts': }
101114
```
102115

103-
##### Upgrades to the JIRA puppet Module
104-
105-
puppet-archive is the default module for
106-
deploying the JIRA binaries.
107-
108-
```puppet
109-
class { 'jira':
110-
javahome => '/opt/java',
111-
}
112-
```
113116

114117
## Reference
115118

@@ -359,6 +362,11 @@ Defaults to `http://cdn.mysql.com/Downloads/Connector-J`
359362

360363
The `JAVA_HOME` directory, defaults to undef. This is a *required* parameter
361364

365+
##### `$java_package`
366+
367+
If defined, the module will install this package before it runs the JIRA service.
368+
Defaults to undef.
369+
362370
##### `$jvm_xms`
363371

364372
The initial memory allocation pool for a Java Virtual Machine.
@@ -593,6 +601,7 @@ Some more crowd.properties for SSO, see atlassian documentation for details
593601
group => 'jira',
594602
dbpassword => 'secret',
595603
dbserver => 'localhost',
604+
java_package => 'java-11-openjdk-headless',
596605
javahome => '/usr/lib/jvm/jre-11-openjdk/',
597606
download_url => 'http://myserver/pub/development-tools/atlassian/',
598607
tomcat_additional_connectors => {

manifests/init.pp

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
Optional[Boolean] $pool_test_while_idle = undef,
8484
Optional[Boolean] $pool_test_on_borrow = undef,
8585
# JVM Settings
86+
Optional[String[1]] $java_package = undef,
8687
Optional[Stdlib::AbsolutePath] $javahome = undef,
8788
Jira::Jvm_types $jvm_type = 'openjdk-11',
8889
String $jvm_xms = '256m',

manifests/install.pp

+6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
4848
}
4949
}
5050

51+
if $jira::java_package {
52+
package { $jira::java_package:
53+
ensure => 'present',
54+
}
55+
}
56+
5157
$file = "atlassian-${jira::product_name}-${jira::version}.tar.gz"
5258

5359
# webappdir is defined in init.pp because other things depend on it.

spec/acceptance/default_parameters_spec.rb

+11-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
describe 'jira postgresql' do
44
it 'installs with defaults' do
55
pp = <<-EOS
6-
class { 'java':
7-
distribution => 'jre',
6+
$java_package = $facts['os']['family'] ? {
7+
'RedHat' => 'java-11-openjdk-headless',
8+
'Debian' => 'openjdk-11-jre-headless',
9+
}
10+
11+
$java_home = $facts['os']['family'] ? {
12+
'RedHat' => '/usr/lib/jvm/jre-11-openjdk',
13+
'Debian' => '/usr/lib/jvm/java-1.11.0-openjdk-amd64',
814
}
915
1016
class { 'postgresql::server': }
@@ -15,8 +21,9 @@ class { 'postgresql::server': }
1521
}
1622
1723
class { 'jira':
18-
javahome => '/usr',
19-
require => [Class['java'], Postgresql::Server::Db['jira']],
24+
java_package => $java_package,
25+
javahome => $java_home,
26+
require => Postgresql::Server::Db['jira'],
2027
}
2128
2229
class { 'jira::facts': }

spec/acceptance/mysql_spec.rb

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class { 'jira':
3838
installdir => '/opt/atlassian-jira',
3939
homedir => '/opt/jira-home',
4040
javahome => '/usr',
41+
jvm_type => 'oracle-jdk-1.8',
4142
db => 'mysql',
4243
dbport => 3306,
4344
dbdriver => 'com.mysql.jdbc.Driver',

spec/classes/jira_config_spec.rb

+12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@
3535
it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/check-java.sh') }
3636
end
3737

38+
context 'default params with java install' do
39+
let(:params) do
40+
{
41+
javahome: '/usr/lib/jvm/jre-11-openjdk',
42+
java_package: 'java-11-openjdk-headless',
43+
}
44+
end
45+
46+
it { is_expected.to compile.with_all_deps }
47+
it { is_expected.to contain_package('java-11-openjdk-headless') }
48+
end
49+
3850
context 'database settings' do
3951
let(:params) do
4052
{

0 commit comments

Comments
 (0)