This repository was archived by the owner on Aug 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathfabfile.py
More file actions
51 lines (37 loc) · 1.33 KB
/
fabfile.py
File metadata and controls
51 lines (37 loc) · 1.33 KB
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
from fabric.api import env, hosts, lcd, cd, run, local
from fabric.contrib.console import confirm
import pyperclip
import os
env.password = os.environ['FAB_PASS']
def copy_deploy_cmd():
branch = local('git rev-parse --abbrev-ref HEAD', capture=True)
pyperclip.copy('git checkout %s && git pull && '
'pip3 install -r requirements/prod.txt && '
'python3 manage.py migrate && '
'python3 manage.py collectstatic --noinput && exit' % branch)
def build_client():
if confirm('Rebuild client?'):
with lcd('static/main-hub/'):
local('sencha app build')
def build_docs():
with lcd('docs/'):
local('make clean')
local('make html')
# local('open build/html/index.html')
def coverage(app=''):
local('coverage run --source="." manage.py test %s' % app)
local('rm -rf htmlcov/')
local('coverage html')
# local('open htmlcov/index.html')
@hosts(os.environ['FAB_HOST'])
def deploy_test():
copy_deploy_cmd()
run('docker-compose exec web /bin/bash')
run('docker-compose restart web')
@hosts(os.environ['PROD_HOST'])
def deploy_prod():
copy_deploy_cmd()
with cd('/parkour/data/docker/docker_parkour/'):
run('pwd')
run('docker-compose exec web /bin/bash')
run('docker-compose restart web')