From 4e5ab5576932540012b17cf0c150f137f0b63f1f Mon Sep 17 00:00:00 2001 From: Bryan Bonvallet Date: Tue, 26 Nov 2013 22:30:21 -0500 Subject: [PATCH] creating directory structure for supervisord files for #174 --- confs/prod/supervisord-root.conf | 2 +- confs/prod/supervisord.conf | 2 +- fabfile.py | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/confs/prod/supervisord-root.conf b/confs/prod/supervisord-root.conf index c371602..e77ee30 100644 --- a/confs/prod/supervisord-root.conf +++ b/confs/prod/supervisord-root.conf @@ -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 diff --git a/confs/prod/supervisord.conf b/confs/prod/supervisord.conf index ed54cb7..76d9364 100644 --- a/confs/prod/supervisord.conf +++ b/confs/prod/supervisord.conf @@ -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 diff --git a/fabfile.py b/fabfile.py index 2d9db65..0b475be 100644 --- a/fabfile.py +++ b/fabfile.py @@ -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() -- 2.25.1