Puppet Class: role::echo

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

Overview

Class: role::echo

Configures Echo, a MediaWiki notification framework.

shared_tracking_cluster

Cluster used for tracking cross-wiki notifications

shared_tracking_db

Database name used for tracking cross-wiki notifications (This DB is not Echo-only in production, and doesn't need to be here either).

echo_dir

Echo root directory

Parameters:

  • shared_tracking_cluster (Any)
  • shared_tracking_db (Any)
  • echo_dir (Any)


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

class role::echo(
    $shared_tracking_cluster,
    $shared_tracking_db,
    $echo_dir,
) {
    require ::role::mediawiki
    include ::role::betafeatures
    include ::role::centralauth
    include ::role::eventlogging
    include ::role::svg
    include ::role::langwikis

    mysql::sql { 'create echo_unread_wikis':
        sql     => "USE ${shared_tracking_db}; SOURCE ${echo_dir}/sql/mysql/tables-sharedtracking-generated.sql;",
        unless  => "SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${shared_tracking_db}' AND TABLE_NAME = 'echo_unread_wikis'",
        require => [
            Mysql::Db[$shared_tracking_db],
            Mediawiki::Extension['Echo'],
        ],
        notify  => Mediawiki::Maintenance['backfill echo_unread_wikis'],
    }

    mysql::sql { 'create echo_push_topic':
      sql     => "USE ${shared_tracking_db}; SOURCE ${echo_dir}/sql/echo_push_topic.sql;",
      unless  => "SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${shared_tracking_db}' AND TABLE_NAME = 'echo_push_topic'",
      require => [
          Mysql::Db[$shared_tracking_db],
          Mediawiki::Extension['Echo'],
      ]
    }

    mysql::sql { 'create echo_push_provider':
      sql     => "USE ${shared_tracking_db}; SOURCE ${echo_dir}/sql/echo_push_provider.sql;",
      unless  => "SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${shared_tracking_db}' AND TABLE_NAME = 'echo_push_provider'",
      require => [
          Mysql::Db[$shared_tracking_db],
          Mediawiki::Extension['Echo'],
      ]
    }

    mysql::sql { 'create echo_push_subscription':
      sql     => "USE ${shared_tracking_db}; SOURCE ${echo_dir}/sql/echo_push_subscription.sql;",
      unless  => "SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='${shared_tracking_db}' AND TABLE_NAME = 'echo_push_subscription'",
      require => [
          Mysql::Db[$shared_tracking_db],
          Mediawiki::Extension['Echo'],
      ]
    }

    mediawiki::maintenance { 'backfill echo_unread_wikis':
        command     => '/usr/local/bin/foreachwikiwithextension Echo extensions/Echo/maintenance/backfillUnreadWikis.php',
        refreshonly => true,
    }

    mediawiki::extension { 'Echo':
        needs_update => true,
        settings     => {
            wgEchoCrossWikiNotifications                                       => true,
            wgEchoSharedTrackingCluster                                        => $shared_tracking_cluster,
            wgEchoSharedTrackingDB                                             => $shared_tracking_db,
            # For now, we don't use the extension cluster for
            # wgEchoCluster, until we solve update.php.

            wgEchoEnableEmailBatch                                             => false,
            wgAllowHTMLEmail                                                   => true,
            wgEchoUseCrossWikiBetaFeature                                      => false,
            'wgDefaultUserOptions[\'echo-cross-wiki-notifications\']'          => true,
            'wgEchoConfig[\'eventlogging\'][\'Echo\'][\'enabled\']'            => true,
            'wgEchoConfig[\'eventlogging\'][\'EchoMail\'][\'enabled\']'        => true,
            'wgEchoConfig[\'eventlogging\'][\'EchoInteraction\'][\'enabled\']' => true,
        },
    }

    mediawiki::extension { 'Thanks':
        require => Mediawiki::Extension['Echo'],
    }

    $user_a = 'Selenium Echo user a'
    $user_b = 'Selenium Echo user b'
    mediawiki::user { [ $user_a, $user_b ]:
        password => $::mediawiki::admin_pass,
    }

    role::centralauth::migrate_user { [ $user_a, $user_b ]: }

    # CORS for cross-wiki notifications
    mediawiki::settings { 'echo CORS':
        values => template('role/echo/CORS.php.erb'),
    }
}