Skip to content

Commit cfdc626

Browse files
committed
Merge pull request #4 from mkrakowitzer/master
refactored module.
2 parents 58786a3 + 508a427 commit cfdc626

14 files changed

Lines changed: 239 additions & 195 deletions

Modulefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name 'brycejohnson-jira'
2+
version '0.0.2'
3+
source 'https://github.com/brycejohnson/puppet-jira.git'
4+
author 'brycejohnson'
5+
license 'Apache License, Version 2.0'
6+
summary 'Module to install Jira'
7+
description 'Module to install Jira'
8+
project_page 'https://github.com/brycejohnson/puppet-jira/blob/master/README.md'
9+
10+
## Add dependencies, if any:
11+
dependency 'mkrakowitzer/deploy', '>= 0.0.1'

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,20 @@ variables are then defined in the module's `params.pp`.
1616

1717
### Puppet
1818

19-
Puppet 3.0+ is required as this module leverages hiera
20-
21-
Puppet itself requires:
22-
23-
* ruby
24-
* rubygems
25-
* Ruby Augeas http://pkgs.repoforge.org/ruby-augeas/
26-
* Ruby Shadow http://pkgs.repoforge.org/ruby-shadow/
27-
* Ruby JSON http://pkgs.repoforge.org/ruby-json/
28-
29-
Hiera requires that you build a `hiera.yaml` configuration file in `/etc/puppet`
19+
Tested on Puppet 3.0+
20+
Puppet 2.7+ should work as Hiera is now optional.
3021

3122
The puppetlabs production yum repository can be found at:
3223
http://yum.puppetlabs.com/el/6/products/x86_64
3324

3425
### Operating Systems
35-
* MacOS: UNSUPPORTED
36-
* Linux: RedHat (Debian untested)
37-
* Windows: UNSUPPORTED
26+
* Linux: RedHat / Centos 5/6 - tested.
27+
* Linux: Ubuntu 12.04 - tested.
3828

3929
### Databases
4030
* Postgres
4131
* MySQL (untested)
4232

43-
4433
### Before you begin
4534
It is your responsibility to backup your database. Especially do so
4635
if you are installing to an existing installation of jira as this module
@@ -54,7 +43,6 @@ I have my own postgres puppet module that installs pg, creates the JIRA
5443
database, and the JIRA database user before the JIRA puppet module runs.
5544

5645
Make sure you have a JAVA_HOME and appropriate java installed on your machine.
57-
Recommended is JDK 1.6u33+ and not JDK 1.7+
5846

5947
Did I mention if you are upgrading, BACKUP your database first? This module
6048
makes no warranty on your data, per its license.
@@ -63,15 +51,26 @@ makes no warranty on your data, per its license.
6351

6452
This puppet module will automatically download the jira zip from Atlassian
6553
and extract it into /opt/jira/atlassian-jira-$version
54+
55+
This module requires: https://github.com/mkrakowitzer/puppet-deploy.git
6656

67-
You will also need to enter in the directory to your jira-home, which should
68-
also be kept in the hiera yaml, for example {{jira.yaml}}.
69-
70-
Once you have installed the yaml information, then run puppet apply with
71-
this module included in the modulepath.
72-
57+
An example on how to use this module:
58+
59+
class { 'jira':
60+
version => '6.0.1',
61+
installdir => '/opt/atlassian-jira',
62+
homedir => '/opt/atlassian-jira/jira-home',
63+
user => 'jira',
64+
group => 'jira',
65+
dbpassword => 'secret',
66+
dbserver => 'localhost',
67+
javahome => '/opt/java/jdk1.7.0_21/',
68+
downloadURL => 'http://myserver/pub/development-tools/atlassian/',
69+
}
70+
71+
If you would prefer to use Hiera then see jira.yaml file for an example.
72+
7373
### Fixes and Future Work
7474
Please feel free to raise any issues here for fixes. I'm happy to fix them
7575
up. Also feel free to make a pull request for anything so I can hopefully
7676
get it in.
77-

