Make gretchaninov an archive mirror
authorPeter Palfrader <peter@palfrader.org>
Wed, 1 Feb 2017 07:31:06 +0000 (08:31 +0100)
committerPeter Palfrader <peter@palfrader.org>
Wed, 1 Feb 2017 07:31:12 +0000 (08:31 +0100)
hieradata/common.yaml
modules/roles/manifests/historical_mirror.pp [new file with mode: 0644]
modules/roles/manifests/init.pp
modules/roles/templates/apache-archive.debian.org.erb [new file with mode: 0644]

index 8d15f70..e7c98be 100644 (file)
@@ -216,6 +216,8 @@ roles:
   debian_mirror_onion:
     - bilbao.debian.org
     - mirror-isc.debian.org
+  historical_mirror:
+    - gretchaninov.debian.org
   debug_mirror:
     - klecker.debian.org
     - mirror-isc.debian.org
diff --git a/modules/roles/manifests/historical_mirror.pp b/modules/roles/manifests/historical_mirror.pp
new file mode 100644 (file)
index 0000000..25edb23
--- /dev/null
@@ -0,0 +1,28 @@
+class roles::historical_mirror {
+       $vhost_listen = $::hostname ? {
+               default => '*:80',
+       }
+       $onion_v4_addr = $::hostname ? {
+               default    => undef,
+       }
+       $archive_root = $::hostname ? {
+               default    => '/srv/mirrors/debian-archive',
+       }
+
+       apache2::site { '010-archive.debian.org':
+               site   => 'archive.debian.org',
+               content => template('roles/apache-archive.debian.org.erb'),
+       }
+
+       if has_role('historical_mirror_onion') {
+               if ! $onion_v4_addr {
+                       fail("Do not have an onion_v4_addr set for $::hostname.")
+               }
+
+               onion::service { 'archive.debian.org':
+                       port => 80,
+                       target_port => 80,
+                       target_address => $onion_v4_addr,
+               }
+       }
+}
index 15b79f0..8e9f2bb 100644 (file)
@@ -71,6 +71,9 @@ class roles {
        if has_role('security_mirror') {
                include roles::security_mirror
        }
+       if has_role('historical_mirror') {
+               include roles::historical_mirror
+       }
        if has_role('debian_mirror') {
                include roles::debian_mirror
        }
diff --git a/modules/roles/templates/apache-archive.debian.org.erb b/modules/roles/templates/apache-archive.debian.org.erb
new file mode 100644 (file)
index 0000000..611b27c
--- /dev/null
@@ -0,0 +1,26 @@
+##
+## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
+## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
+##
+
+<VirtualHost <%= vhost_listen %>>
+       ServerAdmin debian-admin@debian.org
+       ServerName archive.debian.org
+       <% if scope.function_onion_global_service_hostname(['archive.debian.org']) -%>
+       ServerAlias <%= scope.function_onion_global_service_hostname(['archive.debian.org']) %>
+       <% end %>
+
+       RedirectMatch "^/$" /debian-archive/
+       Alias /debian-archive/ <%= archive_root %>/
+
+       ErrorLog /var/log/apache2/archive.debian.org-error.log
+       CustomLog /var/log/apache2/archive.debian.org-access.log privacy
+
+       Use ftp-archive <%= archive_root %>
+
+       <IfModule mod_userdir.c>
+               UserDir disabled
+       </IfModule>
+</VirtualHost>
+
+# vim:set syn=apache: