Puppet Class: statistics::sites::stats

Defined in:
modules/statistics/manifests/sites/stats.pp

Overview

Class statistics::sites::stats

stats.wikimedia.org's httpd configuration



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
# File 'modules/statistics/manifests/sites/stats.pp', line 5

class statistics::sites::stats {
    require ::statistics::web

    $wikistats_web_directory       = '/srv/stats.wikimedia.org'
    $wikistats_v2_link             = "${wikistats_web_directory}/htdocs/v2"
    $source_directory              = '/srv/src'
    $wikistats_source_directory    = '/srv/src/wikistats-v2'
    $geowiki_private_directory     = "${wikistats_web_directory}/htdocs/geowiki-private"
    $geowiki_private_htpasswd_file = '/etc/apache2/htpasswd.stats-geowiki'

    # add htpasswd file for stats.wikimedia.org
    file { '/etc/apache2/htpasswd.stats':
        owner     => 'root',
        group     => 'root',
        mode      => '0644',
        content   => secret('apache/htpasswd.stats'),
        show_diff => false,
    }

    # add htpasswd file for private geowiki data
    # TODO: remove this when the geowiki site is removed.
    file { $geowiki_private_htpasswd_file:
        ensure    => 'present',
        owner     => 'root',
        group     => 'www-data',
        mode      => '0640',
        content   => secret('apache/htpasswd.stats-geowiki'),
        show_diff => false,
    }

    # Allow rsync to /srv/stats.wikimedia.org.
    # Files are pushed here by ezachte for wikistats 1 updates.
    rsync::server::module { 'stats.wikimedia.org':
        path        => $wikistats_web_directory,
        read_only   => 'no',
        list        => 'yes',
        hosts_allow => $::statistics::servers,
        auto_ferm   => true,
    }

    httpd::site { 'stats.wikimedia.org':
        content => template('statistics/stats.wikimedia.org.erb'),
    }

    file { $source_directory:
        ensure => directory,
        owner  => 'root',
        group  => 'www-data',
        mode   => '0755',
    }

    file { $wikistats_source_directory:
        ensure  => directory,
        owner   => 'root',
        group   => 'www-data',
        mode    => '0755',
        require => File[$source_directory],
    }

    # stats.wikimedia.org/v2 (Wikistats 2.0) setup:
    # 1) wikistats v2 is cloned and has a built version available in /dist
    git::clone { 'wikistats-v2':
        ensure    => 'latest',
        directory => $wikistats_source_directory,
        branch    => 'master',
        origin    => 'https://gerrit.wikimedia.org/r/analytics/wikistats2',
        owner     => 'root',
        group     => 'www-data',
        mode      => '0755',
        require   => File[$wikistats_source_directory],
    }

    # 2) it is then linked to serve at http://stats.wikimedia.org/v2
    file { $wikistats_v2_link:
        ensure => 'link',
        target => "${wikistats_source_directory}/dist",
    }
}