Commits

Benoit C committed 8b39d80

missing files, wsgi_restart changes

Comments (0)

Files changed (3)

 def prod(conf="conf.yaml"):
     """Prod tasks"""
     load_yaml('prod', conf)
+    env.project_name = env.yaml.get('project').get('name')
     env.type = 'prod'
-
     env.hosts = env.yaml.get('hosts').get('web')
-    env.user = env.yaml.get('project').get('user')
-    env.path = '/home/%(user)s/django/%(project_name)s' % env
+    env.user = env.yaml.get('project').get('sudo_user')
+    env.path = env.yaml.get('project').get('root_dir')
     env.virtualhost_path = env.path
 
 
-@Permissions("sudo_user", env)
+@Permissions("normal_user", env)
 @ConfChecker("wsgi", env)
 def wsgi_restart():
     """Restarts the wsgi process"""
     conf = env.yaml.get("wsgi")
     django = env.yaml.get("django")
-    if exists(conf.get('pidfile')):
-        if isinstance(conf.get('port'), list):
-            for port in conf.get('port'):
-                pidfile = "%s.%d" % (conf.get('pidfile'), port)
+    if isinstance(conf.get('port'), list):
+        for port in conf.get('port'):
+            pidfile = "%s.%d" % (conf.get('pidfile'), port)
+            if exists(pidfile):
                 run("kill -0 `cat %s`" % pidfile)
                 run("kill -HUP `head -1 %s`" % pidfile)
-        return
-    with cd("%(src_dir)s" % django):
-        if isinstance(conf.get('port'), list):
-            for port in conf.get('port'):
+            else:
                 run("%s/gunicorn_django --workers=%d --port=%d --pid=%s --log-file=%s -D" % \
                         (conf.get('path'), conf.get('workers'),
-                         port, conf.get('pidfile'), conf.get('logfile')))
-        else:
-            run("%s/gunicorn_django --workers=%d --port=%d --pid=%s --log-file=%s" % \
-                    (conf.get('path'), conf.get('workers'),
-                     conf.get('port'), conf.get('pid'), conf.get('logfile')))
+                         port, pidfile, conf.get('logfile')))
 
 @Permissions("sudo_user", env)
 @ConfChecker("httpd", env)
             sudo("apt-get install %s" % package)
 
 
+def update():
+    """updates the code and everything else"""
+    distro_install()
+
+    update_hg
+
+    install_httpd_vhost()
+
+    update_database()
+    # install django configuration
+    django_settings()
+
+    # start/restart the wsgi/fcgi process
+    wsgi_restart()
+
+    # restart other services
+    services_reload()
+    services_restart()
+
+
+
+
 def install():
     """for the first install onto the machines"""
     # install required packages 
     # install the vhost required for the django application
     install_httpd_vhost()
 
-    # update the database schema
-    update_database()
-
+    # install the database schema
+    install_database()
 
     # install django configuration
+    django_settings()
 
     # start/restart the wsgi/fcgi process
+    wsgi_restart()
 
     # restart other services
+    services_reload()
+    services_restart()
 
 
-

src/fabulator/__init__.py

+"""
+    Fabulator's package
+"""

src/fabulator/logging.py

+"""
+    fabulator logging facility
+"""
+