Puppet Class: phabricator::tools

Defined in:
modules/phabricator/manifests/tools.pp

Overview

Class: phabricator::tools

Tools and such needed to migrate 3rd party content and perform administrative tasks.

Parameters:

  • dbmaster_host (Stdlib::Fqdn) (defaults to: 'localhost')
  • dbmaster_port (Integer) (defaults to: 3306)
  • dbslave_host (Stdlib::Fqdn) (defaults to: 'localhost')
  • dbslave_port (Integer) (defaults to: 3323)
  • directory (Stdlib::Unixpath) (defaults to: '/srv/phab/tools')
  • deploy_target (String) (defaults to: 'phabricator/deployment')
  • manifest_user (String) (defaults to: '')
  • manifest_pass (String) (defaults to: '')
  • app_user (String) (defaults to: '')
  • app_pass (String) (defaults to: '')
  • bz_user (String) (defaults to: '')
  • bz_pass (String) (defaults to: '')
  • rt_user (String) (defaults to: '')
  • rt_pass (String) (defaults to: '')
  • phabtools_cert (String) (defaults to: '')
  • phabtools_user (String) (defaults to: '')
  • gerritbot_token (String) (defaults to: '')
  • dump (Boolean) (defaults to: false)


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
# File 'modules/phabricator/manifests/tools.pp', line 6

class phabricator::tools (
    Stdlib::Fqdn $dbmaster_host       = 'localhost',
    Integer $dbmaster_port      = 3306,
    Stdlib::Fqdn $dbslave_host        = 'localhost',
    Integer $dbslave_port       = 3323,
    Stdlib::Unixpath $directory = '/srv/phab/tools',
    String $deploy_target       = 'phabricator/deployment',
    String $manifest_user       = '',
    String $manifest_pass       = '',
    String $app_user            = '',
    String $app_pass            = '',
    String $bz_user             = '',
    String $bz_pass             = '',
    String $rt_user             = '',
    String $rt_pass             = '',
    String $phabtools_cert      = '',
    String $phabtools_user      = '',
    String $gerritbot_token     = '',
    Boolean $dump               = false,
) {

    package { 'python-mysqldb': ensure => present }

    file { '/etc/phabtools.conf':
        content => template('phabricator/phabtools.conf.erb'),
        require => Package[$deploy_target],
        owner   => 'root',
        group   => 'root',
        mode    => '0660',
    }

    file { '/srv/dumps':
        ensure => 'directory',
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    file { '/srv/dumps/WARNING_NEVER_PUT_PRIVATE_DATA_HERE_THIS_IS_SYNCED_TO_PUBLIC':
        ensure => 'present',
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
    }

    $dump_script = "${directory}/public_task_dump.py 1>/dev/null"

    file { $dump_script:
        mode    => '0555',
        require => Package[$deploy_target],
    }

    $dump_cron_ensure = $dump ? {
        true    => present,
        default => absent,
    }
    cron { $dump_script:
        ensure  => $dump_cron_ensure,
        command => $dump_script,
        user    => root,
        hour    => '2',
        minute  => '0',
        require => Package[$deploy_target],
    }

    # These bz_*_update jobs require the bugzilla_migration DB
    # The equivalent rt_*_update crons which are not present
    # at the moment require the rt_migration DB.

    $bz_header = '/var/run/bz_header.flock'
    cron { 'bz_header_update':
        ensure  => absent,
        command => "/usr/bin/flock -n ${bz_header} -c '/srv/phab/tools/bugzilla_update_user_header.py -a' >/dev/null 2>&1",
        user    => root,
        hour    => '0',
        require => Package[$deploy_target],
    }

    $bz_comments = '/var/run/bz_comments.flock'
    cron { 'bz_comment_update':
        ensure  => absent,
        command => "/usr/bin/flock -n ${bz_comments} -c '/srv/phab/tools/bugzilla_update_user_comments.py -a' >/dev/null 2>&1",
        user    => root,
        hour    => '1',
        require => Package[$deploy_target],
    }

    # clean up old tmp files (T150396)
    cron { 'phab_clean_tmp':
        ensure  => present,
        command => '/usr/bin/find /tmp -user www-data -mtime +14 | xargs rm -rf',
        user    => 'www-data',
        hour    => '7',
    }
}