Colin Copeland avatar Colin Copeland committed 254162e

add wsgi; allow clients group to restart/reload apache

Comments (0)

Files changed (1)

mallet/client_vm.py

 import logging
 from mallet.bootstrap import apt
 from mallet.bootstrap.apt import lenny
-from mallet.utils import create_ssh, call, write
+from mallet.utils import create_ssh, call, write, writelines
 from mallet.bootstrap.base import PackageGroup
 
 from libcloud.types import Provider
 
 
 class Python(PackageGroup):
-    packages = ['ipython', 'python-setuptools', 'python-dev']
+    packages = ['ipython', 'python-setuptools', 'python-dev', 'libpq-dev',
+                'libapache2-mod-wsgi']
 
     def post_install(self, node_wrapper):
         call(['easy_install', '-U', 'pip'])
         call(['pip', 'install', '-U', 'virtualenv'])
 
 
+class Apache(lenny.Apache):
+
+    def post_install(self, node_wrapper):
+        super(Apache, self).post_install(node_wrapper)
+        logger.info('Creating clients group')
+        call(['addgroup', 'clients'])
+        logger.info('Creating sudoers file')
+        sudoers = ['%clients ALL=NOPASSWD: /etc/init.d/apache2 '
+                   'reload, /etc/init.d/apache2 restart']
+        writelines('/etc/sudoers', sudoers)
+
+
 class NodeWrapper(mallet.NodeWrapper):
 
     def hostname(self):
     distribution = apt.Apt
     release = lenny.Lenny
     packages = [
-        lenny.Apache,
+        Apache,
         Postgres,
         Python,
         lenny.Memcache,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.