-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
executable file
·52 lines (35 loc) · 1.27 KB
/
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
''' This fabfile is for use with deploying javascript-only applications to the cybercommons '''
import os
from fabric.api import *
#env.sitename = os.path.basename(os.getcwd())
#env.host = 'test.oklahomawatersurvey.org'
def mgmic():
"""
Work on staging environment
"""
env.sitename ="portal"
env.settings = 'testing'
env.path = '/data/static/%(sitename)s' % env
env.virtpy = '%(path)s/virtpy' % env
env.log_path = '%(path)s/log' % env
env.hosts = ['mgmic.oscer.ou.edu']
def setup_directories():
run('mkdir -p %(path)s' % env)
def setup():
setup_directories()
copy_working_dir()
def deploy():
copy_working_dir()
bounce_nginx()
def copy_working_dir():
local('tar --exclude fabfile.py --exclude fabfile.pyc --exclude .git -czf /tmp/deploy_%(sitename)s.tgz .' % env)
put('/tmp/deploy_%(sitename)s.tgz' % env, '%(path)s/deploy_%(sitename)s.tgz' % env)
run('cd %(path)s; tar -xf deploy_%(sitename)s.tgz; rm deploy_%(sitename)s.tgz' % env)
sudo('chmod -R 775 %(path)s' % env)
local('rm /tmp/deploy_%(sitename)s.tgz' % env)
def bounce_nginx():
""" Restart the nginx web server """
sudo('service nginx restart')
def bounce_apache():
""" Restart the apache web server """
sudo('/etc/init.d/httpd restart')