Yuvipanda has submitted this change and it was merged.

Change subject: toollabs: Add support for uwsgi-plain webservice type
......................................................................


toollabs: Add support for uwsgi-plain webservice type

Same as uwsgi-python without the python specific bits, for people
to be able to run python3/ruby other uwsgi plugins.

Bug: T104374
Change-Id: I5f599f5dce666942608ceacd0ebc282154f9a97c
---
A modules/toollabs/files/tool-uwsgi-plain
M modules/toollabs/files/webservice2
M modules/toollabs/manifests/node/web/generic.pp
3 files changed, 38 insertions(+), 3 deletions(-)

Approvals:
  Yuvipanda: Verified; Looks good to me, approved
  Merlijn van Deen: Looks good to me, but someone else must approve



diff --git a/modules/toollabs/files/tool-uwsgi-plain 
b/modules/toollabs/files/tool-uwsgi-plain
new file mode 100755
index 0000000..3a6d89f
--- /dev/null
+++ b/modules/toollabs/files/tool-uwsgi-plain
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+import os
+
+import portgrabber
+
+# Attempt to get an open port
+port = portgrabber.get_open_port()
+
+args = [
+    '/usr/bin/uwsgi',
+    '--http-socket', ':' + str(port),
+    '--logto', os.path.expanduser('~/uwsgi.log'),
+    '--workers', '4',
+    '--die-on-term',
+    '--strict',
+    '--master'
+]
+
+if os.path.exists(os.path.expanduser('~/www/python/venv')):
+    args += ['--venv', os.path.expanduser('~/www/python/venv')]
+
+if os.path.exists(os.path.expanduser('~/www/python/uwsgi.ini')):
+    args += ['--ini', os.path.expanduser('~/www/python/uwsgi.ini')]
+
+# Connect to the proxylistener instances on the web proxies and notify
+# them where requests for the tool need to be routed to.
+portgrabber.register(port)
+
+os.execv('/usr/bin/uwsgi', args)
diff --git a/modules/toollabs/files/webservice2 
b/modules/toollabs/files/webservice2
index 61335c3..75a67e4 100644
--- a/modules/toollabs/files/webservice2
+++ b/modules/toollabs/files/webservice2
@@ -18,7 +18,7 @@
     :param server: Type of server to get queue name for
     :return: String containing queue name to use for given server type
     """
-    if server in ('nodejs', 'tomcat', 'uwsgi-python'):
+    if server in ('nodejs', 'tomcat', 'uwsgi-python', 'uwsgi-plain'):
         return 'webgrid-generic'
     return 'webgrid-' + server
 
@@ -182,7 +182,7 @@
     """
     Update the current tool's service manifest to specify the currently 
started / stopped web service type
 
-    :param webservice_type: string representing webservice type (lighttpd, 
lighttpd-precise, nodejs, uwsgi-python)
+    :param webservice_type: string representing webservice type (lighttpd, 
lighttpd-precise, uwsgi-plain, nodejs, uwsgi-python)
                             or None to represent lack of a webservice (will 
result in web: being removed)
     """
     with open(os.path.expanduser('~/service.manifest'), 'wb+') as f:
@@ -203,7 +203,7 @@
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('server', help='Type of server to start',
-                        choices=['lighttpd', 'tomcat', 'uwsgi-python', 
'nodejs'],
+                        choices=['lighttpd', 'tomcat', 'uwsgi-python', 
'nodejs', 'uwsgi-plain'],
                         nargs='?')
     parser.add_argument('action', help='Action to perform',
                         choices=['stop', 'start', 'restart', 'status'])
diff --git a/modules/toollabs/manifests/node/web/generic.pp 
b/modules/toollabs/manifests/node/web/generic.pp
index 113dd82..1efb19e 100644
--- a/modules/toollabs/manifests/node/web/generic.pp
+++ b/modules/toollabs/manifests/node/web/generic.pp
@@ -29,6 +29,12 @@
         require => 
File['/usr/local/lib/python2.7/dist-packages/portgrabber.py'],
     }
 
+    file { '/usr/local/bin/tool-uwsgi-plain':
+        source  => 'puppet:///modules/toollabs/tool-uwsgi-plain',
+        mode    => '0555',
+        require => 
File['/usr/local/lib/python2.7/dist-packages/portgrabber.py'],
+    }
+
     # tomcat support
     package { [ 'tomcat7-user', 'xmlstarlet' ]:
         ensure => latest,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5f599f5dce666942608ceacd0ebc282154f9a97c
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <yuvipa...@wikimedia.org>
Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl>
Gerrit-Reviewer: Yuvipanda <yuvipa...@wikimedia.org>
Gerrit-Reviewer: coren <mpellet...@wikimedia.org>
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