Puppet Class: stash

Defined in:
manifests/init.pp

Overview

Class: stash

This modules installs Atlassian stash.

Parameters:

  • javahome (Any) (defaults to: undef)
  • jvm_xms (Any) (defaults to: '256m')
  • jvm_xmx (Any) (defaults to: '1024m')
  • jvm_permgen (Any) (defaults to: '256m')
  • jvm_optional (Any) (defaults to: '-XX:-HeapDumpOnOutOfMemoryError')
  • jvm_support_recommended_args (Any) (defaults to: '')
  • java_opts (Any) (defaults to: '')
  • version (Any) (defaults to: '3.3.0')
  • product (Any) (defaults to: 'stash')
  • format (Any) (defaults to: 'tar.gz')
  • installdir (Any) (defaults to: '/opt/stash')
  • homedir (Any) (defaults to: '/home/stash')
  • user (Any) (defaults to: 'stash')
  • group (Any) (defaults to: 'stash')
  • uid (Any) (defaults to: undef)
  • gid (Any) (defaults to: undef)
  • dbuser (Any) (defaults to: 'stash')
  • dbpassword (Any) (defaults to: 'password')
  • dburl (Any) (defaults to: 'jdbc:postgresql://localhost:5432/stash')
  • dbdriver (Any) (defaults to: 'org.postgresql.Driver')
  • downloadURL (Any) (defaults to: 'http://www.atlassian.com/software/stash/downloads/binary/')
  • service_manage (Any) (defaults to: true)
  • service_ensure (Any) (defaults to: running)
  • service_enable (Any) (defaults to: true)
  • proxy (Any) (defaults to: {})
  • git_version (Any) (defaults to: 'installed')
  • repoforge (Any) (defaults to: true)
  • stop_stash (Any) (defaults to: 'service stash stop && sleep 15')
  • staging_or_deploy (Any) (defaults to: 'staging')


5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'manifests/init.pp', line 5

class stash(

  # JVM Settings
  $javahome     = undef,
  $jvm_xms      = '256m',
  $jvm_xmx      = '1024m',
  $jvm_permgen  = '256m',
  $jvm_optional = '-XX:-HeapDumpOnOutOfMemoryError',
  $jvm_support_recommended_args = '',
  $java_opts    = '',

  # Stash Settings
  $version      = '3.3.0',
  $product      = 'stash',
  $format       = 'tar.gz',
  $installdir   = '/opt/stash',
  $homedir      = '/home/stash',
  $user         = 'stash',
  $group        = 'stash',
  $uid          = undef,
  $gid          = undef,

  # Database Settings
  $dbuser       = 'stash',
  $dbpassword   = 'password',
  $dburl        = 'jdbc:postgresql://localhost:5432/stash',
  $dbdriver     = 'org.postgresql.Driver',

  # Misc Settings
  $downloadURL  = 'http://www.atlassian.com/software/stash/downloads/binary/',

  # Manage service
  $service_manage = true,
  $service_ensure = running,
  $service_enable = true,

  # Reverse https proxy
  $proxy = {},

  # Git version
  $git_version = 'installed',

  # Enable repoforge by default for RHEL, stash requires a newer version of git
  $repoforge   = true,

  # Command to stop stash in preparation to updgrade. # This is configurable 
  # incase the stash service is managed outside of puppet. eg: using the 
  # puppetlabs-corosync module: 'crm resource stop stash && sleep 15'
  $stop_stash = 'service stash stop && sleep 15',

  # Choose whether to use nanliu-staging, or mkrakowitzer-deploy
  # Defaults to nanliu-staging as it is puppetlabs approved.
  $staging_or_deploy = 'staging',

) {

  Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

  $webappdir    = "${installdir}/atlassian-${product}-${version}"

  if $::stash_version {
    # If the running version of stash is less than the expected version of stash
    # Shut it down in preparation for upgrade.
    if versioncmp($version, $::stash_version) > 0 {
      notify { 'Attempting to upgrade stash': }
      exec { $stop_stash: }
      if versioncmp($version, '3.2.0') > 0 {
        exec { "rm -f ${homedir}/stash-config.properties": }
      }
    }
  }

  anchor { 'stash::start':
  } ->
  class { 'stash::install':
    webappdir => $webappdir
  } ->
  class { 'stash::config':
  } ~>
  class { 'stash::service':
  } ->
  anchor { 'stash::end': }

}