Puppet Class: profile::gerrit::proxy
- Defined in:
- modules/profile/manifests/gerrit/proxy.pp
Overview
sets up a TLS proxy for Gerrit
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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'modules/profile/manifests/gerrit/proxy.pp', line 2
class profile::gerrit::proxy(
Stdlib::IP::Address::V4 $ipv4 = lookup('profile::gerrit::ipv4'),
Optional[Stdlib::IP::Address::V6] $ipv6 = lookup('profile::gerrit::ipv6'),
Stdlib::Fqdn $host = lookup('profile::gerrit::host'),
Stdlib::Fqdn $active_host = lookup('profile::gerrit::active_host'),
Boolean $use_acmechief = lookup('profile::gerrit::use_acmechief'),
Optional[Array[Stdlib::Fqdn]] $replica_hosts = lookup('profile::gerrit::replica_hosts'),
Stdlib::Fqdn $replica_host = lookup('profile::gerrit::replica_host'),
Optional[Array[Stdlib::Fqdn]] $spare_hosts = lookup('profile::gerrit::spare_hosts'),
Stdlib::Fqdn $spare_host = lookup('profile::gerrit::spare_host'),
Boolean $enable_monitoring = lookup('profile::gerrit::enable_monitoring'),
Stdlib::Unixpath $gerrit_site = lookup('profile::gerrit::gerrit_site'),
Boolean $keepalive_toggle = lookup('profile::gerrit::proxy::keepalive_toggle'),
Integer $keepalive_timeout = lookup('profile::gerrit::proxy::keepalive_timeout'),
Integer $max_keepalive_requests = lookup('profile::gerrit::proxy::max_keepalive_requests'),
Integer $thread_limit = lookup('profile::gerrit::proxy::thread_limit', { 'default_value' => 64 }),
Integer $threads_per_child = lookup('profile::gerrit::proxy::threads_per_child', { 'default_value' => 25 }),
Integer $max_request_workers = lookup('profile::gerrit::proxy::max_request_workers', { 'default_value' => 150 }),
Integer $server_limit = lookup('profile::gerrit::proxy::server_limit', { 'default_value' => Integer(ceiling($max_request_workers / $threads_per_child)) }),
Integer $async_request_worker_factor = lookup('profile::gerrit::proxy::async_request_worker_factor', { 'default_value' => 2 }),
) {
$is_replica = $facts['networking']['fqdn'] == $replica_host
$is_spare = $facts['networking']['fqdn'] == $spare_host
if $is_replica {
$tls_host = $replica_hosts[0]
} elsif $is_spare {
$tls_host = $spare_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/',
migration_task => 'T384922',
}
if !($is_replica or $is_spare) {
prometheus::blackbox::check::http { 'gerrit.wikimedia.org':
server_name => $tls_host,
severity => 'page',
alert_after => '15m',
timeout => '6s',
path => '/',
follow_redirects => true,
status_matches => [200,302],
ip_families => ['ip4','ip6'],
port => 443,
force_tls => true,
body_regex_matches => ['Gerrit Code Review'],
}
prometheus::blackbox::check::http { 'gerrit-tls':
server_name => $tls_host,
team => 'collaboration-services-releng',
severity => 'critical',
path => '/',
follow_redirects => true,
status_matches => [200,302],
ip_families => ['ip4','ip6'],
port => 443,
force_tls => true,
body_regex_matches => ['Gerrit Code Review'],
}
}
}
$ssl_settings = ssl_ciphersuite('apache', 'strong', true)
class { 'httpd':
modules => ['rewrite', 'headers', 'proxy', 'proxy_http', 'remoteip', 'ssl'],
wait_network_online => true,
}
class { 'httpd::mpm':
mpm => 'event',
}
httpd::conf { 'gerrit_mpm_event':
content => template('profile/gerrit/mpm_event.conf.erb'),
}
file { '/var/www':
ensure => directory,
require => Class['httpd'],
}
httpd::conf { 'connection_reuse':
content => template('profile/gerrit/connection_reuse.conf.erb'),
priority => 10,
notify => Service['apache2'],
}
httpd::site { $tls_host:
content => template('profile/gerrit/apache.erb'),
}
file { '/var/www/robots.txt':
ensure => present,
owner => 'root',
group => 'root',
mode => '0444',
source => 'puppet:///modules/profile/gerrit/robots.txt'
}
# 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 => "${gerrit_site}/static/page-bkg.cache.jpg",
}
file { '/var/www/wikimedia-codereview-logo.cache.png':
ensure => link,
owner => 'root',
group => 'root',
mode => '0444',
target => "${gerrit_site}/static/wikimedia-codereview-logo.cache.png",
}
mtail::program { 'httpd':
ensure => present,
source => 'puppet:///modules/mtail/programs/httpd_gerrit.mtail',
}
}
|