mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-13 22:32:15 +00:00
Added Fabric file and various small fixes to enable better deployments
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,11 +1,8 @@
|
||||
*.pyc
|
||||
*~
|
||||
*.db
|
||||
django/
|
||||
registration/
|
||||
dbsettings.py
|
||||
piston
|
||||
django_evolution
|
||||
logs/
|
||||
settingslocal.py
|
||||
env
|
||||
*.pid
|
||||
|
||||
88
fabfile.py
vendored
Normal file
88
fabfile.py
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
from __future__ import with_statement
|
||||
from fabric.api import *
|
||||
|
||||
env.repo = 'git://dev.dredd.it/dreddit-auth.git'
|
||||
|
||||
def production():
|
||||
env.hosts = ['matalok@web1.dredd.it']
|
||||
env.path = '/home/matalok/auth'
|
||||
|
||||
def test():
|
||||
env.hosts = ['auth@web2.dredd.it']
|
||||
env.path = '/home/auth'
|
||||
|
||||
def setup():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
#sudo('aptitude install python-virtualenv')
|
||||
deploy_repo()
|
||||
|
||||
setup_virtualenv()
|
||||
setup_db()
|
||||
|
||||
def push():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
update_repo()
|
||||
setup_virtualenv()
|
||||
migrate()
|
||||
|
||||
def setup_virtualenv():
|
||||
require('path')
|
||||
|
||||
with cd('%(path)s/dreddit-auth/' % env):
|
||||
run('./setup-env.sh' % env)
|
||||
|
||||
def setup_db():
|
||||
require('path')
|
||||
|
||||
with cd('%(path)s/dreddit-auth/' % env):
|
||||
run('cp dbsettings.py.example dbsettings.py' % env)
|
||||
run('env/bin/python manage.py syncdb --noinput --migrate')
|
||||
|
||||
def deploy_repo():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
run('mkdir -p %(path)s' % env)
|
||||
with cd(env.path):
|
||||
run('git clone %(repo)s' % env)
|
||||
|
||||
def update_repo():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
with cd('%(path)s/dreddit-auth/' % env):
|
||||
run('git pull')
|
||||
|
||||
def migrate():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
with cd('%(path)s/dreddit-auth/' % env):
|
||||
run('env/bin/python manage.py migrate')
|
||||
|
||||
|
||||
def start():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
with cd('%(path)s/dreddit-auth/' % env):
|
||||
run('./start.sh')
|
||||
|
||||
def stop():
|
||||
require('hosts')
|
||||
require('path')
|
||||
|
||||
with cd('%(path)s/dreddit-auth/' % env):
|
||||
run('kill `cat auth.pid`')
|
||||
run('rm -f auth.pid')
|
||||
|
||||
def restart()
|
||||
stop()
|
||||
start()
|
||||
|
||||
|
||||
|
||||
13
start.sh
13
start.sh
@@ -1,4 +1,11 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
. ./env/bin/activate
|
||||
python ./manage.py runfcgi method=threaded host=127.0.0.1 port=9981
|
||||
PIDFILE='auth.pid'
|
||||
|
||||
if [ -f $PIDFILE ]; then
|
||||
kill `cat -- $PIDFILE`
|
||||
rm -f -- $PIDFILE
|
||||
fi
|
||||
|
||||
source ./env/bin/activate
|
||||
./manage.py runfcgi daemonize=false pidfile=$PIDFILE host=127.0.0.1 port=9981 &
|
||||
|
||||
Reference in New Issue
Block a user