-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
42 lines (35 loc) · 873 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
from fabric.api import env, run, cd, task
@task
def staging():
env.use_ssh_config = True
env.hosts = ['kerbos-staging.trancesquid.io']
@task
def prod():
env.use_ssh_config = True
env.hosts = ['kerbos.trancesquid.io']
def update():
with cd('/kerbos'):
run('git fetch')
run('git reset --hard origin/production')
def migrate():
with cd('/kerbos'):
run('python3 manage.py db upgrade')
def reload_application():
with cd('/kerbos'):
run("""
supervisorctl -c production/supervisor.conf status |
grep RUNNING |
grep gunicorn |
awk -F' ' '{print $4}' |
sed -e 's/,$//' |
paste -sd' ' |
xargs kill
""")
@task
def deploy():
update()
migrate()
reload_application()
@task
def reload():
reload_application()