OLD | NEW |
(Empty) | |
| 1 # == Class: adblockplus::web::fileserver |
| 2 # |
| 3 # Serves files for different repositories over https. |
| 4 # |
| 5 # === Parameters: |
| 6 # |
| 7 # [*domain*] |
| 8 # A string for the domain serving traffic. |
| 9 # |
| 10 # [*certificate*] |
| 11 # The name of the SSL certificate file within modules/private/files, if any. |
| 12 # Requires a private_key as well. |
| 13 # |
| 14 # [*private_key*] |
| 15 # The name of the private key file within modules/private/files, if any. |
| 16 # Requires a certificate as well. |
| 17 # |
| 18 # [*is_default*] |
| 19 # Passed on to nginx (whether or not the site config should be default). |
| 20 # |
| 21 # [*repository*] |
| 22 # A string that is the name of the repository to serve. A repository |
| 23 # is a collection of files uploaded by a group of users. |
| 24 # |
| 25 # TODO Convert this into a collection of *repositories* |
| 26 # |
| 27 class adblockplus::web::fileserver( |
| 28 $domain, |
| 29 $certificate, |
| 30 $private_key, |
| 31 $is_default=false, |
| 32 $repository='v8', |
| 33 ){ |
| 34 |
| 35 include nginx |
| 36 include adblockplus |
| 37 include adblockplus::web |
| 38 |
| 39 nginx::hostconfig{$domain: |
| 40 source => 'puppet:///modules/adblockplus/nginx/fileserver.conf', |
| 41 is_default => $is_default, |
| 42 certificate => $certificate, |
| 43 private_key => $private_key, |
| 44 log => 'access_log_files' |
| 45 } |
| 46 |
| 47 # Root directory for serving repositories |
| 48 realize(File[$adblockplus::directory]) |
| 49 |
| 50 |
| 51 file {[ |
| 52 "$adblockplus::directory/fileserver", |
| 53 "$adblockplus::directory/fileserver/repositories" |
| 54 ]: |
| 55 ensure => directory, |
| 56 } |
| 57 |
| 58 $repositories_directory = "$adblockplus::directory/fileserver/repositories" |
| 59 |
| 60 # TODO Base these entries on a map of directories and members: $repositories |
| 61 # For each entry in repositories, (1) create the group , (2) folder and (3) sy
mlink into /var/www/ |
| 62 # as is done below for the example 'v8': |
| 63 |
| 64 # (1) Create the group |
| 65 group {"www-$repository": |
| 66 ensure => present, |
| 67 # TODO Members are handled manually on the target server for now. Should go
into configuration. |
| 68 } |
| 69 |
| 70 # (2) create the repository folder |
| 71 file {"$repositories_directory/$repository": |
| 72 ensure => directory, |
| 73 group => "www-$repository", |
| 74 mode => '0775', |
| 75 require => [ |
| 76 File["$repositories_directory"], |
| 77 Group["www-$repository"], |
| 78 ], |
| 79 } |
| 80 |
| 81 # (3) symlink the repository into www: |
| 82 file {"/var/www/$repository": |
| 83 ensure => link, |
| 84 target => "$repositories_directory/$repository", |
| 85 require => [ |
| 86 File["$repositories_directory/$repository"], |
| 87 Package['nginx'], |
| 88 ], |
| 89 } |
| 90 |
| 91 } |
| 92 |
OLD | NEW |