Puppet Class: bitbucket

Inherited by:
bitbucket::facts
Defined in:
manifests/init.pp

Overview

Class: bitbucket

This modules installs Atlassian bitbucket.

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: '')
  • umask (Any) (defaults to: undef)
  • additional_env (Any) (defaults to: undef)
  • version (Any) (defaults to: '5.10.0')
  • product (Any) (defaults to: 'bitbucket')
  • format (Any) (defaults to: 'tar.gz')
  • installdir (Any) (defaults to: '/opt/bitbucket')
  • homedir (Any) (defaults to: '/home/bitbucket')
  • context_path (Any) (defaults to: '')
  • tomcat_port (Any) (defaults to: 7990)
  • manage_usr_grp (Any) (defaults to: true)
  • user (Any) (defaults to: 'atlbitbucket')
  • group (Any) (defaults to: 'atlbitbucket')
  • uid (Any) (defaults to: undef)
  • gid (Any) (defaults to: undef)
  • display_name (Any) (defaults to: 'bitbucket')
  • base_url (Any) (defaults to: "https://${::fqdn}")
  • license (Any) (defaults to: '')
  • sysadmin_username (Any) (defaults to: 'admin')
  • sysadmin_password (Any) (defaults to: 'bitbucket')
  • sysadmin_name (Any) (defaults to: 'Bitbucket Admin')
  • sysadmin_email (Any) (defaults to: '')
  • config_properties (Any) (defaults to: {})
  • dbuser (Any) (defaults to: 'bitbucket')
  • dbpassword (Any) (defaults to: 'password')
  • dburl (Any) (defaults to: 'jdbc:postgresql://localhost:5432/bitbucket')
  • dbdriver (Any) (defaults to: 'org.postgresql.Driver')
  • download_url (Any) (defaults to: 'https://downloads.atlassian.com/software/stash/downloads')
  • checksum (Any) (defaults to: undef)
  • manage_backup (Any) (defaults to: true)
  • backup_ensure (Any) (defaults to: 'present')
  • backupclient_url (Any) (defaults to: 'https://maven.atlassian.com/content/groups/public/com/atlassian/bitbucket/server/backup/bitbucket-backup-distribution')
  • backup_format (Any) (defaults to: 'zip')
  • backupclient_version (Any) (defaults to: '3.3.4')
  • backup_home (Any) (defaults to: '/opt/bitbucket-backup')
  • backupuser (Any) (defaults to: 'admin')
  • backuppass (Any) (defaults to: 'password')
  • backup_schedule_hour (Any) (defaults to: '5')
  • backup_schedule_minute (Any) (defaults to: '0')
  • backup_keep_age (Any) (defaults to: '4w')
  • service_manage (Any) (defaults to: true)
  • service_ensure (Any) (defaults to: running)
  • service_enable (Any) (defaults to: true)
  • service_options (Any) (defaults to: '')
  • proxy (Any) (defaults to: {})
  • stop_bitbucket (Any) (defaults to: 'service bitbucket stop && sleep 15')
  • deploy_module (Any) (defaults to: 'archive')


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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'manifests/init.pp', line 5

class bitbucket(

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

  # Bitbucket Settings
  $version      = '5.10.0',
  $product      = 'bitbucket',
  $format       = 'tar.gz',
  $installdir   = '/opt/bitbucket',
  $homedir      = '/home/bitbucket',
  $context_path = '',
  $tomcat_port  = 7990,

  # User and Group Management Settings
  $manage_usr_grp = true,
  $user           = 'atlbitbucket',
  $group          = 'atlbitbucket',
  $uid            = undef,
  $gid            = undef,

  # Bitbucket 4.6.0 initialization configurations
  $display_name  = 'bitbucket',
  $base_url      = "https://${::fqdn}",
  $license       = '',
  $sysadmin_username = 'admin',
  $sysadmin_password = 'bitbucket',
  $sysadmin_name  = 'Bitbucket Admin',
  $sysadmin_email = '',
  $config_properties = {},

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

  # Misc Settings
  $download_url  = 'https://downloads.atlassian.com/software/stash/downloads',
  $checksum     = undef,

  # Backup Settings
  $manage_backup          = true,
  $backup_ensure          = 'present',
  $backupclient_url       = 'https://maven.atlassian.com/content/groups/public/com/atlassian/bitbucket/server/backup/bitbucket-backup-distribution',
  $backup_format          = 'zip',
  $backupclient_version   = '3.3.4',
  $backup_home            = '/opt/bitbucket-backup',
  $backupuser             = 'admin',
  $backuppass             = 'password',
  $backup_schedule_hour   = '5',
  $backup_schedule_minute = '0',
  $backup_keep_age        = '4w',

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

  # Reverse https proxy
  $proxy = {},

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

  # Choose whether to use nanliu-staging, or puppet-archive
  $deploy_module = 'archive',

) {

  validate_hash($config_properties)

  include ::bitbucket::params

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

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

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

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

}