Puppet Class: profile::query_service::common

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

Overview

Parameters:

  • username (String) (defaults to: lookup('profile::query_service::username'))
  • deploy_mode (Query_service::DeployMode) (defaults to: hiera('profile::query_service::deploy_mode'))
  • package_dir (Stdlib::Unixpath) (defaults to: hiera('profile::query_service::package_dir'))
  • data_dir (Stdlib::Unixpath) (defaults to: hiera('profile::query_service::data_dir'))
  • log_dir (Stdlib::Unixpath) (defaults to: hiera('profile::query_service::log_dir'))
  • deploy_name (String) (defaults to: hiera('profile::query_service::deploy_name'))
  • endpoint (String) (defaults to: hiera('profile::query_service::endpoint'))
  • run_tests (Boolean) (defaults to: hiera('profile::query_service::run_tests', false))
  • load_categories (Enum['none', 'daily', 'weekly']) (defaults to: hiera('profile::query_service::load_categories', 'daily'))
  • nodes (Array[String]) (defaults to: hiera('profile::query_service::nodes'))
  • categories_endpoint (Stdlib::Httpurl) (defaults to: hiera('profile::query_service::categories_endpoint', 'http://localhost:9990'))
  • forward_rsyslog_host (Optional[String]) (defaults to: lookup('profile::query_service::forward_rsyslog_host', { 'default_value' => undef }))


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

class profile::query_service::common(
    String $username = lookup('profile::query_service::username'),
    Query_service::DeployMode $deploy_mode = hiera('profile::query_service::deploy_mode'),
    Stdlib::Unixpath $package_dir = hiera('profile::query_service::package_dir'),
    Stdlib::Unixpath $data_dir = hiera('profile::query_service::data_dir'),
    Stdlib::Unixpath $log_dir = hiera('profile::query_service::log_dir'),
    String $deploy_name = hiera('profile::query_service::deploy_name'),
    String $endpoint = hiera('profile::query_service::endpoint'),
    Boolean $run_tests = hiera('profile::query_service::run_tests', false),
    Enum['none', 'daily', 'weekly'] $load_categories = hiera('profile::query_service::load_categories', 'daily'),
    Array[String] $nodes = hiera('profile::query_service::nodes'),
    Stdlib::Httpurl $categories_endpoint =  hiera('profile::query_service::categories_endpoint', 'http://localhost:9990'),
    Optional[String] $forward_rsyslog_host = lookup('profile::query_service::forward_rsyslog_host', { 'default_value' => undef }),
) {

    $deploy_user = 'deploy-service'

    if $forward_rsyslog_host {
        # This is necessary for instances in WMCS. Those instances can't migrate to
        # the new logging pipline pushing to kafka as only instances inside the
        # deployment-prep project can talk to kafka. This uses the direct json lines
        # input to logstash, meaning there is no intermediate buffer and when logstash
        # restarts we can lose logs.
        rsyslog::conf { 'query_service_logging_relay':
            content  => template('profile/query_service/logging_relay.conf.erb'),
            priority => 50,
        }
    } else {
        # Let's migrate to the new logging pipeline. See T232184.
        include ::profile::rsyslog::udp_json_logback_compat
    }

    class { '::query_service::common':
        deploy_mode         => $deploy_mode,
        username            => $username,
        deploy_name         => $deploy_name,
        deploy_user         => $deploy_user,
        package_dir         => $package_dir,
        data_dir            => $data_dir,
        log_dir             => $log_dir,
        endpoint            => $endpoint,
        categories_endpoint => $categories_endpoint,
    }

    class { 'query_service::crontasks':
        package_dir     => $package_dir,
        data_dir        => $data_dir,
        log_dir         => $log_dir,
        deploy_name     => $deploy_name,
        username        => $username,
        load_categories => $load_categories,
        run_tests       => $run_tests,
    }

    require_package('python3-dateutil', 'python3-prometheus-client')
    file { '/usr/local/bin/prometheus-blazegraph-exporter':
        ensure => present,
        source => 'puppet:///modules/query_service/monitor/prometheus-blazegraph-exporter.py',
        mode   => '0555',
        owner  => 'root',
        group  => 'root',
    }

    # Firewall
    ferm::service {
        'query_service_http':
            proto => 'tcp',
            port  => '80';
        'query_service_https':
            proto => 'tcp',
            port  => '443';
        # temporary port to transfer data file between wdqs nodes via netcat
        'query_service_file_transfer':
            proto  => 'tcp',
            port   => '9876',
            srange => inline_template("@resolve((<%= @nodes.join(' ') %>))");
    }

    # spread IRQ for NIC
    interface::rps { $facts['interface_primary']: }
}