jira.yaml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,51 +18,59 @@
1818
# 2.) Modify the database settings below according to your setup
1919
#
2020
# Atlassian jira Git Enterprise Source Control Server
21-
jira_name: jira
22-
jira_version: 5.1.7
23-
jira_package_format: zip
21+
jira::jira_name: jira
22+
jira::jira_version: 5.1.7
23+
jira::jira_package_format: tar.gz
2424

2525
# Directory where the webapp will run from
26-
jira_install_dir: /opt/jira
26+
jira::jira_install_dir: /opt/jira
2727
# If you can put this on another filesystem, and even better, a fs that's
2828
# on another physical disk, you will be happier, but not required
29-
jira_home_dir: /opt/jira-home
29+
jira::jira_home_dir: /opt/jira-home
30+
# What user should jira run as
31+
# Puppet will make the user
32+
jira::user: jira
33+
jira::group: jira
3034

3135
# Database configuration - please change these according to your setup
3236
# Comment out or uncomment for your db product as this value is also
3337
# overloaded as the jdbc driver db
34-
jira_db: postgresql
35-
#jira_db: mysql
36-
#jira_db: oracle
38+
jira::jira_db: postgresql
39+
#jira::jira_db: mysql
40+
#jira::jira_db: oracle
3741

38-
jira_dbtype: postgres72
42+
jira::jira_dbtype: postgres72
3943
#jira_dbtype: mysql
4044

41-
jira_dbdriver: org.postgresql.Driver
45+
jira::jira_dbdriver: org.postgresql.Driver
4246
#jira_dbdriver: com.mysql.jdbc.Driver
4347

4448
# Change these values to your jira database credentials
45-
jira_dbuser: jiraadm
46-
jira_dbpassword: jiraadm
49+
jira::jira_dbuser: jiraadm
50+
jira::jira_dbpassword: jiraadm
4751

48-
jira_dbname: jira
52+
jira::jira_dbname: jira
4953
# Change port depending on your db product
50-
jira_dbport: 5432
51-
#jira_dbport: 3306
52-
#jira_dbport: 1521
54+
jira::jira_dbport: 5432
55+
#jira::jira_dbport: 3306
56+
#jira::jira_dbport: 1521
57+
58+
# The connection pool size
59+
jira::poolsize: 15
5360

5461
# Change if your database isn't on localhost. This module will only check
5562
# to make sure that the service is running and start it if it is not on
5663
# localhost db's only. So if your remote database, which is suggested, isn't
5764
# available, that's your fault.
58-
jira_dbserver: localhost
65+
jira::jira_dbserver: localhost
5966

6067
# Tomcat configuration
6168
# TODO because I'm never a fan of the stock tomcat settings
62-
jira_javahome: /opt/java/jdk1.6.0_33
63-
jira_jvm_xmx: 1024m
64-
jira_jvm_optional: -XX:-HeapDumpOnOutOfMemoryError
69+
jira::jira_javahome: /opt/java/jdk1.6.0_33
70+
jira::jira_jvm_xmx: 1024m
71+
jira::jira_jvm_optional: -XX:-HeapDumpOnOutOfMemoryError
6572
#jira_jvm_optional: -XX:NewSize=256m -XX:MaxNewSize=256m -XX:SurvivorRatio=16
6673
# the New and SR figures are purely optional
6774
# for heap dumps add -XX:-HeapDumpOnOutOfMemoryError
6875
# by default jira has 256m permgen which is a good setting to go with
76+
jira::downloadURL: "http://www.atlassian.com/software/jira/downloads/binary/"

