Madhuvishy has uploaded a new change for review.

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

Change subject: [WIP] ifttt: Set up Wikimedia IFTTT channel service using 
puppet on labs
......................................................................

[WIP] ifttt: Set up Wikimedia IFTTT channel service using puppet on labs

Change-Id: I4460e1886e376a526df4e8babfce92d516a2b484
---
A modules/ifttt/manifests/base.pp
A modules/ifttt/manifests/web.pp
2 files changed, 58 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/puppet 
refs/changes/89/277189/1

diff --git a/modules/ifttt/manifests/base.pp b/modules/ifttt/manifests/base.pp
new file mode 100644
index 0000000..2c95e07
--- /dev/null
+++ b/modules/ifttt/manifests/base.pp
@@ -0,0 +1,37 @@
+# = Class: ifttt::base
+# Base class that sets up directories and git repo
+class ifttt::base(
+    $branch = 'master',
+    $venv_path = '/srv/ifttt/venv',
+) {
+    # Let's use a virtualenv for maximum flexibility - we can convert
+    # this to deb packages in the future if needed.
+    require_package('virtualenv')
+
+    $source_path = '/srv/ifttt'
+
+    file { '/srv':
+        ensure => directory,
+        owner  => 'root',
+        group  => 'root',
+        mode   => '0775',
+    }
+
+    file { $source_path:
+        ensure  => directory,
+        owner   => 'www-data',
+        group   => 'www-data',
+        mode    => '0775',
+        require => File['/srv'],
+    }
+
+    git::clone { 'ifttt':
+        ensure    => present,
+        origin    => 'https://github.com/madhuvishy/ifttt.git',
+        directory => '$source_path',
+        branch    => $branch,
+        owner     => 'www-data',
+        group     => 'www-data',
+        require   => File[$source_path],
+    }
+}
diff --git a/modules/ifttt/manifests/web.pp b/modules/ifttt/manifests/web.pp
new file mode 100644
index 0000000..7400c16
--- /dev/null
+++ b/modules/ifttt/manifests/web.pp
@@ -0,0 +1,21 @@
+# = Class: ifttt::web
+# Sets up a uwsgi based web server for the Wikimedia IFTTT service
+class ifttt::web(
+    $workers_per_core = 4,
+) {
+    require ifttt::base
+
+    uwsgi::app { 'ifttt':
+        settings => {
+            uwsgi => {
+                plugins     => 'python2',
+                'wsgi-file' => "${ifttt::base::source_path}/app.py",
+                master      => true,
+                chdir       => $ifttt::base::source_path,
+                http-socket => '0.0.0.0:8080',
+                venv        => $ifttt::base::venv_path,
+                processes   => inline_template("<%= @processorcount.to_i * 
${workers_per_core} %>"),
+            }
+        }
+    }
+}

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

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

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

Reply via email to