Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/adblockplus/manifests/web/fileserver.pp

Issue 29551585: #2317 - provide role fileserver for eyeofiles.com (Closed) Base URL: https://hg1/infrastructure
Patch Set: move into adblockplus::web namespace and other improvements Created Sept. 21, 2017, 8:37 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: modules/adblockplus/manifests/web/fileserver.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/manifests/web/fileserver.pp
@@ -0,0 +1,92 @@
+# == Class: adblockplus::web::fileserver
+#
+# Serves files for different repositories over https.
+#
+# === Parameters:
+#
+# [*domain*]
+# A string for the domain serving traffic.
+#
+# [*certificate*]
+# The name of the SSL certificate file within modules/private/files, if any.
+# Requires a private_key as well.
+#
+# [*private_key*]
+# The name of the private key file within modules/private/files, if any.
+# Requires a certificate as well.
+#
+# [*is_default*]
+# Passed on to nginx (whether or not the site config should be default).
+#
+# [*repository*]
+# A string that is the name of the repository to serve. A repository
+# is a collection of files uploaded by a group of users.
+#
+# TODO Convert this into a collection of *repositories*
+#
+class adblockplus::web::fileserver(
+ $domain,
+ $certificate,
+ $private_key,
+ $is_default=false,
+ $repository='v8',
+){
+
+ include nginx
+ include adblockplus
+ include adblockplus::web
+
+ nginx::hostconfig{$domain:
+ source => 'puppet:///modules/adblockplus/nginx/fileserver.conf',
+ is_default => $is_default,
+ certificate => $certificate,
+ private_key => $private_key,
+ log => 'access_log_files'
+ }
+
+ # Root directory for serving repositories
+ realize(File[$adblockplus::directory])
+
+
+ file {[
+ "$adblockplus::directory/fileserver",
+ "$adblockplus::directory/fileserver/repositories"
+ ]:
+ ensure => directory,
+ }
+
+ $repositories_directory = "$adblockplus::directory/fileserver/repositories"
+
+ # TODO Base these entries on a map of directories and members: $repositories
+ # For each entry in repositories, (1) create the group , (2) folder and (3) symlink into /var/www/
+ # as is done below for the example 'v8':
+
+ # (1) Create the group
+ group {"www-$repository":
+ ensure => present,
+ # TODO Members are handled manually on the target server for now. Should go into configuration.
+ }
+
+ # (2) create the repository folder
+ file {"$repositories_directory/$repository":
+ ensure => directory,
+ group => "www-$repository",
+ mode => '0775',
+ require => [
+ File["$repositories_directory"],
+ Group["www-$repository"],
+ ],
+ }
+
+ # (3) symlink the repository into www:
+ file {"/var/www/$repository":
+ ensure => link,
+ target => "$repositories_directory/$repository",
+ require => [
+ File["$repositories_directory/$repository"],
+ Package['nginx'],
+ ],
+ }
+
+}
+
« no previous file with comments | « modules/adblockplus/files/nginx/fileserver.conf ('k') | modules/private-stub/files/eyeofiles.com_sslcert.key » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld