Puppet Class: geoip::data::archive

Defined in:
modules/geoip/manifests/data/archive.pp

Overview

Class geoip::data::archive

Sets up a cron job that grabs the latest version of the MaxMind database, puts it in a timestamped directory in $archive_dir, and pushes its contents to hdfs.

Parameters:

  • maxmind_db_source_dir (Any) (defaults to: '/usr/share/GeoIP')
  • hdfs_archive_dir (Any) (defaults to: '/wmf/data/archive/geoip')
  • archive_dir (Any) (defaults to: "${maxmind_db_source_dir}/archive")
  • use_kerberos (Any) (defaults to: false)


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
# File 'modules/geoip/manifests/data/archive.pp', line 7

class geoip::data::archive(
    $maxmind_db_source_dir = '/usr/share/GeoIP',
    $hdfs_archive_dir = '/wmf/data/archive/geoip',
    $archive_dir = "${maxmind_db_source_dir}/archive",
    $use_kerberos = false,
) {
    # Puppet assigns 755 permissions to files and dirs, so the script can be ran
    # manually without sudo.
    file { $archive_dir:
        ensure  => directory,
        owner   => 'analytics',
        group   => 'wikidev',
        require => User['analytics'],
    }

    $archive_script = '/usr/local/bin/geoip_archive.sh'

    file { $archive_script:
        ensure  => file,
        owner   => 'root',
        group   => 'wikidev',
        mode    => '0555',
        content => file('geoip/archive.sh')
    }

    $archive_command = "${archive_script} ${maxmind_db_source_dir} ${archive_dir} ${hdfs_archive_dir}"

    kerberos::systemd_timer { 'archive-maxmind-geoip-database':
        description               => 'Archives Maxmind GeoIP files',
        command                   => $archive_command,
        interval                  => 'Tue *-*-* 05:30:00',
        user                      => 'analytics',
        monitoring_contact_groups => 'analytics',
        use_kerberos              => $use_kerberos,
        require                   => [File[$archive_script], User['analytics']],
    }
}