-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
53 lines (38 loc) · 979 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
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
from fabric.api import run, cd, env
from fabric.decorators import task
env.user = 'cloudsigma'
env.hosts = ['31.171.245.192']
PROJECT_DIR = "/home/cloudsigma/thefinalcountapp"
@task
def deploy():
update_code()
kill_server()
clean()
build()
test()
restart_server()
def update_code():
with cd(PROJECT_DIR):
run("git reset --hard HEAD")
run("git pull --rebase origin master")
def clean():
with cd(PROJECT_DIR):
run("lein clean")
def build():
with cd(PROJECT_DIR):
run("lein cljx once")
run("lein cljsbuild once")
def test():
with cd(PROJECT_DIR):
run("lein test")
def kill_server():
run("pkill java", warn_only=True)
def run_server():
with cd(PROJECT_DIR):
run_bg("lein run")
def restart_server():
kill_server()
run_server()
def run_bg(cmd):
run("dtach -n `mktemp -u /tmp/{socket}.XXXX` {cmd}".format(socket="dtach", cmd=cmd))