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 (String) (defaults to: '3306')
  • dbslave_host (Stdlib::Fqdn) (defaults to: 'localhost')
  • dbslave_port (String) (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
# File 'modules/phabricator/manifests/tools.pp', line 6

class phabricator::tools (
    Stdlib::Fqdn $dbmaster_host       = 'localhost',
    String $dbmaster_port       = '3306',
    Stdlib::Fqdn $dbslave_host        = 'localhost',
    String $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,
) {

    if debian::codename::eq('buster') {
        package { 'python-mysqldb': ensure => present }
    } else {
        package { 'python3-mysqldb': ensure => present }
        package { 'python3-pymysql': 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"

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

    $dump_job_ensure = $dump ? {
        true    => present,
        default => absent,
    }

    systemd::timer::job { 'phabricator_task_dump':
        ensure      => present,
        user        => 'root',
        description => 'phabricator public task dump',
        command     => "/usr/bin/python3 ${dump_script}",
        interval    => {'start' => 'OnCalendar', 'interval' => 'Monday *-*-* 02:00:00'},
        require     => Package[$deploy_target],
    }
    # clean up old tmp files (T150396)
    $clean_tmp_cmd='/usr/bin/find /tmp -user www-data -mtime +14 -delete'
    systemd::timer::job { 'phabricator_clean_tmp_files':
        ensure      => present,
        user        => 'root',
        description => 'phabricator cleanup temp files',
        command     => $clean_tmp_cmd,
        interval    => {'start' => 'OnCalendar', 'interval' => '*-*-* 07:00:00'},
    }
}