get supervisord up and running for #174
authorBryan Bonvallet <btbonval@gmail.com>
Wed, 27 Nov 2013 01:19:11 +0000 (20:19 -0500)
committerBryan Bonvallet <btbonval@gmail.com>
Wed, 27 Nov 2013 01:19:11 +0000 (20:19 -0500)
confs/prod/supervisord-root.conf [new file with mode: 0644]
fabfile.py

diff --git a/confs/prod/supervisord-root.conf b/confs/prod/supervisord-root.conf
new file mode 100644 (file)
index 0000000..c371602
--- /dev/null
@@ -0,0 +1,32 @@
+[supervisord]
+logfile = /var/log/supervisord.log
+logfile_maxbytes = 10MB
+logfile_backups = 5
+loglevel = info
+pidfile = /var/run/supervisord.pid
+
+[supervisorctl]
+serverurl = unix:///var/run/supervisor.sock
+
+[unix_http_server]
+file = /var/run/supervisor.sock
+chmod = 0777
+
+[rpcinterface:supervisor]
+supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
+
+[program:gunicorn]
+command=/var/www/karmaworld/manage.py run_gunicorn -c confs/prod/gunicorn.conf
+autostart = true
+autorestart = true
+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
+autorestart = true
+redirect_stderr = true
+stdout_logfile=/var/log/celeryd.log
+priority = 2
+stopsignal = QUIT
+
index b51f6dc22f765dcdc7f7735f4873d99a51be08d8..2d9db6535e5b146a3154d70ea097df69c7a1eeda 100644 (file)
@@ -13,6 +13,7 @@ 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))
 
 ######## Define host(s)
 def here():
@@ -116,7 +117,7 @@ def start_supervisord():
     """
     Starts supervisord
     """
-    virtenv_exec('supervisord -c {0}/confs/{1}/supervisord.conf'.format(env.code_root, env.branch))
+    virtenv_exec('supervisord -c {0}'.format(env.supervisor_conf))
 
 
 @task
@@ -124,8 +125,7 @@ def stop_supervisord():
     """
     Restarts supervisord
     """
-    config_file = '/var/www/karmaworld/confs/prod/supervisord.conf'
-    virtenv_exec('supervisorctl -c %s shutdown' % config_file)
+    virtenv_exec('supervisorctl -c {0} shutdown'.format(env.supervisor_conf))
 
 
 @task
@@ -143,8 +143,7 @@ def supervisorctl(action, process):
     defined in supervisord.conf and the action that should
     be performed on it: start|stop|restart.
     """
-    supervisor_conf = '/var/www/karmaworld/confs/prod/supervisord.conf'
-    virtenv_exec('supervisorctl -c %s %s %s' % (supervisor_conf, action, process))
+    virtenv_exec('supervisorctl -c {0} {1} {2}'.format(env.supervisor_conf, action, process))
 
 
 @task