Replace rattail.fablib with rattail-fabric

This commit is contained in:
Lance Edgar 2018-02-26 15:12:37 -06:00
parent 4d94122bbb
commit 9f3d19327b
2 changed files with 33 additions and 22 deletions

View file

@ -1,37 +1,26 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8; -*-
"""
Fabric script for the 'host' server
Please see the accompanying README for full instructions.
"""
from __future__ import unicode_literals
from __future__ import unicode_literals, absolute_import
import os
from fabric.api import *
from fabric.contrib.files import append, exists
from rattail.fablib import make_deploy, mkdir, make_system_user, cdvirtualenv, workon
from rattail.fablib import apt, pod, postgresql, python
from rattail_fabric import make_deploy, mkdir, make_system_user, cdvirtualenv, workon
from rattail_fabric import apt, pod, postgresql, python
__all__ = ['bootstrap_all', 'bootstrap_system', 'bootstrap_rattail']
# Set the 'live' role to the canonical hostname for this server.
#env.roledefs = {'live': ['host.example.com']}
deploy = make_deploy(__file__)
try:
import fabenv
except ImportError as error:
warn("Couldn't import fabenv: {0}".format(error))
# Set some default env attrs in case fabenv isn't prepped.
if not hasattr(env, 'password_postgresql_rattail'):
setattr(env, 'password_postgresql_rattail', 'password')
@task
def bootstrap_all():
@ -75,7 +64,7 @@ def bootstrap_rattail():
"""
Bootstrap the Rattail software.
"""
from rattail.fablib.rattail import bootstrap_rattail
from rattail_fabric.rattail import bootstrap_rattail
# rattail user and core files
bootstrap_rattail()
@ -105,6 +94,14 @@ def bootstrap_rattail():
sudo('git pull')
sudo('pip install --upgrade --editable .')
# # rattail-demo source
# with cdvirtualenv('rattail', 'src'):
# if not exists('rattail-demo'):
# sudo('git clone https://rattailproject.org/git/rattail-demo.git')
# with cdvirtualenv('rattail', 'src/rattail-demo'):
# sudo('git pull')
# sudo('pip install --upgrade --editable .')
# config
with cdvirtualenv('rattail', 'app'):
deploy('rattail/rattail.conf.template', 'rattail.conf')
@ -130,3 +127,17 @@ def bootstrap_rattail():
deploy('rattail/rattail.wsgi', 'rattail.wsgi')
deploy('rattail/rattail.localhost.conf', '/etc/apache2/sites-available/000-default.conf')
sudo('service apache2 restart')
##############################
# fabenv
##############################
try:
import fabenv
except ImportError as error:
warn("Couldn't import fabenv: {}".format(error))
# Set some default env attrs in case fabenv isn't prepped.
if not hasattr(env, 'password_postgresql_rattail'):
setattr(env, 'password_postgresql_rattail', 'password')

View file

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8; -*-
"""
Setup script for Rattail Fabric Demo
"""
from __future__ import unicode_literals
from __future__ import unicode_literals, absolute_import
import os
from setuptools import setup, find_packages
@ -44,8 +44,8 @@ requires = [
# package # low high
'Fabric', # 1.10.2
'rattail', # 0.5.9
]
'rattail-fabric', # 0.1.0
]
setup(
@ -69,8 +69,8 @@ setup(
'Programming Language :: Python :: 2.7',
'Topic :: Office/Business',
'Topic :: Software Development :: Libraries :: Python Modules',
],
],
install_requires = requires,
packages = find_packages(),
)
)