mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 23:02:19 +00:00
Further updates to fabfile
This commit is contained in:
39
fabfile.py
vendored
39
fabfile.py
vendored
@@ -4,14 +4,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"
|
||||||
env.hosts = ['matalok@web1.dredd.it']
|
env.hosts = ['matalok@web1.dredd.it']
|
||||||
env.path = '/home/matalok/auth'
|
env.path = '/home/matalok/auth'
|
||||||
|
|
||||||
def test():
|
def test():
|
||||||
|
"Use the test enviroment on Web2"
|
||||||
env.hosts = ['auth@web2.dredd.it']
|
env.hosts = ['auth@web2.dredd.it']
|
||||||
env.path = '/home/auth'
|
env.path = '/home/auth'
|
||||||
|
|
||||||
|
def deploy():
|
||||||
|
"""
|
||||||
|
Do a fresh deployment to a new or clean server
|
||||||
|
"""
|
||||||
|
setup()
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
|
"""
|
||||||
|
Deploy the files to the server and setup virtualenv and a simple
|
||||||
|
SQlite DB setup
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -22,6 +34,9 @@ def setup():
|
|||||||
setup_db()
|
setup_db()
|
||||||
|
|
||||||
def push():
|
def push():
|
||||||
|
"""
|
||||||
|
Push the latest revision to the server and update the enviroment
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -30,12 +45,18 @@ def push():
|
|||||||
migrate()
|
migrate()
|
||||||
|
|
||||||
def setup_virtualenv():
|
def setup_virtualenv():
|
||||||
|
"""
|
||||||
|
Generate the virtualenv enviroment
|
||||||
|
"""
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
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
|
||||||
|
"""
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
with cd('%(path)s/dreddit-auth/' % env):
|
with cd('%(path)s/dreddit-auth/' % env):
|
||||||
@@ -43,6 +64,9 @@ def setup_db():
|
|||||||
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
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -51,6 +75,9 @@ def deploy_repo():
|
|||||||
run('git clone %(repo)s' % env)
|
run('git clone %(repo)s' % env)
|
||||||
|
|
||||||
def update_repo():
|
def update_repo():
|
||||||
|
"""
|
||||||
|
Pulls the latest commits to the repository
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -58,6 +85,9 @@ def update_repo():
|
|||||||
run('git pull')
|
run('git pull')
|
||||||
|
|
||||||
def migrate():
|
def migrate():
|
||||||
|
"""
|
||||||
|
Do any South database migrations
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -66,6 +96,9 @@ def migrate():
|
|||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
|
"""
|
||||||
|
Start the FastCGI server
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -73,6 +106,9 @@ def start():
|
|||||||
run('screen -d -m "./start.sh"')
|
run('screen -d -m "./start.sh"')
|
||||||
|
|
||||||
def stop():
|
def stop():
|
||||||
|
"""
|
||||||
|
Stop any running FCGI instance
|
||||||
|
"""
|
||||||
require('hosts')
|
require('hosts')
|
||||||
require('path')
|
require('path')
|
||||||
|
|
||||||
@@ -81,6 +117,9 @@ def stop():
|
|||||||
run('rm -f auth.pid')
|
run('rm -f auth.pid')
|
||||||
|
|
||||||
def restart():
|
def restart():
|
||||||
|
"""
|
||||||
|
Restart the FCGI server
|
||||||
|
"""
|
||||||
stop()
|
stop()
|
||||||
start()
|
start()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user