Yuvipanda has uploaded a new change for review.

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

Change subject: [WIP] Add lighttpd server types
......................................................................

[WIP] Add lighttpd server types

TODO:
- Include .lighttpd.conf if present
- Make variants that do not include the default PHP handlers

Change-Id: I052e2c5b92755c66c0af5971b487c2cc1a9e83dd
---
M tools/webservice/services/__init__.py
A tools/webservice/services/lighttpdwebservice.py
2 files changed, 72 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/software/tools-webservice 
refs/changes/33/210833/1

diff --git a/tools/webservice/services/__init__.py 
b/tools/webservice/services/__init__.py
index c8b6969..9b82cd0 100644
--- a/tools/webservice/services/__init__.py
+++ b/tools/webservice/services/__init__.py
@@ -1,4 +1,5 @@
 from tools.webservice.services.jswebservice import JSWebService
 from tools.webservice.services.pythonwebservice import PythonWebService
+from tools.webservice.services.lighttpdwebservice import LighttpdWebService
 
 webservice_classes = {cls.NAME: cls for cls in [JSWebService, 
PythonWebService]}
diff --git a/tools/webservice/services/lighttpdwebservice.py 
b/tools/webservice/services/lighttpdwebservice.py
new file mode 100644
index 0000000..10b8f60
--- /dev/null
+++ b/tools/webservice/services/lighttpdwebservice.py
@@ -0,0 +1,71 @@
+from tools.webservice import WebService
+
+CONFIG_TEMPLATE = """
+server.modules = (
+  "mod_setenv",
+  "mod_access",
+  "mod_accesslog",
+  "mod_alias",
+  "mod_compress",
+  "mod_redirect",
+  "mod_rewrite",
+  "mod_fastcgi",
+  "mod_cgi",
+)
+
+server.port = {{port}}
+server.use-ipv6 = "disable"
+server.username = "{{username}}"
+server.groupname = "{{groupname}}"
+server.core-files = "disable"
+server.document-root = "{{home}}/public_html"
+server.pid-file = "$runbase.pid"
+server.errorlog = "{{home}}/error.log"
+server.breakagelog = "{{home}}/error.log"
+server.follow-symlink = "enable"
+server.max-connections = 300
+server.stat-cache-engine = "fam"
+server.event-handler = "linux-sysepoll"
+ssl.engine = "disable"
+
+alias.url = ( "/{{toolname}}" => "{{home}}/public_html/" )
+
+index-file.names = ( "index.php", "index.html", "index.htm" )
+dir-listing.encoding = "utf-8"
+server.dir-listing = "disable"
+url.access-deny = ( "~", ".inc" )
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
+
+accesslog.use-syslog = "disable"
+accesslog.filename = "{{home}}/access.log"
+
+include_shell "/usr/share/lighttpd/create-mime.assign.pl"
+
+cgi.assign = (
+  ".pl" => "/usr/bin/perl",
+  ".py" => "/usr/bin/python",
+  ".pyc" => "/usr/bin/python",
+)
+"""
+
+class LighttpdWebService(WebService):
+    NAME = 'lighttpd'
+    QUEUE = 'webgrid-lighttpd'
+
+    def check(self):
+        # Check for a .lighttpd.conf file or a public_html
+        public_html_path = self.tool.get_homedir_subpath('public_html')
+        lighttpd_conf_path = self.tool.get_homedir_subpath('.lighttpd.conf')
+        if not (os.path.exists(public_html_path) or 
os.path.exists(lighttpd_conf_path)):
+            raise WebService.InvalidWebServiceException(
+                'Could not find a public_html folder or a .lighttpd.conf file '
+                'in your tool home.'
+            )
+
+    def run(self, port):
+        print CONFIG_TEMPLATE.format(
+            toolname=self.tool.name,
+            username=self.tool.username,
+            groupname=self.tool.groupname,
+            home=self.tool.home,
+        )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I052e2c5b92755c66c0af5971b487c2cc1a9e83dd
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/tools-webservice
Gerrit-Branch: master
Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com>

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

Reply via email to