aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/websites/manifests/pkgcpan.pp
blob: 0a6c903aa7b6a899ffb3bc5e8dbaa1a612aa715d (plain)
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
class websites::pkgcpan {
    include websites::base
    $vhost = "pkgcpan.$::domain"
    $vhostdir = "$websites::base::webdatadir/$vhost"
    $statsdir = "${vhostdir}/stats"
    $login = 'pkgcpan'
    $homedir = "/var/lib/$login"

    user { $login:
        managehome => true,
        home       => $homedir,
    }

    apache::vhost::base { $vhost:
        location => $vhostdir,
        options  => [ 'Indexes' ],
    }

    file { $vhostdir:
        ensure => directory,
        owner  => $login,
        group  => $login,
    }

    package { ['perl-Module-Packaged-Generator', 'magpie']: }

    cron { 'update cpanpkg':
        hour    => 23,
	minute	=> 0,
        require => Package['perl-Module-Packaged-Generator'],
        command => "pkgcpan -q -f $vhostdir/cpan_Mageia.db -d Mageia",
        user    => $login,
    }

    file { "$vhostdir/cpan_Mageia.db":
        owner => $login,
        group => $login,
    }

    file { $statsdir:
	ensure => directory,
	owner => $login,
	group => $login,
    }

    # http://www.mageia.org/pipermail/mageia-sysadm/2012-March/004337.html
    cron { 'update pkgcpan stats':
	hour	=> 23,
	minute	=> 30,
	require => [ Package['magpie'], File[$statsdir] ],
	command => "magpie webstatic -qq -d $statsdir",
	user	=> $login,
    }
}