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

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

Issue 29551585: #2317 - provide role fileserver for eyeofiles.com (Closed) Base URL: https://hg1/infrastructure
Patch Set: make repository into subdomains Created Sept. 22, 2017, 1:43 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/repository.pp
===================================================================
new file mode 100644
--- /dev/null
+++ b/modules/adblockplus/manifests/web/fileserver/repository.pp
@@ -0,0 +1,87 @@
+# == Type: adblockplus::web::fileserver::repository
+#
+# Manage a repository on a fileserver.
+#
+# A repository is a site where a group of people can upload and artifacts.
+#
+# In its current form, a repository is simply a directory exposed on a web
+# server.
+#
+# The contents of a repository is served on a subdomain of the fileserver.
+#
+# === parameters:
+#
+# [*ensure*]
+# Whether to set up the repository or not. Removing repositories is not
+# supported.
+#
+# [*fileserver_domain*]
+# A string which is the name of the fileserver domain, under which
+# each repository has a subdomain.
+#
+# [*certificate*]
+# The name of the SSL certificate file within modules/private/files, if any.
+# Requires a private_key as well.
+#
+# [*fileserver_domain*]
+# A string which is the name of the fileserver domain, under which
+# each repository has a subdomain.
+#
+# TODO Figure out how to inherit and use the parent's class domain instead of
+# having to duplicate it here.
+#
+# [*members*]
+# An array of usernames that should have write access to the repository.
+#
+# TODO Members are handled manually on the target server for now.
+# Figure out how to provision them.
+#
+define adblockplus::web::fileserver::repository (
+ $ensure = 'present',
+ $certificate = $::certificate,
+ $private_key = $::private_key,
+ $fileserver_domain = "$::fileserver_domain",
+ $members = [],
+){
+
+ $repositories_directory = "$adblockplus::directory/fileserver/repositories"
+ $repository_domain = "$name.$fileserver_domain"
+ $repository_directory = "$repositories_directory/$name"
+
+ if $ensure !~ /^(absent|purged)$/ {
+ group {"www-$name":
+ ensure => present,
+ }
+
+ file {"$repositories_directory/$name":
+ ensure => directory,
+ group => "www-$name",
+ mode => '0775',
+ require => [
+ File["$repositories_directory"],
+ Group["www-$name"],
+ ],
+ }
+
+ realize(File[$adblockplus::directory])
+
+ # TODO Figure out how to use $adblockplus::web::directory insetad of hardcoded path
+ file {"/var/www/$name":
+ ensure => link,
+ target => "$repositories_directory/$name",
+ require => [
+ File["$repositories_directory/$name"],
+ Package['nginx'],
+ ],
+ }
+
+ nginx::hostconfig{ "$repository_domain":
+ content => template('adblockplus/web/fileserver/repository.conf.erb'),
+ is_default => $is_default,
+ certificate => $certificate,
+ private_key => $private_key,
+ domain => $repository_domain,
+ log => "access_log_fileserver_repository_$repository_domain",
+ }
+ }
+}
« no previous file with comments | « modules/adblockplus/manifests/web/fileserver.pp ('k') | modules/adblockplus/templates/web/fileserver/repository.conf.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld