diff --git a/fabfile.py b/fabfile.py index 86f659b..98d0484 100644 --- a/fabfile.py +++ b/fabfile.py @@ -1,6 +1,7 @@ from __future__ import with_statement import time from fabric.api import * +from hashlib import sha1 env.repo = 'git://dev.dredd.it/dreddit-auth.git' @@ -15,7 +16,9 @@ def test(): "Use the test enviroment on Web2" env.hosts = ['dreddit@web2.pleaseignore.com'] env.path = '/home/dreddit/apps' - + env.user = 'auth' + env.vhost = 'auth' + env.password = sha1('%s-%s' % (env.user, env.vhost)).hexdigest() def deploy(): """ @@ -71,6 +74,25 @@ def setup_db(): run('if [ ! -e dbsettings.py ]; then cp dbsettings.py.example dbsettings.py; fi' % env) run('env/bin/python manage.py syncdb --noinput --migrate') +def setup_rabbitmq(): + """ + Setup the RabbitMQ instance on the system (requires sudo access) + """ + + require('path') + + cnf = open('brokersettings.py.example', 'r').read() + out = open('brokersettings.py', 'w') + out.write(cnf % env) + + sudo('rabbitmqctl add_user %s %s' % (env.user, env.password), shell=False) + sudo('rabbitmqctl add_vhost %s' % env.vhost, shell=False) + sudo('rabbitmqctl set_permissions -p %s %s ".*" ".*" ".*"' % (env.vhost, env.user), shell=False) + + with cd('%(path)s/dreddit-auth/' % env): + put('brokersettings.py', '.') + + os.unlink('brokersettings.py') def deploy_repo(): """ diff --git a/settings.py b/settings.py index ada56b6..20072c9 100755 --- a/settings.py +++ b/settings.py @@ -16,6 +16,9 @@ MANAGERS = ADMINS # Import db settings from dbsettings.py from dbsettings import * +# Import the Broker settings +from brokersettings.py import * + # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@ -147,18 +150,12 @@ HR_STAFF_GROUP = 'HR Staff' FULL_API_USER_ID = 415631 FULL_API_CHARACTER_ID = 246102445 -### Celery Broker - -BROKER_HOST = "localhost" -BROKER_PORT = 5672 -BROKER_USER = "guest" -BROKER_PASSWORD = "guest" -BROKER_VHOST = "/" - # try and import local settings try: from settingslocal import * except: pass + + djcelery.setup_loader()