Skip to content

Instantly share code, notes, and snippets.

@legoktm
Created July 20, 2014 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save legoktm/ebef5f0f474fa283d21c to your computer and use it in GitHub Desktop.
Save legoktm/ebef5f0f474fa283d21c to your computer and use it in GitHub Desktop.
diff --git a/manifests/role/extdist.pp b/manifests/role/extdist.pp
new file mode 100644
index 0000000..30956f4
--- /dev/null
+++ b/manifests/role/extdist.pp
@@ -0,0 +1,27 @@
+# = Class: role::extdist
+#
+# This class sets up the Extension Distributor tarball generator
+#
+class role::extdist {
+
+ class { '::extdist':
+ # Where to store git clones
+ src_dir => '/srv/src',
+ # Where to store created tarballs
+ dist_dir => '/srv/dist',
+ clone_url => 'https://gerrit.wikimedia.org/r/p/mediawiki/extensions/%s.git'
+ api_url => 'https://www.mediawiki.org/w/api.php',
+ url_endpoint => 'http://extdist.wikimedia.org',
+ }
+
+ uwsgi::app { 'extdist':
+ settings => {
+ uwsgi => {
+ 'plugins' => 'python',
+ 'socket' => '/var/run/extdist/extdist.sock',
+ 'wsgi-file' => '/var/www/extdist/extdist.wsgi'
+ }
+ }
+ }
+
+}
diff --git a/modules/extdist/manifests/init.pp b/modules/extdist/manifests/init.pp
new file mode 100644
index 0000000..a74c0e6
--- /dev/null
+++ b/modules/extdist/manifests/init.pp
@@ -0,0 +1,44 @@
+# = Class: extdist
+#
+# This class installs/configures/manages the Extension Distributor
+# tarball generator.
+#
+# == Parameters:
+# - $src_dir: Directory where to store clones of source code
+# - $dist_dir: Directory where to store created tarballs
+# - $clone_url: URL to use when cloning extensions, with %s being the name of the extension
+# - $api_url: URL to API of site with Extension:ExtensionDistributor installed
+# - $url_endpoint: Where the application is hosted
+# - $deploy_dir: Where code is located
+#
+class extdist(
+ $src_dir = '/srv/src',
+ $dist_dir = '/srv/dist',
+ $clone_url = 'https://gerrit.wikimedia.org/r/p/mediawiki/extensions/%s.git',
+ $api_url = 'https://wwww.mediawiki.org/w/api.php',
+ $url_endpoint = 'extdist.wikimedia.org',
+ $deploy_dir = '/var/www/extdist'
+) {
+
+ system::role { 'extdist':
+ description => 'Extension Distributor tarball generator'
+ }
+
+ # Trebuchet deployment
+ deployment::target { 'extdist': }
+
+ file {
+
+ $deploy_dir:
+ ensure => directory;
+
+ "${deploy_dir}/conf.py":
+ ensure => present,
+ mode => '0444',
+ owner => 'legoktm',
+ group => 'wikidev',
+ notify => Service['apache2'],
+ content => template('extdist/conf.py.erb');
+ }
+
+}
diff --git a/modules/extdist/templates/conf.py.erb b/modules/extdist/templates/conf.py.erb
new file mode 100644
index 0000000..f4a9cba
--- /dev/null
+++ b/modules/extdist/templates/conf.py.erb
@@ -0,0 +1,9 @@
+#####################################################################
+### THIS FILE IS MANAGED BY PUPPET
+### puppet:///modules/extdist/conf.py
+#####################################################################
+SRC_PATH = '<%= @src_path %>'
+DIST_PATH = '<%= @dist_path %>'
+GIT_URL = '<%= @git_url %>'
+API_URL = '<%= @api_url %>'
+URL_ENDPOINT = '<%= @url_endpoint %>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment