creating directory structure for supervisord files for #174
authorBryan Bonvallet <btbonval@gmail.com>
Wed, 27 Nov 2013 03:30:21 +0000 (22:30 -0500)
committerBryan Bonvallet <btbonval@gmail.com>
Wed, 27 Nov 2013 03:30:21 +0000 (22:30 -0500)
confs/prod/supervisord-root.conf
confs/prod/supervisord.conf
fabfile.py

index c3716029144f90d965c320086017304eff341bd2..e77ee30444b5c5d9a9bc65148eddc827854408b1 100644 (file)
@@ -23,7 +23,7 @@ redirect_stderr = true
 stopsignal = QUIT
 
 [program:celeryd]
-command=/var/www/karmaworld/manage.py celery worker --pidfile=/var/www/karmaworld/var/run/celeryd.pid -l info
+command=/var/www/karmaworld/prod-code/manage.py celery worker --pidfile=/var/www/karmaworld/var/run/celeryd.pid -l info
 autorestart = true
 redirect_stderr = true
 stdout_logfile=/var/log/celeryd.log
index ed54cb7f902d3c00cf19df4e7364db9e74bfed0e..76d93646b1916755a45e1a58749fdd65483305e7 100644 (file)
@@ -23,7 +23,7 @@ redirect_stderr = true
 stopsignal = QUIT
 
 [program:celeryd]
-command=/var/www/karmaworld/manage.py celery worker --pidfile=/var/www/karmaworld/var/run/celeryd.pid -l info
+command=/var/www/karmaworld/prod-code/manage.py celery worker --pidfile=/var/www/karmaworld/var/run/celeryd.pid -l info
 autorestart = true
 redirect_stderr = true
 stdout_logfile=/var/www/karmaworld/var/log/celeryd.log
index 2d9db6535e5b146a3154d70ea097df69c7a1eeda..0b475be81691b6d900f31318d2b2719a821f84b9 100644 (file)
@@ -3,17 +3,20 @@
     Finals Club (c) 2013"""
 
 import os
+import ConfigParser
 
 from fabric.api import cd, env, lcd, prefix, run, task, local, settings
 from fabric.contrib import files
 
 ######### GLOBAL
+env.user = 'vagrant'
+env.group = 'vagrant'
 env.proj_repo = 'git@github.com:FinalsClub/karmaworld.git'
 env.repo_root = '~/karmaworld'
 env.proj_root = '/var/www/karmaworld'
 env.branch = 'prod'
 env.code_root = '{0}/{1}-code'.format(env.proj_root, env.branch)
-env.supervisor_conf = '{0}/confs/{1}/supervisord-root.conf'.format(env.code_root, env.branch))
+env.supervisor_conf = '{0}/confs/{1}/supervisord-root.conf'.format(env.code_root, env.branch)
 
 ######## Define host(s)
 def here():
@@ -210,11 +213,27 @@ def backup():
     """
     pass
 
+@task
+def file_setup():
+    """
+    Deploy expected files and directories from non-apt system services.
+    """
+    ini_parser = ConfigParser.SafeConfigParser()
+    ini_parser.read(env.supervisor_conf)
+    for section, option in (('supervisord','logfile'),
+                            ('supervisord','pidfile'),
+                            ('unix_http_server','file'),
+                            ('program:celeryd','stdout_logfile')):
+      filepath = ini_parser.get(section, option)
+      # generate file's directory structure if needed
+      run('mkdir -p {0}'.format(os.path.split(filepath))
+
 @task
 def first_deploy():
     """
     Sets up and deploys the project for the first time.
     """
+    file_setup()
     make_virtualenv()
     update_reqs()
     syncdb()