Update fabric, remove unneeded funcs

This commit is contained in:
2011-05-27 14:55:43 +01:00
parent 9e20cc6722
commit 8a78f6ed15

44
fabfile.py vendored
View File

@@ -75,43 +75,9 @@ def setup_db():
require('path') require('path')
with cd('%(path)s/dreddit-auth/' % env): with cd('%(path)s/dreddit-auth/' % env):
run('if [ ! -e dbsettings.py ]; then cp dbsettings.py.example dbsettings.py; fi' % env)
run('env/bin/python app/manage.py syncdb --noinput --migrate') run('env/bin/python app/manage.py syncdb --noinput --migrate')
def generate_brokersettings():
"""
Generates the brokersettings file
"""
require('hosts')
cnf = open('brokersettings.py.example', 'r').read()
out = open('brokersettings.py', 'w')
out.write(cnf % env)
def setup_rabbitmq():
"""
Setup the RabbitMQ instance on the system (requires sudo access)
"""
require('hosts')
require('path')
generate_brokersettings()
with settings(warn_only=True):
sudo('rabbitmqctl delete_user %s' % env.user, shell=False)
sudo('rabbitmqctl delete_vhost %s' % env.vhost, shell=False)
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)
put('./brokersettings.py', '%(path)s/dreddit-auth/app/conf/' % env)
os.unlink('brokersettings.py')
def deploy_repo(): def deploy_repo():
""" """
Do the initial repository checkout Do the initial repository checkout
@@ -201,19 +167,15 @@ def start_uwsgi():
""" """
Start uWSGI Start uWSGI
""" """
with cd('%(path)s/dreddit-auth/' % env): pass
run('uwsgi -d logs/uwsgi.log -x etc/auth_uwsgi.xml' % env)
def restart_uwsgi(): def restart_uwsgi():
""" """
Restart the uWSGI daemon Restart the uWSGI daemon
""" """
with cd('%(path)s/dreddit-auth/' % env): pass
if exists('logs/uwsgi.pid'):
run('kill `cat logs/uwsgi.pid`')
else:
warn('uWSGI isn\'t running')
def start(): def start():
""" """