Faidon Liambotis has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183493

Change subject: mirrors: move to /srv/mirrors; new class ::serve
......................................................................

mirrors: move to /srv/mirrors; new class ::serve

Split mirrors into a separate /srv subdir, /srv/mirrors and set up an
index page for it

Also, create a new subclass mirrors::serve that sets up a separate nginx
virtual host to serve just /srv/mirrors and include it from the
install-server role class (to be moved later).

Change-Id: I48ff568e52ea1c9c367ac9f41909c6ef20dfb89f
---
M manifests/role/install-server.pp
M modules/mirrors/files/ftpsync.conf
A modules/mirrors/files/index.html
A modules/mirrors/files/nginx.conf
M modules/mirrors/files/update-ubuntu-mirror
M modules/mirrors/manifests/debian.pp
M modules/mirrors/manifests/init.pp
A modules/mirrors/manifests/serve.pp
M modules/mirrors/manifests/ubuntu.pp
9 files changed, 150 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/93/183493/1

diff --git a/manifests/role/install-server.pp b/manifests/role/install-server.pp
index 620b5b6..fe2c3f8 100644
--- a/manifests/role/install-server.pp
+++ b/manifests/role/install-server.pp
@@ -35,16 +35,18 @@
     include install-server::apt-repository
     include install-server::preseed-server
 
+    # mirrors stuff. these should be moved to their own role class eventually
+    include mirrors::serve
     include mirrors::ubuntu
     nrpe::monitor_service {'check_ubuntu_mirror':
         description  => 'Ubuntu mirror in sync with upstream',
-        nrpe_command => '/usr/local/lib/nagios/plugins/check_apt_mirror 
/srv/ubuntu',
+        nrpe_command => '/usr/local/lib/nagios/plugins/check_apt_mirror 
/srv/mirrors/ubuntu',
     }
 
     include mirrors::debian
     nrpe::monitor_service {'check_debian_mirror':
         description  => 'Debian mirror in sync with upstream',
-        nrpe_command => '/usr/local/lib/nagios/plugins/check_apt_mirror 
/srv/debian',
+        nrpe_command => '/usr/local/lib/nagios/plugins/check_apt_mirror 
/srv/mirrors/debian',
     }
 
     include install-server::tftp-server
diff --git a/modules/mirrors/files/ftpsync.conf 
b/modules/mirrors/files/ftpsync.conf
index fd17a6e..ddbf07c 100644
--- a/modules/mirrors/files/ftpsync.conf
+++ b/modules/mirrors/files/ftpsync.conf
@@ -1,4 +1,4 @@
-TO="/srv/debian/"
+TO="/srv/mirrors/debian/"
 RSYNC_PATH="debian"
 RSYNC_HOST="ftp2.us.debian.org"
 
diff --git a/modules/mirrors/files/index.html b/modules/mirrors/files/index.html
new file mode 100644
index 0000000..7c27997
--- /dev/null
+++ b/modules/mirrors/files/index.html
@@ -0,0 +1,107 @@
+<!DOCTYPE html>
+<html lang="en" dir="ltr">
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; 
charset=utf-8" />
+               <title>mirrors.wikimedia.org</title>
+               <style type="text/css" media="screen,projection">/*<![CDATA[*/
+body {
+       font: x-small sans-serif;
+       background: #f9f9f9;
+       color: black;
+       margin: 0;
+       padding: 0;
+}
+/* scale back up to a sane default */
+#globalWrapper {
+       font-size: 127%;
+       width: 100%;
+       margin: 0;
+       padding: 0;
+}
+#content {
+       margin: 2em 2em 0 2em;
+       padding: 0 1em 1.5em 1em;
+       background: white;
+       color: black;
+       border: 1px solid #aaa;
+       line-height: 1.5em;
+       position: relative;
+       z-index: 2;
+}
+h1, h2, h3, h4, h5, h6 {
+       color: black;
+       background: none;
+       font-weight: normal;
+       margin: 0;
+       padding-top: .5em;
+       padding-bottom: .17em;
+       border-bottom: 1px solid #aaa;
+}
+h1 {
+       font-size: 188%;
+       margin-bottom: .6em;
+}
+h2 {
+       font-size: 150%;
+       margin-bottom: .6em;
+}
+h3, h4, h5, h6 {
+       border-bottom: none;
+       font-weight: bold;
+       margin-bottom: .3em;
+}
+dt {
+       font-weight: bold;
+       margin-bottom: .05em;
+}
+dl {
+       margin-top: .2em;
+       margin-bottom: .5em;
+}
+dd {
+       line-height: 1.5em;
+       margin-left: 2em;
+       margin-bottom: .5em;
+}
+a {
+       text-decoration: none;
+       color: #002bb8;
+       background: none;
+}
+a:visited {
+       color: #5a3696;
+}
+a:active {
+       color: #faa700;
+}
+a:hover {
+       text-decoration: underline;
+}
+
+dl {margin-left:4em;margin-right:4em;}
+.visualClear {
+       clear: both;
+}
+
+/*]]>*/</style>
+</head>
+<body>
+       <div id="globalWrapper">
+               <div id="content">
+      <h1><img alt="Wikimedia Mirrors" 
src="//upload.wikimedia.org/wikipedia/commons/thumb/2/2b/Wmf_logo_horiz_pms.svg/200px-Wmf_logo_horiz_pms.svg.png"></img></h1>
+                       <p>
+      Welcome to mirrors.wikimedia.org, a service of the <a 
href="//wikimediafoundation.org/">Wikimedia Foundation</a>. The site contains 
mirrors of <strong>third-party</strong> archives. These are currently only 
offered via <em>http</em>, although <em>ftp</em> and <em>rsync</em> may be 
offered in the future
+                       </p>
+                       <h2>Contents</h2>
+                       <dl>
+                               <dt><a href="/debian">Debian</a></dt>
+        <dd>Mirror of the <a href="//www.debian.org/">Debian project</a>.</dd>
+                               <dt><a href="/ubuntu">Ubuntu</a></dt>
+        <dd>Mirror of the <a href="//www.ubuntu.com/">Ubuntu</a> operating 
system.</dd>
+                       </dl>
+                       <div class="visualClear"></div>
+               </div>
+       </div>
+</body>
+
+</html>
diff --git a/modules/mirrors/files/nginx.conf b/modules/mirrors/files/nginx.conf
new file mode 100644
index 0000000..f7f6989
--- /dev/null
+++ b/modules/mirrors/files/nginx.conf
@@ -0,0 +1,12 @@
+server {
+   listen 80;
+   listen [::]:80;
+   server_name mirrors.wikimedia.org ubuntu.wikimedia.org;
+   root /srv/mirrors;
+
+   location / {
+      index index.html;
+      autoindex on;
+      charset utf-8;
+   }
+}
diff --git a/modules/mirrors/files/update-ubuntu-mirror 
b/modules/mirrors/files/update-ubuntu-mirror
index 209211b..51358c7 100755
--- a/modules/mirrors/files/update-ubuntu-mirror
+++ b/modules/mirrors/files/update-ubuntu-mirror
@@ -11,7 +11,7 @@
 RSYNCSOURCE=rsync://us.rsync.archive.ubuntu.com/ubuntu
 
 # Define where you want the mirror-data to be on your mirror
