Make an apache site for syncproxies
authorPeter Palfrader <peter@palfrader.org>
Fri, 8 Jan 2016 21:12:57 +0000 (21:12 +0000)
committerPeter Palfrader <peter@palfrader.org>
Fri, 8 Jan 2016 21:12:57 +0000 (21:12 +0000)
modules/roles/manifests/syncproxy.pp
modules/roles/templates/syncproxy/syncproxy.debian.org-apache.erb [new file with mode: 0644]
modules/roles/templates/syncproxy/syncproxy.debian.org-index.html.erb [new file with mode: 0644]

index bf19bd0..7e3423a 100644 (file)
@@ -13,6 +13,13 @@ class roles::syncproxy {
                'klecker' => '2001:610:1908:b000::148:10',
                default => ''
        }
+       $syncproxy_name = $::hostname ? {
+               'milanollo' => 'syncproxy3.eu.debian.org',
+               'mirror-isc' => 'syncproxy2.wna.debian.org',
+               'mirror-umn' => 'syncproxy.cna.debian.org',
+               'klecker' => 'syncproxy2.eu.debian.org',
+               default => 'unknown'
+       }
 
        rsync::site { 'syncproxy':
                content => template('roles/syncproxy/rsyncd.conf.erb'),
@@ -29,4 +36,19 @@ class roles::syncproxy {
                group => 'mirroradm',
                mode => 0660,
        }
+
+       if $::apache2 and $syncproxy_name != 'unknown' {
+               apache2::site { '010-syncproxy.debian.org':
+                       site   => 'security.debian.org',
+                       content => template('roles/syncproxy/syncproxy.debian.org-apache.erb')
+               }
+
+               file { [ '/srv/www/syncproxy.debian.org', '/srv/www/syncproxy.debian.org/htdocs' ]:
+                       ensure  => directory,
+                       mode    => '0755',
+               }
+               file { '/srv/www/syncproxy.debian.org/htdocs/index.html':
+                       content => template('roles/syncproxy/syncproxy.debian.org-index.html.erb')
+               }
+       }
 }
diff --git a/modules/roles/templates/syncproxy/syncproxy.debian.org-apache.erb b/modules/roles/templates/syncproxy/syncproxy.debian.org-apache.erb
new file mode 100644 (file)
index 0000000..db52513
--- /dev/null
@@ -0,0 +1,40 @@
+##
+## 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
+##
+
+<%
+  vhost_listen = [ (bind != '') ? "#{bind}:80" : "*:80",  (bind6 != '') ? "#{bind6}:80" : "*:80"].uniq.join(' ')
+%>
+
+<Virtualhost <%= vhost_listen %> >
+   ServerName <%= syncproxy_name %>
+   DocumentRoot /srv/www/syncproxy.debian.org/htdocs
+
+   <Directory /srv/www/syncproxy.debian.org/htdocs>
+      Require all granted
+   </Directory>
+
+   CustomLog /var/log/apache2/syncproxy.debian.org-access.log privacy
+   ErrorLog /var/log/apache2/syncproxy.debian.org-error.log
+
+<%=
+lines = []
+%w{debian debian-backports debian-debug debian-security}.each do |archive|
+  varname = 'has_srv_mirrors_' + archive.gsub(/[\/-]/,'_')
+  if has_variable?(varname) and (eval(varname)) == 'true'
+    lines << "  Alias /#{archive}/project/trace/ /srv/mirrors/#{archive}/project/trace/"
+    lines << "  <Directory /srv/mirrors/#{archive}/project/trace/>"
+    lines << "    Require all granted"
+    lines << "    IndexOptions NameWidth=* +SuppressDescription"
+    lines << "    Options +Indexes"
+    lines << "  </Directory>"
+  end
+end
+
+lines.join("\n")
+%>
+
+</VirtualHost>
+
+# vim: set ts=3 sw=3 et:
diff --git a/modules/roles/templates/syncproxy/syncproxy.debian.org-index.html.erb b/modules/roles/templates/syncproxy/syncproxy.debian.org-index.html.erb
new file mode 100644 (file)
index 0000000..a3e0070
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<HEAD>
+   <TITLE>Welcome to <%= syncproxy_name %>!</TITLE>
+</HEAD>
+<BODY>
+
+<H1>Welcome to <%= syncproxy_name %>!</H1>
+
+This is <%= syncproxy_name %>, a syncproxy run by and for the <a
+href="https://www.debian.org/">Debian Project</a> to aid in mirroring
+our software.  Consult <a href="https://www.debian.org/mirror/">the
+mirrors section of the Debian website</a> for more information.
+
+<p>
+This syncproxy contains copies of the following archives.
+
+<ul>
+<%=
+lines = []
+%w{debian debian-backports debian-debug debian-security}.each do |archive|
+  varname = 'has_srv_mirrors_' + archive.gsub(/[\/-]/,'_')
+  if has_variable?(varname) and (eval(varname)) == 'true'
+    lines << "<li>#{archive} [<a href=\"/#{archive}/project/trace/\">trace directory</a>]</li>"
+  end
+end
+lines.join("\n")
+%>
+</ul>
+
+
+<p>
+Please contact the Debian mirrors team for rsync access if your
+mirror should become a push primary mirror (see the documenation).
+
+<P>
+<HR NOSHADE />
+<FONT size="-1">Debian mirrors team</FONT>
+
+</BODY>
+</HTML>