From: Bryan Bonvallet Date: Wed, 27 Nov 2013 01:19:11 +0000 (-0500) Subject: get supervisord up and running for #174 X-Git-Tag: release-20150131~386^2~37 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c3c5dce38649baa4ab84040210ceaa050ca64865;p=oweals%2Fkarmaworld.git get supervisord up and running for #174 --- diff --git a/confs/prod/supervisord-root.conf b/confs/prod/supervisord-root.conf new file mode 100644 index 0000000..c371602 --- /dev/null +++ b/confs/prod/supervisord-root.conf @@ -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 + diff --git a/fabfile.py b/fabfile.py index b51f6dc..2d9db65 100644 --- a/fabfile.py +++ b/fabfile.py @@ -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