/
fabfile.py
executable file
·49 lines (36 loc) · 942 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from __future__ import with_statement
from fabric.api import *
env.hosts = ['lojban.org']
appdir = '/home/dag/vlasisku'
virtenv = '/home/dag/.virtualenvs/vlasisku'
def restart():
run('touch %s/app.wsgi' % appdir)
def syncdb():
with cd(appdir):
run("""
source %s/bin/activate
./manage.py updatedb
""" % virtenv)
def pull():
with cd(appdir):
run('bzr pull')
def installdeps():
with cd(appdir):
run('pip install -E %s -r requirements.txt' % virtenv)
def updatedeps():
with cd(appdir):
run('pip install -E %s -r requirements.txt -U' % virtenv)
def deploy():
local('bzr push')
pull()
installdeps()
restart()
def startbots():
with cd(appdir):
run("""
source %s/bin/activate
nohup ./manage.py runbots >/dev/null &
""" % virtenv)
def restartbots():
run('pkill -f runbots')
startbots()