-
Notifications
You must be signed in to change notification settings - Fork 5
/
fabfile.py
29 lines (24 loc) · 826 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
import os
from fabric.api import *
abspath = lambda filename: os.path.join(os.path.abspath(os.path.dirname(__file__)), filename)
env.user = 'nurul'
env.password = 'c0mm0n'
env.key_filename = '/Users/ferdous/Documents/ssh-ubuntu/id_rsa'
def prepare():
env.hosts = ['tms-micro', ]
env.serverpath = '/var/www'
env.graceful = True
return
def deploy():
run("sudo rm -rf %s/*" % env.serverpath)
local('zip -r code.zip ./ -x "*.pyc" ".git/*" ".svn/*" "library/Zend/*"')
put("code.zip", "%s/" % env.serverpath)
run("cd %s; unzip -o code.zip" % env.serverpath)
run("cd %s; rm -f code.zip" % env.serverpath)
local("rm -f code.zip")
restart_apache()
def restart_apache():
if env.graceful:
run("sudo /etc/init.d/apache2 graceful")
else:
run("service httpd restart")