Puppet Class: statistics::published

Defined in:
modules/statistics/manifests/published.pp

Overview

Class: statistics::published

Sets up an rsync module and a cron that runs hardsync to merge multiple source directories into one. This allows remote hosts to push datasets here.

This class does not rsync itself, it is expected that all desired files are pushed into $source by statistics::rsync::published.

NOTE: $temp_dir should be set to the same filesystem as $source, as hardsync uses hardlinks to do the merging of $source/* directories.

Parameters:

  • destination (Any)
  • source (Any) (defaults to: '/srv/published-rsynced')
  • temp_dir (Any) (defaults to: '/srv')


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
# File 'modules/statistics/manifests/published.pp', line 13

class statistics::published(
    $destination,
    $source   = '/srv/published-rsynced',
    $temp_dir = '/srv'
) {
    require statistics::user

    # Use hardsync script to hardlink merge files from various host 'published'
    # directories.  These are rsync pushed here from those those hosts.
    file { $source:
        ensure => 'directory',
        owner  => 'root',
        group  => 'www-data',
        mode   => '0775',
    }

    # Set up an rsync module
    # (in /etc/rsyncd.conf) for /srv.
    rsync::server::module { 'published-destination':
        path        => $source,
        read_only   => 'no',
        list        => 'yes',
        hosts_allow => $::statistics::servers,
        auto_ferm   => true,
        uid         => $::statistics::user::username,
        gid         => 'wikidev',
        require     => File[$source],
    }

    # Merge files in published-rsynced/* via hardlinks into $document_root/published
    cron { 'hardsync-published':
        # This script is installed by ::statistics::web.
        command => "/usr/local/bin/hardsync -t ${temp_dir} ${source}/* ${destination} 2>&1 > /dev/null",
        user    => 'root',
        minute  => '*/15',
        require => File[$source],
    }

}