Andrew Bogott has submitted this change and it was merged.

Change subject: Add extdist module + role for labs
......................................................................


Add extdist module + role for labs

The extdist role sets up a tarball generator for use
with the Extension Distributor extension on mediawiki.org
running from labs.

The module can, in the future, be potentially used on prod.

Bug: 68609
Change-Id: I63d285612bd30d24b83718c4c8967144d146afeb
---
A manifests/role/extdist.pp
A modules/extdist/manifests/init.pp
A modules/extdist/templates/extdist.nginx.erb
3 files changed, 115 insertions(+), 0 deletions(-)

Approvals:
  Andrew Bogott: Looks good to me, approved
  Legoktm: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/manifests/role/extdist.pp b/manifests/role/extdist.pp
new file mode 100644
index 0000000..a73f0b8
--- /dev/null
+++ b/manifests/role/extdist.pp
@@ -0,0 +1,13 @@
+# = Class: role::labs::extdist
+#
+# This class sets up a tarball generator for the Extension Distributor
+# extension enabled on mediawiki.org.
+#
+class role::labs::extdist {
+
+    include role::labs::lvm::srv
+
+    class { '::extdist':
+        require => Mount['/srv']
+    }
+}
diff --git a/modules/extdist/manifests/init.pp 
b/modules/extdist/manifests/init.pp
new file mode 100644
index 0000000..5f4d533
--- /dev/null
+++ b/modules/extdist/manifests/init.pp
@@ -0,0 +1,80 @@
+# = Class: role::labs::extdist
+#
+# This class sets up a tarball generator for the Extension Distributor
+# extension enabled on mediawiki.org.
+#
+class extdist(
+    $base_dir = "/srv",
+    $log_path = "/var/log/extdist") {
+
+    $dist_dir = "$base_dir/dist"
+    $clone_dir = "$base_dir/extdist"
+    $src_path = "$base_dir/src"
+    $pid_folder = "/run/extdist"
+
+    $settings = {
+        'API_URL'   => "https://www.mediawiki.org/w/api.php";,
+        'DIST_PATH' => $dist_dir,
+        'GIT_URL'   => 
"https://gerrit.wikimedia.org/r/mediawiki/extensions/%s";,
+        'LOG_FILE'  => $log_path,
+        'SRC_PATH'  => $src_path,
+        'PID_FILE'  => "$pid_folder/pid.lock"
+    }
+
+    user { 'extdist':
+        ensure => present,
+        system => true,
+    }
+
+    file { '/home/extdist':
+        ensure  => directory,
+        owner   => 'extdist',
+        require => User['extdist']
+    }
+
+    file { $log_path:
+        ensure  => present,
+        owner   => 'extdist',
+        group   => 'www-data',
+        require => User['extdist']
+    }
+
+    file { [$dist_dir, $clone_dir, $src_path, $pid_folder]:
+        ensure  => directory,
+        owner   => 'extdist',
+        group   => 'www-data',
+        mode    => '0755',
+    }
+
+    git::clone {'labs/tools/extdist':
+        directory => $clone_dir,
+        ensure    => latest,
+        branch    => 'master',
+        require   => [File[$clone_dir], User['extdist']],
+        owner     => 'extdist',
+        group     => 'extdist',
+    }
+
+    file { '/etc/extdist.conf':
+        ensure  => present,
+        content => ordered_json($settings),
+        owner   => 'extdist',
+        require => User['extdist']
+    }
+
+    cron { 'extdist-generate-tarballs':
+        command => "/usr/bin/python $clone_dir/nightly.py --all",
+        user    => 'extdist',
+        minute  => '0',
+        hour    => '*',
+        require => [
+            Git::Clone['labs/tools/extdist'],
+            User['extdist'],
+            File['/etc/extdist.conf']
+        ]
+    }
+
+    nginx::site { 'extdist':
+        content => template('extdist/extdist.nginx.erb'),
+    }
+}
diff --git a/modules/extdist/templates/extdist.nginx.erb 
b/modules/extdist/templates/extdist.nginx.erb
new file mode 100644
index 0000000..0c9a196
--- /dev/null
+++ b/modules/extdist/templates/extdist.nginx.erb
@@ -0,0 +1,22 @@
+#####################################################################
+#### THIS FILE IS MANAGED BY PUPPET
+#### puppet:///templates/extdist.nginx.erb
+####
+####  Changes to this file will be discarded by Puppet periodically
+####  and without warning.
+####
+######################################################################
+# nginx configuration for extdist
+
+server {
+    listen 80;
+
+    location / {
+        return 302 https://www.mediawiki.org/wiki/Special:ExtensionDistributor;
+    }
+
+    location /dist {
+        alias <%= @dist_dir %>;
+        autoindex on;
+    }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I63d285612bd30d24b83718c4c8967144d146afeb
Gerrit-PatchSet: 30
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to