2016-12-08 15:10:25 -06:00
|
|
|
# -*- 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')
|
2017-04-01 16:31:52 -05:00
|
|
|
with cd('/srv/envs/demo'):
|
|
|
|
sudo('bin/alembic --config=app/tempmon.conf upgrade heads', user='rattail')
|
2016-12-08 15:10:25 -06:00
|
|
|
sudo('service apache2 restart')
|
2016-12-16 21:23:35 -06:00
|
|
|
run('curl --output demo.html https://rattailproject.org/demo/')
|
|
|
|
run('rm demo.html')
|