-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfabfile.py
More file actions
50 lines (37 loc) · 983 Bytes
/
fabfile.py
File metadata and controls
50 lines (37 loc) · 983 Bytes
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
from fabric.api import run, env, local, cd
import os
SSH_KEY_DIR = os.getenv('HOME') + '/.ssh/'
env.user = 'ec2-user'
env.key_filename = [os.path.join(SSH_KEY_DIR, "phonelab.pem")]
def staging():
env.hosts = ['staging.phone-lab.org'] #107.22.187.240
def production():
env.hosts = ['phone-lab.org'] #107.20.190.88
def move():
stop()
# with cd('/home/ec2-user/server'):
# run('./south.sh convert')
run('rm -rf server')
run("git clone git://github.com/phonelab/server.git")
if os.environ.get("ENV") == "production":
run("git checkout production")
def start():
run('/etc/init.d/phonelab start')
def stop():
run('/etc/init.d/phonelab stop')
def restart():
stop()
start()
def migrate():
with cd('/home/ec2-user/server'):
# run('python manage.py syncdb')
run('./south.sh schemamigration')
run('./south.sh migrate')
def deploy():
move()
migrate()
restart()
## fab staging deploy
## if you want to syncdb
## fab move
## fab migrate