diff --git a/fabfile.py b/fabfile.py new file mode 100644 index 0000000..8113230 --- /dev/null +++ b/fabfile.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +""" +Fabric script for Rattail Demo +""" + +from __future__ import unicode_literals, absolute_import + +import shutil + +from fabric.api import * + +from rattail.fablib import cdvirtualenv, workon, python + + +env.roledefs = { + 'production': ['lance@rattailproject.org'], +} + + +@task +def release(): + """ + Release a new version of rattail-demo + """ + shutil.rmtree('rattail_demo.egg-info') + local('python setup.py sdist --formats=gztar upload') + + +@task +@roles('production') +def update_production(all='false'): + """ + Update production Rattail Demo server + """ + all = all.lower() == 'true' + if all: + with workon('demo'): + python.pip('pip', 'setuptools', 'wheel', 'ndg-httpsclient') + with cdvirtualenv('demo', 'src/rattail'): + sudo('git pull') + sudo('pip install --editable .') + with cdvirtualenv('demo', 'src/rattail-tempmon'): + sudo('git pull') + sudo('pip install --editable .') + with cdvirtualenv('demo', 'src/tailbone'): + sudo('git pull') + sudo('pip install --editable .') + + with cdvirtualenv('demo', 'src/rattail-demo'): + sudo('git pull') + if all: + sudo('pip install --upgrade --editable .') + else: + sudo('pip install --editable .') + with cd('/srv/envs/demo'): + sudo('bin/alembic --config=app/rattail.conf upgrade heads', user='rattail') + sudo('service apache2 restart')