From 693cb1a2b2fc3835556882720ba572dcbbb4021b Mon Sep 17 00:00:00 2001
From: espiv <servers@espiv.net>
Date: Mon, 30 Nov 2015 00:13:58 +0200
Subject: [PATCH] Modifies mirror doc to include setup with puppet

---
 wiki/src/contribute/how/mirror.mdwn | 66 +++++++++++++++++++++++++++++++------
 1 file changed, 56 insertions(+), 10 deletions(-)

diff --git a/wiki/src/contribute/how/mirror.mdwn b/wiki/src/contribute/how/mirror.mdwn
index dc12d1b..c755fbf 100644
--- a/wiki/src/contribute/how/mirror.mdwn
+++ b/wiki/src/contribute/how/mirror.mdwn
@@ -77,7 +77,7 @@ Before starting doing any real work on this topic, please get in touch
 your OpenPGP public key, so that any further communication between us
 can be properly encrypted and authenticated.
 
-1. The big picture
+The big picture
 ------------------
 
 We have a DNS Round Robin setup for the `dl.amnesia.boum.org` host.
@@ -87,13 +87,21 @@ Every HTTP mirror makes our files available under a fixed URL
 sub-directories (such as
 `http://dl.amnesia.boum.org/tails/stable/tails-i386-lenny-0.6.2/`).
 
-2. Set up your web server
+<div class="tip">
+If you are using [[!wikipedia Puppet_(software) desc="puppet"]] to configure
+your server infrastructure, consider using the available [[ HTTP mirror puppet
+module |mirror#index6h2]].
+</div>
+
+Manual set up
 -------------------------
 
+### 1. Set up your web server
+
 You need to set up a virtual host for dl.amnesia.boum.org, with indexing
 enabled and [[!wikipedia HTTP_ETag desc="ETags"]] disabled.
 
-### Apache configuration example
+#### Apache configuration example
 
 	<VirtualHost YOUR_WEBSERVER_IP:80>
 	   ServerName dl.amnesia.boum.org
@@ -110,7 +118,7 @@ enabled and [[!wikipedia HTTP_ETag desc="ETags"]] disabled.
 	   </Directory>
 	</VirtualHost>
 
-### Lighttpd configuration example
+#### Lighttpd configuration example
 
 	static-file.etags = "disable"
 	$HTTP["host"] =~ "^dl\.amnesia\.boum\.org$" {
@@ -118,7 +126,7 @@ enabled and [[!wikipedia HTTP_ETag desc="ETags"]] disabled.
 		server.dir-listing = "enable"
 	}
 
-### nginx configuration example
+#### nginx configuration example
 
 	server {
 		server_name dl.amnesia.boum.org;
@@ -129,8 +137,7 @@ enabled and [[!wikipedia HTTP_ETag desc="ETags"]] disabled.
 		}
 	}
 
-3. Download the files
----------------------
+### 2. Download the files
 
 Download a snapshot of the current Tails files:
 
@@ -146,14 +153,53 @@ download:
 	         rsync.torproject.org::amnesia-archive \
 	         /var/www/THE_PLACE_WHERE_YOU_WANT_OUR_FILES_TO_LIVE/
 
-4. Schedule the pulling of the files
-------------------------------------
+### 3. Schedule the pulling of the files
 
 Secondary mirrors (like yours) should sync every hour + 15 minutes.
 Use `cron` or equivalent to schedule the same `rsync` command
 as above.
 
-5. Go wild
+Set up with puppet
+-----------------
+
+It is assumed puppet is already installed and configured to function well
+for your infrastructure.
+
+### 1. Clone 'puppet-tails' module
+
+Clone the module inside the puppet modules' directory of your puppetmaster. In
+Debian, this directory should be `/etc/puppet/modules`.
+
+     mkdir /etc/puppet/modules/tails
+     git clone https://git-tails.immerda.ch/puppet-tails /etc/puppet/modules/tails
+
+### 2. Use the tails::mirror class
+
+On a node where you wish setup the mirror you should include the class like
+
+     include tails::mirror
+
+If you need to adjust any parameters of the class, you should declare it like
+
+     class { 'tails::mirror':
+       webserver   => 'apache2',
+       mirror_path => '/srv/tails/mirror',
+     }
+
+#### Configurable parameters
+
+ * `webserver`, specifies webserver software, 'nginx' or 'apache2', defaults to
+ 'nginx'
+ * `package`, specifies the debian package name for the webserver, defaults to
+ `webserver` value
+ * `mirror_path`, specifies the directory where mirror's data will be located,
+ defaults to '/var/www/tails-mirror/'
+ * `access_log`, specifies webserver's access log file path, defaults to
+ '/dev/null'
+ * `error_log`, specifies webserver's error log file path, defaults to
+ '/dev/null'
+
+Go wild
 ----------
 
 As soon as your web server is ready, please e-mail us its IP address
-- 
2.1.4

