-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfabfile.py
More file actions
44 lines (34 loc) · 1.32 KB
/
Copy pathfabfile.py
File metadata and controls
44 lines (34 loc) · 1.32 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
import time
from fabric.api import run, execute, env, cd
"""
Manage auto-deploy webhooks remotely.
Production hook:
forever start -l $HOME/hookshot.log -a deploy/hookshot.js -p 4000 -b production -c "cd $HOME/production/current && git pull && bundle exec jekyll build >> $HOME/hookshot.log"
forever restart deploy/hookshot.js -p 4000 -b production -c "cd $HOME/production/current && git pull && bundle exec jekyll build >> $HOME/hookshot.log"
forever stop deploy/hookshot.js -p 4000 -b production -c "cd $HOME/production/current && git pull && bundle exec jekyll build >> $HOME/hookshot.log"
"""
environment = "production"
branch = "master"
port = 4000
env.hosts = ["site@https"]
env.use_ssh_config = True
home = "/home/site"
log = "%s/hookshot.log" % home
current = "%s/%s/current" % (home, environment)
# principal command to run upon update
command = "cd %s && git pull && bundle exec jekyll build >> %s" % (current, log)
def start():
run(
"cd %s && forever start -l %s -a deploy/hookshot.js -p %i -b %s -c \"%s\""
% (current, log, port, branch, command)
)
def stop():
run(
"cd %s && forever stop deploy/hookshot.js -p %i -b %s -c \"%s\""
% (current, port, branch, command)
)
def restart():
run(
"cd %s && forever restart deploy/hookshot.js -p %i -b %s -c \"%s\""
% (current, port, branch, command)
)