Puppet Class: statistics::sites::stats

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

Overview

Class statistics::sites::stats

stats.wikimedia.org's httpd configuration.

stats.wikimedia.org was originally Erik Zachte's wikistats files. We call this wikistats v1. wikistats v2 has superseded wikistats v1, but we still want to keep the wikistats v1 files and URLs around, as they are used and referenced by the Wikimedia community.



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

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

    $wikistats_web_directory       = '/srv/stats.wikimedia.org'
    $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,
    }

    # stats.wikimedia.org (Wikistats 2.0) setup:
    $wikistats_source_directory    = '/srv/src/wikistats-v2'
    file { ['/srv/src', $wikistats_source_directory]:
        ensure => directory,
        owner  => 'root',
        group  => 'www-data',
        mode   => '0755',
    }

    # 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],
    }

    # It is then linked to serve at http://stats.wikimedia.org/v2
    # TO BE REMOVED once redirect from /v2 -> / is set up.
    file { "${wikistats_web_directory}/htdocs/v2":
        ensure  => 'link',
        target  => "${wikistats_source_directory}/dist",
        require => File[$wikistats_source_directory],
    }

    # We want to serve wikistats 2 from the root stats.wikimedia.org domain.
    # wikistats 2 has only 2 entry URLs, index.html and assets-v2.  Symlink them
    # from the docroot.
    file { "${wikistats_web_directory}/htdocs/index.html":
        ensure  => 'link',
        target  => "${wikistats_source_directory}/dist/index.html",
        require => File[$wikistats_source_directory],
    }
    file { "${wikistats_web_directory}/htdocs/assets-v2":
        ensure  => 'link',
        target  => "${wikistats_source_directory}/dist/assets-v2",
        require => File[$wikistats_source_directory],
    }

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