Puppet Class: profile::releases::common

Defined in:
modules/profile/manifests/releases/common.pp

Overview

all things common to Wikimedia releases* servers

Parameters:

  • sitename (Stdlib::Fqdn) (defaults to: lookup('profile::releases::mediawiki::sitename'))
  • deployment_server (Stdlib::Host) (defaults to: lookup('deployment_server'))
  • primary_server (Stdlib::Fqdn) (defaults to: lookup('releases_server'))
  • secondary_servers (Array[Stdlib::Fqdn]) (defaults to: lookup('releases_servers_failover'))
  • server_admin (String) (defaults to: lookup('profile::releases::mediawiki::server_admin'))


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
# File 'modules/profile/manifests/releases/common.pp', line 2

class profile::releases::common(
    Stdlib::Fqdn $sitename = lookup('profile::releases::mediawiki::sitename'),
    Stdlib::Host $deployment_server = lookup('deployment_server'),
    Stdlib::Fqdn $primary_server = lookup('releases_server'),
    Array[Stdlib::Fqdn] $secondary_servers = lookup('releases_servers_failover'),
    String $server_admin = lookup('profile::releases::mediawiki::server_admin'),
){

    # T205037
    # $motd_ensure = mediawiki::state('primary_dc') ? {
    #     $::site => 'absent',
    #     default => 'present',
    # }

    # when there is more than one releases server per DC
    # we can't rely on primary_dc alone
    $motd_ensure = $primary_server ? {
        $::fqdn => 'absent',
        default => 'present',
    }

    motd::script { 'rsync_source_warning':
        ensure   => $motd_ensure,
        priority => 1,
        content  => template('role/releases/rsync_source_warning.motd.erb'),
    }

    $all_secondary_servers = join($secondary_servers, ' ')
    $all_releases_servers = "${primary_server} ${all_secondary_servers}"
    $all_releases_servers_array = split($all_releases_servers, ' ')

    $all_releases_servers_array.each |String $releases_server| {
        unless $primary_server == $releases_server {
            # automatically sync relases files to all secondary
            # servers and ensure they are real mirrors of each other
            rsync::quickdatacopy { "srv-org-wikimedia-releases-${releases_server}":
              ensure      => present,
              auto_sync   => true,
              delete      => true,
              source_host => $primary_server,
              dest_host   => $releases_server,
              module_path => '/srv/org/wikimedia/releases',
            }
            # allow syncing jenkins data between servers for migrations
            # but do not automatically do it
            rsync::quickdatacopy { "var-lib-jenkins-${releases_server}":
              ensure      => present,
              auto_sync   => false,
              delete      => true,
              source_host => $primary_server,
              dest_host   => $releases_server,
              module_path => '/var/lib/jenkins',
            }
        }
    }

    if $::fqdn == $primary_server {
            profile::auto_restarts::service { 'rsync': }
    }

    class { '::httpd':
        modules => ['rewrite', 'headers', 'proxy', 'proxy_http'],
    }

    httpd::site { $sitename:
        content => template('releases/apache.conf.erb'),
    }

    monitoring::service { 'https_releases':
        description   => "HTTPS ${sitename}",
        check_command => "check_https_url!${sitename}!/",
        notes_url     => 'https://wikitech.wikimedia.org/wiki/Releases.wikimedia.org',
    }

    ferm::service { 'releases_http':
        proto  => 'tcp',
        port   => '80',
        srange => "(${::ipaddress} ${::ipaddress6})",
    }

    ferm::service { 'releases_http_deployment_cumin':
        proto  => 'tcp',
        port   => '80',
        srange => '($DEPLOYMENT_HOSTS $CUMIN_MASTERS)',
    }

    backup::set { 'srv-org-wikimedia': }
}