Puppet Class: profile::mediawiki::maintenance

Defined in:
modules/profile/manifests/mediawiki/maintenance.pp

Overview

mediawiki maintenance server

Parameters:

  • deployment_server (Stdlib::Host) (defaults to: lookup('deployment_server'))


2
3
4
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'modules/profile/manifests/mediawiki/maintenance.pp', line 2

class profile::mediawiki::maintenance (
    Stdlib::Host $deployment_server = lookup('deployment_server'),
){
    # In order to be able to use the conftool-aware wrapper, we need to access
    # such data easily (on disk).
    require ::profile::conftool::state

    # httpd for noc.wikimedia.org
    class { '::httpd':
        modules => ['rewrite', 'headers'],
    }

    # firewall: allow http from deployment servers for testing with httpbb
    ferm::service { 'deploy-http-mwmaint':
        proto  => 'tcp',
        port   => 80,
        srange => "(@resolve((${deployment_server})) @resolve((${deployment_server}), AAAA))"
    }

    # Set the Server response header to the FQDN. (T255629)
    # Installing libapache2-mod-security2 without also installing modsecurity-crs
    # leads to a syntax error due to a bug in the former package which has
    # an include that is supposed to be optional but isn't optional. --dz 20200803
    package { [ 'libapache2-mod-security2', 'modsecurity-crs']:
        ensure => present
    }
    ::httpd::mod_conf { 'security2':
    }
    ::httpd::conf { 'server_header':
        content  => template('mediawiki/apache/server-header.conf.erb'),
    }

    # Deployment
    include ::scap::scripts

    file { $::mediawiki::scap::mediawiki_staging_dir:
        ensure => link,
        target => '/srv/mediawiki'
    }

    if $::realm != 'labs' {
        $ensure = mediawiki::state('primary_dc') ? {
            $::site => 'present',
            default => 'absent',
        }
    } else {
        $ensure = 'present'
    }

    file { '/usr/local/bin/mw-cli-wrapper':
        source => 'puppet:///modules/profile/mediawiki/maintenance/mw-cli-wrapper.py',
        owner  => 'root',
        group  => 'root',
        mode   => '0555'
    }

    # MediaWiki maintenance scripts (periodic jobs)
    include ::profile::mediawiki::maintenance::wikidata
    include ::profile::mediawiki::maintenance::growthexperiments
    include ::profile::mediawiki::maintenance::mediamoderation
    include ::profile::mediawiki::maintenance::globalblocking
    include ::profile::mediawiki::maintenance::pagetriage
    include ::profile::mediawiki::maintenance::translationnotifications
    include ::profile::mediawiki::maintenance::updatetranslationstats
    include ::profile::mediawiki::maintenance::echo_mail_batch
    include ::profile::mediawiki::maintenance::parsercachepurging
    include ::profile::mediawiki::maintenance::cleanup_upload_stash
    include ::profile::mediawiki::maintenance::update_flaggedrev_stats
    include ::profile::mediawiki::maintenance::refreshlinks
    include ::profile::mediawiki::maintenance::update_special_pages
    include ::profile::mediawiki::maintenance::purge_abusefilter
    include ::profile::mediawiki::maintenance::purge_checkuser
    include ::profile::mediawiki::maintenance::purge_expired_userrights
    include ::profile::mediawiki::maintenance::purge_old_cx_drafts
    include ::profile::mediawiki::maintenance::purge_securepoll
    include ::profile::mediawiki::maintenance::db_lag_stats
    include ::profile::mediawiki::maintenance::cirrussearch
    include ::profile::mediawiki::maintenance::generatecaptcha
    include ::profile::mediawiki::maintenance::pageassessments
    class { 'mediawiki::maintenance::uploads': ensure => $ensure }
    include ::profile::mediawiki::maintenance::readinglists
    include ::profile::mediawiki::maintenance::initsitestats
    include ::profile::mediawiki::maintenance::startupregistrystats
    include ::profile::mediawiki::maintenance::temporary_accounts
    include ::profile::mediawiki::maintenance::recount_categories
    include ::profile::mediawiki::maintenance::purge_expired_blocks
    include ::profile::mediawiki::maintenance::image_suggestions
    include ::profile::mediawiki::maintenance::campaignevents
    include ::profile::mediawiki::maintenance::purge_loginnotify

    # Include the cache warmup script; requires node and conftool
    require ::profile::conftool::client
    class { '::mediawiki::maintenance::cache_warmup':
        ensure => present,
    }

    # backup home directories to bacula, people work on these
    include ::profile::backup::host
    backup::set {'home': }

    # (T17434) Periodical run of currently disabled special pages
    include ::profile::mediawiki::maintenance::updatequerypages

    # Readline support for PHP maintenance scripts (T126262)
    ensure_packages('php-readline')

    # Make sure to install php-readline from the component/php72, otherwise this picks up
    # the 7.3 version from default buster
    apt::package_from_component { 'php-readline':
        component => 'component/php72',
        packages  => ['php-readline']
    }

    # GNU version of 'time' provides extra info like peak resident memory
    # anomie needs it, as opposed to the shell built-in time command
    ensure_packages('time')

    # T112660 - kafka support
    # The eventlogging code is useful for scripting
    # EventLogging consumers.  Install this but don't
    # run any daemons.  To use eventlogging code,
    # add /srv/deployment/eventlogging/eventlogging
    # to your PYTHONPATH or sys.path.
    include ::eventlogging

    rsync::quickdatacopy { 'home-mwmaint':
        ensure      => present,
        auto_sync   => false,
        source_host => 'mwmaint1002.eqiad.wmnet',
        dest_host   => 'mwmaint2002.codfw.wmnet',
        module_path => '/home',
    }

    if $::realm != 'labs' {
    # T199124
        $motd_ensure = $ensure ? {
            'present' => 'absent',
            'absent'  => 'present',
            default   => 'present',
        }
    } else {
        $motd_ensure = 'absent'
    }

    motd::script { 'inactive_warning':
        ensure   => $motd_ensure,
        priority => 1,
        content  => template('profile/mediawiki/maintenance/inactive.motd.erb'),
    }
}