Puppet Class: role::simple_performant

Defined in:
puppet/modules/role/manifests/simple_performant.pp

Overview

Class: role::simple_performant

This class configures MediaWiki to be slightly more performant, with simple enough things and without sacrificing functionality, except that it caches almost everything for 30 days. It's designed for smallish wikis: if you receive consistent traffic, do your homework. See www.mediawiki.org/wiki/Manual:Performance_tuning



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
# File 'puppet/modules/role/manifests/simple_performant.pp', line 8

class role::simple_performant {
    require ::role::mediawiki
    include ::role::thumb_on_404
    include ::role::wikidiff2
    include ::apache::mod::expires

    require_package('unzip')

    $day         = 24 * 60 * 60
    $cache_accel = 3
    $cache_db    = 1

    php::ini { 'simple_performant':
        settings => { realpath_cache_size => '512K' },
    }

    mediawiki::settings { 'simple_performant':
        values => {
            wgCacheDirectory        => '/var/cache/mediawiki',
            wgMainCacheType         => $cache_accel,
            wgParserCacheType       => $cache_db,
            wgJobRunRate            => 0,
            wgEnableSidebarCache    => true,
            wgParserCacheExpireTime => 30 * $day,
            wgResourceLoaderMaxage  => {
                'unversioned' => $day,
                'versioned'   => 30 * $day,
            },
        },
        notify => Mediawiki::Maintenance['rebuild_localisation_cache'],
    }

    mediawiki::maintenance { 'rebuild_localisation_cache':
        command     => '/usr/local/bin/mwscript rebuildLocalisationCache.php --force',
        refreshonly => true,
        require     => Class['::mediawiki::multiwiki'],
    }

    $expires_active  = 'ExpiresActive On'
    $expires_default = 'ExpiresDefault "access plus 1 month"'

    apache::site_conf { 'expires':
        site    => $::mediawiki::wiki_name,
        content => "${expires_active}\n${expires_default}\n",
        require => Class['::apache::mod::expires'],
    }

    file { '/vagrant/mediawiki/skins/.htaccess':
        ensure  => present,
        source  => 'puppet:///modules/role/simple_performant/skins-htaccess',
        require => Class['::apache::mod::expires'],
    }
}