Puppet Class: gerrit::proxy

Defined in:
modules/gerrit/manifests/proxy.pp

Overview

sets up a TLS proxy for Gerrit

Parameters:

  • ipv4 (Stdlib::Ipv4)
  • host (Stdlib::Fqdn) (defaults to: $::gerrit::host)
  • replica (Boolean) (defaults to: false)
  • maint_mode (Boolean) (defaults to: false)
  • use_acmechief (Boolean) (defaults to: false)
  • ipv6 (Optional[Stdlib::Ipv6])
  • replica_hosts (Optional[Array[Stdlib::Fqdn]]) (defaults to: $::gerrit::replica_hosts)
  • enable_monitoring (Boolean) (defaults to: true)


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
# File 'modules/gerrit/manifests/proxy.pp', line 2

class gerrit::proxy(
    Stdlib::Ipv4 $ipv4,
    Stdlib::Fqdn $host                           = $::gerrit::host,
    Boolean $replica                             = false,
    Boolean $maint_mode                          = false,
    Boolean $use_acmechief                       = false,
    Optional[Stdlib::Ipv6] $ipv6,
    Optional[Array[Stdlib::Fqdn]] $replica_hosts = $::gerrit::replica_hosts,
    Boolean $enable_monitoring                   = true,
) {

    require gerrit::jetty
    if $replica {
        $tls_host = $replica_hosts[0]
    } else {
        $tls_host = $host
    }

    if $enable_monitoring {
        monitoring::service { 'https':
            description   => 'HTTPS',
            check_command => "check_ssl_on_host_port_letsencrypt!${tls_host}!${tls_host}!443",
            contact_group => 'admins,gerrit',
            notes_url     => 'https://phabricator.wikimedia.org/project/view/330/',
        }
    }

    $ssl_settings = ssl_ciphersuite('apache', 'strong', true)

    httpd::site { $tls_host:
        content => template('gerrit/apache.erb'),
    }

    # Let Apache only listen on the service IP.
    file { '/etc/apache2/ports.conf':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('gerrit/apache.ports.conf.erb'),
    }

    $robots = ['User-Agent: *', 'Disallow: /g', 'Disallow: /r/plugins/gitiles', 'Crawl-delay: 1']
    file { '/var/www/robots.txt':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => inline_template("<%= @robots.join('\n') %>"),
    }

    # Error page stuff
    file { '/var/www/error.html':
        ensure  => present,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('gerrit/error.html.erb'),
    }
    file { '/var/www/page-bkg.cache.jpg':
        ensure => 'link',
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
        target => '/var/lib/gerrit2/review_site/static/page-bkg.cache.jpg',
    }
    file { '/var/www/wikimedia-codereview-logo.cache.png':
        ensure => 'link',
        owner  => 'root',
        group  => 'root',
        mode   => '0444',
        source => '/var/lib/gerrit2/review_site/static/wikimedia-codereview-logo.cache.png',
    }
}