-BASEDIR=/srv/ubuntu
+BASEDIR=/srv/mirrors/ubuntu
 
 if [ ! -d ${BASEDIR} ]; then
   fatal "${BASEDIR} doesn't exist."
diff --git a/modules/mirrors/manifests/debian.pp 
b/modules/mirrors/manifests/debian.pp
index fa5cf32..4455cc9 100644
--- a/modules/mirrors/manifests/debian.pp
+++ b/modules/mirrors/manifests/debian.pp
@@ -15,7 +15,7 @@
 class mirrors::debian {
     require mirrors
 
-    file { '/srv/debian/':
+    file { '/srv/mirrors/debian':
         ensure  => directory,
         owner   => 'mirror',
         group   => 'mirror',
diff --git a/modules/mirrors/manifests/init.pp 
b/modules/mirrors/manifests/init.pp
index 098157a..5bcbddb 100644
--- a/modules/mirrors/manifests/init.pp
+++ b/modules/mirrors/manifests/init.pp
@@ -16,6 +16,13 @@
         system => true,
     }
 
+    file { '/srv/mirrors':
+        ensure  => directory,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+    }
+
     # monitoring for Debian/Ubuntu mirrors being in sync with upstream
     file { '/usr/local/lib/nagios/plugins/check_apt_mirror':
         ensure => 'present',
diff --git a/modules/mirrors/manifests/serve.pp 
b/modules/mirrors/manifests/serve.pp
new file mode 100644
index 0000000..fb43ed4
--- /dev/null
+++ b/modules/mirrors/manifests/serve.pp
@@ -0,0 +1,16 @@
+class mirrors::serve {
+    # HTTP
+    include ::nginx
+
+    nginx::site { 'mirrors':
+        source => 'puppet:///files/mirrors/nginx.conf',
+    }
+
+    file { '/srv/mirrors/index.html':
+        ensure  => present,
+        owner   => 'root',
+        group   => 'root',
+        mode    => '0444',
+        source  => 'puppet:///files/mirrors/index.html',
+    }
+}
diff --git a/modules/mirrors/manifests/ubuntu.pp 
b/modules/mirrors/manifests/ubuntu.pp
index 458c9a0..c0cc74c 100644
--- a/modules/mirrors/manifests/ubuntu.pp
+++ b/modules/mirrors/manifests/ubuntu.pp
@@ -15,7 +15,7 @@
 class mirrors::ubuntu {
     require mirrors
 
-    file { '/srv/ubuntu/':
+    file { '/srv/mirrors/ubuntu':
         ensure  => directory,
         owner   => 'mirror',
         group   => 'mirror',

-- 
To view, visit https://gerrit.wikimedia.org/r/183493
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48ff568e52ea1c9c367ac9f41909c6ef20dfb89f
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Faidon Liambotis <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to