aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/websites/manifests/www.pp
blob: c0c556eaa59d6d4e240f2fa9447f8779a9c1dbda (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
55
56
57
58
59
60
61
62
63
64
class websites::www {
    include websites::base
    $vhost = "www.${::domain}"
    $vhostdir = "${websites::base::webdatadir}/${vhost}"
    $git_location = "git://git.${::domain}/web/www"

    include apache::var
    include apache::mod::php

    # for mailman reverse proxy, on ssl
    include apache::mod::proxy
    include apache::mod::ssl

    git::snapshot { $vhostdir:
        source => $git_location,
    }

    file { [ "${vhostdir}/var",
             "${vhostdir}/var/tmp",
             "${vhostdir}/var/tmp/cache" ] :
        ensure   => directory,
        group    => $apache::var::apache_group,
        mode     => '0660',
        require  => Git::Snapshot[$vhostdir],
    }

    file { [ "${vhostdir}/_nav",
             "${vhostdir}/_nav/var",
             "${vhostdir}/_nav/var/tmp",
             "${vhostdir}/_nav/var/tmp/cache" ] :
        ensure   => directory,
        group    => $apache::var::apache_group,
        mode     => '0660',
        require  => Git::Snapshot[$vhostdir],
    }

    apache::vhost::base { $vhost:
        content  => template('websites/vhost_www.conf',
                             'websites/vhost_www_rewrite.conf'),
        location => $vhostdir,
        options  => ['FollowSymLinks'],
    }

    apache::vhost::base { "ssl_${vhost}":
        use_ssl  => true,
        vhost    => $vhost,
        content  => template('websites/vhost_www.conf',
                             'websites/vhost_www_rewrite.conf'),
        location => $vhostdir,
        options  => ['FollowSymLinks'],
    }

    apache::vhost_redirect { "${::domain}":
        url => "https://www.${::domain}/",
    }

    apache::vhost_redirect { "ssl_${::domain}":
        use_ssl => true,
        vhost   => "${::domain}",
        url     => "https://www.${::domain}/",
    }

    package { ['php-mbstring', 'php-mcrypt', 'php-gettext', 'php-geoip']: }
}