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

Change subject: Graphoid role
......................................................................


Graphoid role

Implemented based on mathoid role

Change-Id: I16fc80ac0aa459c20e3bd40b03fa786e889542a1
---
M .gitignore
M puppet/hieradata/common.yaml
A puppet/modules/graphoid/manifests/init.pp
A puppet/modules/graphoid/manifests/install/git.pp
A puppet/modules/graphoid/templates/config.erb
A puppet/modules/graphoid/templates/upstart.erb
A puppet/modules/role/manifests/graphoid.pp
7 files changed, 140 insertions(+), 0 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.gitignore b/.gitignore
index 6c6e165..bde4b54 100644
--- a/.gitignore
+++ b/.gitignore
@@ -31,3 +31,4 @@
 /iegreview
 /profiles
 /phab
+/node_modules
diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml
index 2580e0f..94fca28 100644
--- a/puppet/hieradata/common.yaml
+++ b/puppet/hieradata/common.yaml
@@ -114,6 +114,12 @@
 mathoid::log_dir: /vagrant/logs
 mathoid::port: 10042
 
+graphoid::base_path: /vagrant/graphoid
+graphoid::node_path: /vagrant/graphoid/node_modules
+graphoid::conf_path: /vagrant/graphoid/graphoid.config.json
+graphoid::log_dir: /vagrant/logs
+graphoid::port: 11042
+
 php::sessionclean::ensure: present
 
 iegreview::vhost_name: iegreview.local.wmftest.net
diff --git a/puppet/modules/graphoid/manifests/init.pp 
b/puppet/modules/graphoid/manifests/init.pp
new file mode 100644
index 0000000..0b279a1
--- /dev/null
+++ b/puppet/modules/graphoid/manifests/init.pp
@@ -0,0 +1,61 @@
+# == Class: graphoid
+#
+# graphoid is a node.js backend for the graph rendering.
+#
+# === Parameters
+#
+# [*base_path*]
+#   Path to the graphoid code. (e.g. /vagrant/graphoid)
+#
+# [*node_path*]
+#   Path to the node modules graphoid depends on.
+#   (e.g. /vagrant/graphoid/node_modules)
+#
+# [*conf_path*]
+#   Where to place the config file.
+#   (e.g. /vagrant/graphoid/graphoid.config.json)
+#
+# [*log_dir*]
+#   Place where graphoid can put log files. Assumed to be already existing and
+#   have write access to graphoid user. (e.g. /vagrant/logs)
+#
+# [*port*]
+#   Port the graphoid service listens on for incoming connections. (e.g 11042)
+#
+class graphoid(
+    $base_path,
+    $node_path,
+    $conf_path,
+    $log_dir,
+    $port,
+) {
+
+    $log_file = "${log_dir}/graphoid.log"
+
+    require_package('nodejs')
+    require_package('libcairo2-dev')
+    require_package('libjpeg-dev')
+    require_package('libgif-dev')
+
+    file { $conf_path:
+        ensure  => present,
+        content => template('graphoid/config.erb'),
+    }
+
+    # The upstart configuration
+    file { '/etc/init/graphoid.conf':
+        ensure  => present,
+        owner   => root,
+        group   => root,
+        mode    => '0444',
+        content => template('graphoid/upstart.erb'),
+    }
+
+    service { 'graphoid':
+        ensure     => running,
+        hasstatus  => true,
+        hasrestart => true,
+        provider   => 'upstart',
+        subscribe  => File['/etc/init/graphoid.conf'],
+    }
+}
diff --git a/puppet/modules/graphoid/manifests/install/git.pp 
b/puppet/modules/graphoid/manifests/install/git.pp
new file mode 100644
index 0000000..e884203
--- /dev/null
+++ b/puppet/modules/graphoid/manifests/install/git.pp
@@ -0,0 +1,12 @@
+# == Class: graphoid::install::git
+#
+# Provision graphoid by cloning the git repository.
+#
+class graphoid::install::git {
+    include ::graphoid
+
+    git::clone{ 'mediawiki/services/graphoid':
+        directory => $::graphoid::base_path,
+        before    => Class['::graphoid'],
+    }
+}
diff --git a/puppet/modules/graphoid/templates/config.erb 
b/puppet/modules/graphoid/templates/config.erb
new file mode 100644
index 0000000..2cd31ee
--- /dev/null
+++ b/puppet/modules/graphoid/templates/config.erb
@@ -0,0 +1,19 @@
+{
+  "domains": [
+    "localhost",
+    "127.0.0.1",
+    "wmflabs.org",
+    "mediawiki.org",
+    "wikibooks.org",
+    "wikidata.org",
+    "wikimedia.org",
+    "wikimediafoundation.org",
+    "wikinews.org",
+    "wikipedia.org",
+    "wikiquote.org",
+    "wikisource.org",
+    "wikiversity.org",
+    "wikivoyage.org",
+    "wiktionary.org"
+  ]
+}
diff --git a/puppet/modules/graphoid/templates/upstart.erb 
b/puppet/modules/graphoid/templates/upstart.erb
new file mode 100644
index 0000000..63adc96
--- /dev/null
+++ b/puppet/modules/graphoid/templates/upstart.erb
@@ -0,0 +1,25 @@
+#####################################################################
+### THIS FILE IS MANAGED BY PUPPET
+#####################################################################
+
+description "Graphoid HTTP service"
+
+start on mediawiki-ready
+stop on runlevel [!2345]
+
+# up ulimit -n a bit
+limit nofile 10000 10000
+
+setuid "www-data"
+setgid "www-data"
+
+env NODE_PATH="<%= @node_path %>"
+env GRAPHOID_PORT="<%= @port %>"
+
+respawn
+
+# wait 60 seconds for a graceful restart before killing the master
+kill timeout 60
+
+chdir "<%= @base_path %>"
+exec /usr/bin/nodejs graphoid.js >> "<%= @log_file %>" 2>&1
diff --git a/puppet/modules/role/manifests/graphoid.pp 
b/puppet/modules/role/manifests/graphoid.pp
new file mode 100644
index 0000000..4f8ede6
--- /dev/null
+++ b/puppet/modules/role/manifests/graphoid.pp
@@ -0,0 +1,16 @@
+# == Class: role::graphoid
+# This role installs the graphoid service for server side graph rendering.
+#
+class role::graphoid {
+    require ::graphoid::install::git
+    # use local graphoid renderer
+    mediawiki::settings { 'Graphoid':
+        values => [
+            '$wgGraphImgServiceUrl = 
"//$wgServerName:11042?server=%1\$s&title=%2\$s&revid=%3\$s&id=%4\$s";',
+        ],
+    }
+
+    vagrant::settings { 'graphoid':
+        forward_ports => { 11042 => 11042 },
+    }
+}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I16fc80ac0aa459c20e3bd40b03fa786e889542a1
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/vagrant
Gerrit-Branch: master
Gerrit-Owner: Yurik <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Milimetric <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to