Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide jira::java_package option to allow installing a java package directly via this module #363

Merged
merged 3 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 23 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ connector directory from mysql.com as per Atlassian's documented recommendations

### Beginning with JIRA

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

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

```puppet
# Java 11 is managed externally and installed in /opt/java
class { 'jira':
javahome => '/opt/java',
javahome => '/opt/java',
}
```

The module can install a package for you using your OS's package manager.
Note that there's no smarts here. You need to set javahome correctly.

```puppet
# this example works on RHEL
class { 'jira':
java_package => 'java-11-openjdk-headless'
javahome => '/usr/lib/jvm/jre-11-opendjk/',
}
```

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

```puppet
class { 'jira':
javahome => '/opt/java',
version => '8.13.5',
java_package => 'java-11-openjdk-headless'
javahome => '/usr/lib/jvm/jre-11-opendjk/',
version => '8.16.0',
}
class { 'jira::facts': }
```

##### Upgrades to the JIRA puppet Module

puppet-archive is the default module for
deploying the JIRA binaries.

```puppet
class { 'jira':
javahome => '/opt/java',
}
```

## Reference

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

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

##### `$java_package`

If defined, the module will install this package before it runs the JIRA service.
Defaults to undef.

##### `$jvm_xms`

The initial memory allocation pool for a Java Virtual Machine.
Expand Down Expand Up @@ -593,6 +601,7 @@ Some more crowd.properties for SSO, see atlassian documentation for details
group => 'jira',
dbpassword => 'secret',
dbserver => 'localhost',
java_package => 'java-11-openjdk-headless',
javahome => '/usr/lib/jvm/jre-11-openjdk/',
download_url => 'http://myserver/pub/development-tools/atlassian/',
tomcat_additional_connectors => {
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
Optional[Boolean] $pool_test_while_idle = undef,
Optional[Boolean] $pool_test_on_borrow = undef,
# JVM Settings
Optional[String[1]] $java_package = undef,
Optional[Stdlib::AbsolutePath] $javahome = undef,
Jira::Jvm_types $jvm_type = 'openjdk-11',
String $jvm_xms = '256m',
Expand Down
6 changes: 6 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
}
}

if $jira::java_package {
package { $jira::java_package:
ensure => 'present',
}
}

$file = "atlassian-${jira::product_name}-${jira::version}.tar.gz"

# webappdir is defined in init.pp because other things depend on it.
Expand Down
15 changes: 11 additions & 4 deletions spec/acceptance/default_parameters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@
describe 'jira postgresql' do
it 'installs with defaults' do
pp = <<-EOS
class { 'java':
distribution => 'jre',
$java_package = $facts['os']['family'] ? {
'RedHat' => 'java-11-openjdk-headless',
'Debian' => 'openjdk-11-jre-headless',
}

$java_home = $facts['os']['family'] ? {
'RedHat' => '/usr/lib/jvm/jre-11-openjdk',
'Debian' => '/usr/lib/jvm/java-1.11.0-openjdk-amd64',
}

class { 'postgresql::server': }
Expand All @@ -15,8 +21,9 @@ class { 'postgresql::server': }
}

class { 'jira':
javahome => '/usr',
require => [Class['java'], Postgresql::Server::Db['jira']],
java_package => $java_package,
javahome => $java_home,
require => Postgresql::Server::Db['jira'],
}

class { 'jira::facts': }
Expand Down
1 change: 1 addition & 0 deletions spec/acceptance/mysql_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class { 'jira':
installdir => '/opt/atlassian-jira',
homedir => '/opt/jira-home',
javahome => '/usr',
jvm_type => 'oracle-jdk-1.8',
db => 'mysql',
dbport => 3306,
dbdriver => 'com.mysql.jdbc.Driver',
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/jira_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@
it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-software-8.13.5-standalone/bin/check-java.sh') }
end

context 'default params with java install' do
let(:params) do
{
javahome: '/usr/lib/jvm/jre-11-openjdk',
java_package: 'java-11-openjdk-headless',
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('java-11-openjdk-headless') }
end

context 'database settings' do
let(:params) do
{
Expand Down