manifests/config.pp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#-----------------------------------------------------------------------------
16-
class jira::config{
16+
class jira::config {
1717

18-
require jira::params
18+
require jira
1919

20-
exec { 'mkdirp-homedir-jira':
21-
cwd => "${jira::params::tmpdir}",
22-
command => "/bin/mkdir -p ${jira::params::homedir}",
23-
creates => "${jira::params::homedir}"
20+
File {
21+
owner => $jira::user,
22+
group => $jira::group,
2423
}
2524

26-
file { "${jira::params::webappdir}/bin/setenv.sh":
25+
file { "${jira::webappdir}/bin/user.sh":
26+
content => template('jira/user.sh.erb'),
27+
mode => '0755',
28+
require => [
29+
Class['jira::install'],
30+
File[$jira::webappdir],
31+
File[$jira::homedir]
32+
],
33+
} ->
34+
35+
file { "${jira::webappdir}/bin/setenv.sh":
2736
content => template('jira/setenv.sh.erb'),
2837
mode => '0755',
2938
require => Class['jira::install'],
3039
notify => Class['jira::service'],
40+
} ->
41+
42+
file { "${jira::homedir}/dbconfig.xml":
43+
content => template("jira/dbconfig.${jira::db}.xml.erb"),
44+
mode => '0600',
45+
require => [ Class['jira::install'],File[$jira::homedir] ],
46+
notify => Class['jira::service'],
3147
}
32-
33-
if "${jira::params::db}" == 'postgresql' {
34-
file { "${jira::params::homedir}/dbconfig.xml":
35-
content => template('jira/dbconfig.postgres.xml.erb'),
36-
mode => '0600',
37-
require => [Class['jira::install'],Exec['mkdirp-homedir-jira']],
38-
notify => Class['jira::service'],
39-
}
40-
}
41-
if "${jira::params::db}" == 'mysql' {
42-
file { "${jira::params::homedir}/dbconfig.xml":
43-
content => template('jira/dbconfig.mysql.xml.erb'),
44-
mode => '0600',
45-
require => [Class['jira::install'],Exec['mkdirp-homedir-jira']],
46-
notify => Class['jira::service'],
47-
}
48-
}
49-
}
48+
49+
}

manifests/init.pp

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,79 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#-----------------------------------------------------------------------------
16+
# == Class: jira
17+
#
18+
# This module is used to install Jira.
19+
# I have tested it with version 6.0 and upgarded to 6.0.1 succesfully.
20+
#
21+
# This module requires mkrakowitzer-deploy
22+
#
23+
# === Parameters
24+
#
25+
# See jira.yaml for a complete list of parameters
26+
#
27+
# === Examples
28+
#
29+
# class { 'jira':
30+
# version => '6.0.1',
31+
# installdir => '/opt/atlassian/atlassian-jira',
32+
# homedir => '/opt/atlassian/atlassian-jira/jira-home',
33+
# user => 'jira',
34+
# group => 'jira',
35+
# dbpassword => 'mysecret',
36+
# dbserver => 'devecodb1',
37+
# javahome => '/opt/development-tools/java/jdk1.7.0_21/',
38+
# downloadURL => 'http://myurl/pub/software/atlassian/',
39+
# }
40+
#
41+
# === Authors
42+
#
43+
# Bryce Johnson
44+
# Merritt Krakowitzer
45+
#
46+
# === Copyright
47+
#
48+
# Copyright (c) 2012 Bryce Johnson
49+
#
50+
# Published under the Apache License, Version 2.0
51+
#
52+
class jira (
53+
54+
# JVM Settings
55+
$javahome,
56+
$jvm_xmx = '1024m',
57+
$jvm_optional = '-XX:-HeapDumpOnOutOfMemoryError',
58+
59+
# Jira Settings
60+
$version = '6.0',
61+
$product = 'jira',
62+
$format = 'tar.gz',
63+
$installdir = '/opt/jira',
64+
$homedir = '/home/jira',
65+
$user = 'root',
66+
$group = 'root',
67+
68+
# Database Settings
69+
$db = 'postgresql',
70+
$dbuser = 'jiraadm',
71+
$dbpassword = 'mypassword',
72+
$dbserver = 'localhost',
73+
$dbname = 'jira',
74+
$dbport = '5432',
75+
$dbdriver = 'org.postgresql.Driver',
76+
$dbtype = 'postgres72',
77+
$poolsize = '15',
78+
79+
# Misc Settings
80+
$downloadURL = 'http://www.atlassian.com/software/jira/downloads/binary/',
81+
82+
) {
83+
84+
$webappdir = "${installdir}/atlassian-${product}-${version}-standalone"
85+
$dburl = "jdbc:${db}://${dbserver}:${dbport}/${dbname}"
1686

17-
class jira {
18-
include jira::params
1987
include jira::install
2088
include jira::config
2189
include jira::service
90+
2291
}

manifests/install.pp

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,41 @@
1515
#-----------------------------------------------------------------------------
1616
class jira::install {
1717

18-
require jira::params
18+
require jira
1919

20-
case $::osfamily {
21-
'Darwin' : { # assuming you did download wget - ill maybe fix this and check for it
22-
exec { 'wget-jira-package':
23-
cwd => "${jira::params::tmpdir}",
24-
command => "${jira::params::cmdwget} --no-check-certificate ${jira::params::downloadURL}",
25-
creates => "${jira::params::tmpdir}/atlassian-${jira::params::product}-${jira::params::version}.${jira::params::format}",
26-
}
27-
}
28-
default : {
29-
exec { 'wget-jira-package':
30-
cwd => "${jira::params::tmpdir}",
31-
command => "${jira::params::cmdwget} --no-check-certificate ${jira::params::downloadURL}",
32-
creates => "${jira::params::tmpdir}/atlassian-${jira::params::product}-${jira::params::version}.${jira::params::format}",
33-
}
34-
}
35-
}
20+
deploy::file { "atlassian-${jira::product}-${jira::version}.${jira::format}":
21+
target => "${jira::installdir}/atlassian-${jira::product}-${jira::version}-standalone",
22+
url => $jira::downloadURL,
23+
strip => true,
24+
notify => Exec["chown_${jira::webappdir}"],
25+
} ->
3626

37-
exec { 'mkdirp-installdir-jira':
38-
cwd => "${jira::params::tmpdir}",
39-
command => "/bin/mkdir -p ${jira::params::installdir}",
40-
creates => "${jira::params::installdir}",
41-
}
42-
exec { 'unzip-jira-package':
43-
cwd => "${jira::params::installdir}",
44-
command => "/usr/bin/unzip -o -d ${jira::params::installdir} ${jira::params::tmpdir}/atlassian-${jira::params::product}-${jira::params::version}.${jira::params::format}",
45-
creates => "${jira::params::webappdir}",
46-
require => [Exec['wget-jira-package'],Exec['mkdirp-installdir-jira']],
47-
}
27+
user { $jira::user:
28+
comment => 'Jira daemon account',
29+
shell => '/bin/true',
30+
home => $jira::homedir,
31+
password => '*',
32+
password_min_age => '0',
33+
password_max_age => '99999',
34+
managehome => true,
35+
} ->
4836

49-
file { '/etc/rc.d/init.d/jira':
37+
file { $jira::homedir:
38+
ensure => 'directory',
39+
owner => 'jira',
40+
group => 'jira',
41+
recurse => true,
42+
} ->
43+
44+
exec { "chown_${jira::webappdir}":
45+
command => "/bin/chown -R ${jira::user}:${jira::group} ${jira::webappdir}",
46+
refreshonly => true,
47+
subscribe => User[$jira::user]
48+
} ->
49+
50+
file { '/etc/init.d/jira':
5051
content => template('jira/etc/rc.d/init.d/jira.erb'),
5152
mode => '0755',
5253
}
54+
5355
}

0 commit comments

Comments
 (0)