jenkins-bot has submitted this change and it was merged.

Change subject: Make Mathoid role configurable via hiera
......................................................................


Make Mathoid role configurable via hiera

Change-Id: I877efa2877843d60a43392da1a68e54991703000
---
M .gitignore
M puppet/hieradata/common.yaml
M puppet/modules/mathoid/manifests/init.pp
A puppet/modules/mathoid/manifests/install/git.pp
M puppet/modules/role/manifests/mathoid.pp
5 files changed, 36 insertions(+), 20 deletions(-)

Approvals:
  BryanDavis: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.gitignore b/.gitignore
index de45255..daf343b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,4 @@
 /vagrant.d/
 /support/packager/output
 /wikimetrics/
+/mathoid
diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml
index 43fefff..72f9385 100644
--- a/puppet/hieradata/common.yaml
+++ b/puppet/hieradata/common.yaml
@@ -18,6 +18,12 @@
 
 hhvm::logroot: /vagrant/logs
 
+mathoid::base_path: /vagrant/mathoid
+mathoid::node_path: /vagrant/mathoid/node_modules
+mathoid::conf_path: /vagrant/mathoid/mathoid.config.json
+mathoid::log_dir: /vagrant/logs
+mathoid::port: 10042
+
 mediawiki::wiki_name: devwiki
 mediawiki::dir: /vagrant/mediawiki
 mediawiki::cache_dir: /var/cache/mediawiki
diff --git a/puppet/modules/mathoid/manifests/init.pp 
b/puppet/modules/mathoid/manifests/init.pp
index 908ed17..35c544e 100644
--- a/puppet/modules/mathoid/manifests/init.pp
+++ b/puppet/modules/mathoid/manifests/init.pp
@@ -5,38 +5,40 @@
 # === Parameters
 #
 # [*base_path*]
-#   Path to the mathoid code.
+#   Path to the mathoid code. (e.g. /vagrant/mathoid)
+#
 # [*node_path*]
 #   Path to the node modules mathoid depends on.
+#   (e.g. /vagrant/mathoid/node_modules)
+#
 # [*conf_path*]
 #   Where to place the config file.
+#   (e.g. /vagrant/mathoid/mathoid.config.json)
+#
 # [*log_dir*]
 #   Place where mathoid can put log files. Assumed to be already existing and
-#   have write access to mathoid user.
+#   have write access to mathoid user. (e.g. /vagrant/logs)
+#
 # [*port*]
-#   Port where to run the mathoid service. Defaults to 10042.
-
+#   Port the mathoid service listens on for incoming connections. (e.g 10042)
 #
 class mathoid(
     $base_path,
     $node_path,
     $conf_path,
     $log_dir,
-    $port=10042,
+    $port,
 ) {
+
+    $log_file = "${log_dir}/mathoid.log"
 
     # TODO Add dependency to node-jsdom once
     # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742347
     # is fixed
     require_package('nodejs')
 
-    $log_file = "${log_dir}/main.log"
-
     file { $conf_path:
         ensure  => present,
-        owner   => mathoid,
-        group   => mathoid,
-        mode    => '0644',
         content => template('mathoid/config.erb'),
     }
 
@@ -54,7 +56,6 @@
         hasstatus  => true,
         hasrestart => true,
         provider   => 'upstart',
-        require    => File[$log_dir],
         subscribe  => File['/etc/init/mathoid.conf'],
     }
 }
diff --git a/puppet/modules/mathoid/manifests/install/git.pp 
b/puppet/modules/mathoid/manifests/install/git.pp
new file mode 100644
index 0000000..4286353
--- /dev/null
+++ b/puppet/modules/mathoid/manifests/install/git.pp
@@ -0,0 +1,12 @@
+# == Class: mathoid::install::git
+#
+# Provision mathoid by cloning the git repository.
+#
+class mathoid::install::git {
+    include ::mathoid
+
+    git::clone{ 'mediawiki/services/mathoid':
+        directory => $::mathoid::base_path,
+        before    => Class['::mathoid'],
+    }
+}
diff --git a/puppet/modules/role/manifests/mathoid.pp 
b/puppet/modules/role/manifests/mathoid.pp
index 27d4a17..07bc0f7 100644
--- a/puppet/modules/role/manifests/mathoid.pp
+++ b/puppet/modules/role/manifests/mathoid.pp
@@ -1,10 +1,6 @@
+# == Class: role::mathoid
+# This role installs the mathoid service for server side MathJax rendering.
+#
 class role::mathoid {
-
-    class { '::mathoid':
-        base_path => '/srv/mathoid',
-        node_path => '/srv/mathoid/node_modules',
-        conf_path => '/srv/mathoid/mathoid.config.json',
-        log_dir   => '/vagrant/log/mathoid',
-        require   => Git::Clone['mediawiki/services/mathoid'],
-    }
-}
\ No newline at end of file
+    require ::mathoid::install::git
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I877efa2877843d60a43392da1a68e54991703000
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: BryanDavis <bda...@wikimedia.org>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Physikerwelt <w...@physikerwelt.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to