-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
74 lines (54 loc) · 1.87 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
from fabric.api import run
from fabric.state import env
from fabric.context_managers import cd
from fabric.operations import local
env.schema_apps = [ 'citi_user', 'home', 'event' ]
env.local_settings_file = 'alpha.settings'
def dev():
env.hosts = ['root@dev.cityfusion.ca']
env.project_folder = '/root/cityfusion_git'
env.alpha_folder = '/root/cityfusion_git/alpha'
env.password = "123forfusion"
env.branch = "master"
def events():
env.hosts = ['root@dev.cityfusion.ca']
env.project_folder = '/root/cityfusion_git'
env.alpha_folder = '/root/cityfusion_git/alpha'
env.password = "123forfusion"
env.branch = "events_revise"
def prod():
env.hosts = ['root@cityfusion.ca']
env.project_folder = '/root/cityfusion_git'
env.alpha_folder = '/root/cityfusion_git/alpha'
env.password = "123forfusion"
env.branch = "prod"
def host_type():
run('uname -a')
def init_virtual_env():
run("source /root/virtualenvs/cityfusion_env/bin/activate")
def upgrade():
init_virtual_env()
with cd(env.project_folder):
run("git pull origin %s" % env.branch)
with cd(env.alpha_folder):
run("python manage.py collectstatic --noinput")
run("supervisorctl reload")
def install_requirements():
init_virtual_env()
with cd(env.project_folder):
run("pip install -r requirements.txt")
def migrate(app):
init_virtual_env()
with cd(env.project_folder):
run("git pull origin %s" % env.branch)
with cd(env.alpha_folder):
run("python manage.py migrate %s" % app)
def make_virtualenv():
local("virtualenv --no-site-packages venv")
update_virtualenv()
def update_virtualenv():
local("source venv/bin/activate; pip install -r requirements.txt")
def pip_freeze():
local("source venv/bin/activate; pip freeze > requirements.txt")
def echo_shell():
print env.shell