-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
86 lines (72 loc) · 1.99 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
"""
Fabric script for deploying the word converter consistently.
"""
from __future__ import with_statement
from fabric.api import env, cd, run
try:
from fab_config import *
except:
pass
def qa():
"""
Set the context to the QA server
"""
env.hosts = ['[email protected]']
env.directory = '/var/www/swordpushweb'
def _with_deploy_env(commands=[]):
"""
Run a set of commands.
"""
with cd(env.directory):
for command in commands:
run(command)
def pull():
"""
Do a git pull.
"""
_with_deploy_env(['git pull'])
def dev_up():
"""
Update all the mr developer packages
"""
_with_deploy_env(['./bin/develop up'])
def stop():
"""
Shutdown the pyramid app.
"""
_with_deploy_env(['./bin/paster serve src/remix/oerpub/rhaptoslabs/production.ini --stop-daemon'])
def start():
"""
Start up the pyramid app.
"""
_with_deploy_env(['./bin/paster serve src/remix/oerpub/rhaptoslabs/production.ini --daemon'])
def status():
"""
Find out the running status of the server and deploy.
"""
# General health of the server.
run('cat /proc/loadavg')
run('uptime')
run('free')
run('df -h')
# Get an overview of the packages
print '================================== Buildout'
_with_deploy_env(['./bin/develop status',
'git status',
'git log -1'])
git_packages = ['oerpub.rhaptoslabs.cnxml2htmlpreview',
'oerpub.rhaptoslabs.sword1cnx',
'oerpub.rhaptoslabs.sword2cnx',
'remix',
'rhaptos.cnxmlutils',
]
for package in git_packages:
print '================================== %s' % package
with cd('%s/src/%s' % (env.directory, package)):
run('git status')
run('git log -1')
def buildout():
"""
Rerun buildout.
"""
_with_deploy_env(['./bin/buildout -Nvv'])