mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-13 22:32:15 +00:00
Cleanup fabric file
This commit is contained in:
18
fabfile.py
vendored
18
fabfile.py
vendored
@@ -3,22 +3,26 @@ from fabric.api import *
|
|||||||
|
|
||||||
env.repo = 'git://dev.dredd.it/dreddit-auth.git'
|
env.repo = 'git://dev.dredd.it/dreddit-auth.git'
|
||||||
|
|
||||||
|
|
||||||
def production():
|
def production():
|
||||||
"Use the production enviroment on Web1"
|
"Use the production enviroment on Web1"
|
||||||
env.hosts = ['dreddit@web1.pleaseignore.com']
|
env.hosts = ['dreddit@web1.pleaseignore.com']
|
||||||
env.path = '/home/dreddit/apps'
|
env.path = '/home/dreddit/apps'
|
||||||
|
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
"Use the test enviroment on Web2"
|
"Use the test enviroment on Web2"
|
||||||
env.hosts = ['dreddit@web2.pleaseignore.com']
|
env.hosts = ['dreddit@web2.pleaseignore.com']
|
||||||
env.path = '/home/dreddit/apps'
|
env.path = '/home/dreddit/apps'
|
||||||
|
|
||||||
|
|
||||||
def deploy():
|
def deploy():
|
||||||
"""
|
"""
|
||||||
Do a fresh deployment to a new or clean server
|
Do a fresh deployment to a new or clean server
|
||||||
"""
|
"""
|
||||||
setup()
|
setup()
|
||||||
|
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
"""
|
"""
|
||||||
Deploy the files to the server and setup virtualenv and a simple
|
Deploy the files to the server and setup virtualenv and a simple
|
||||||
@@ -27,12 +31,12 @@ def setup():
|
|||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
#sudo('aptitude install python-virtualenv')
|
|
||||||
deploy_repo()
|
deploy_repo()
|
||||||
|
|
||||||
setup_virtualenv()
|
setup_virtualenv()
|
||||||
setup_db()
|
setup_db()
|
||||||
|
|
||||||
|
|
||||||
def push():
|
def push():
|
||||||
"""
|
"""
|
||||||
Push the latest revision to the server and update the enviroment
|
Push the latest revision to the server and update the enviroment
|
||||||
@@ -44,6 +48,7 @@ def push():
|
|||||||
setup_virtualenv()
|
setup_virtualenv()
|
||||||
migrate()
|
migrate()
|
||||||
|
|
||||||
|
|
||||||
def setup_virtualenv():
|
def setup_virtualenv():
|
||||||
"""
|
"""
|
||||||
Generate the virtualenv enviroment
|
Generate the virtualenv enviroment
|
||||||
@@ -53,6 +58,7 @@ def setup_virtualenv():
|
|||||||
with cd('%(path)s/dreddit-auth/' % env):
|
with cd('%(path)s/dreddit-auth/' % env):
|
||||||
run('./setup-env.sh' % env)
|
run('./setup-env.sh' % env)
|
||||||
|
|
||||||
|
|
||||||
def setup_db():
|
def setup_db():
|
||||||
"""
|
"""
|
||||||
Setup a simple SQlite DB using the default settings
|
Setup a simple SQlite DB using the default settings
|
||||||
@@ -63,6 +69,7 @@ def setup_db():
|
|||||||
run('if [ ! -e dbsettings.py ]; then cp dbsettings.py.example dbsettings.py; fi' % env)
|
run('if [ ! -e dbsettings.py ]; then cp dbsettings.py.example dbsettings.py; fi' % env)
|
||||||
run('env/bin/python manage.py syncdb --noinput --migrate')
|
run('env/bin/python manage.py syncdb --noinput --migrate')
|
||||||
|
|
||||||
|
|
||||||
def deploy_repo():
|
def deploy_repo():
|
||||||
"""
|
"""
|
||||||
Do the initial repository checkout
|
Do the initial repository checkout
|
||||||
@@ -76,7 +83,8 @@ def deploy_repo():
|
|||||||
|
|
||||||
with cd('%(path)s/dreddit-auth/' % env):
|
with cd('%(path)s/dreddit-auth/' % env):
|
||||||
run('mkdir logs')
|
run('mkdir logs')
|
||||||
|
|
||||||
|
|
||||||
def update_repo():
|
def update_repo():
|
||||||
"""
|
"""
|
||||||
Pulls the latest commits to the repository
|
Pulls the latest commits to the repository
|
||||||
@@ -87,6 +95,7 @@ def update_repo():
|
|||||||
with cd('%(path)s/dreddit-auth/' % env):
|
with cd('%(path)s/dreddit-auth/' % env):
|
||||||
run('git pull')
|
run('git pull')
|
||||||
|
|
||||||
|
|
||||||
def migrate():
|
def migrate():
|
||||||
"""
|
"""
|
||||||
Do any South database migrations
|
Do any South database migrations
|
||||||
@@ -108,6 +117,7 @@ def start():
|
|||||||
with cd('%(path)s/dreddit-auth/' % env):
|
with cd('%(path)s/dreddit-auth/' % env):
|
||||||
run('screen -d -m "./start.sh"')
|
run('screen -d -m "./start.sh"')
|
||||||
|
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
"""
|
"""
|
||||||
Stop any running FCGI instance
|
Stop any running FCGI instance
|
||||||
@@ -119,12 +129,10 @@ def stop():
|
|||||||
run('kill `cat auth.pid`')
|
run('kill `cat auth.pid`')
|
||||||
run('rm -f auth.pid')
|
run('rm -f auth.pid')
|
||||||
|
|
||||||
|
|
||||||
def restart():
|
def restart():
|
||||||
"""
|
"""
|
||||||
Restart the FCGI server
|
Restart the FCGI server
|
||||||
"""
|
"""
|
||||||
stop()
|
stop()
|
||||||
start()
|
start()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user