-
Notifications
You must be signed in to change notification settings - Fork 1
/
fabfile.py
42 lines (32 loc) · 1.13 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
''' This fabfile is for use with deploying javascript-only applications to the cybercommons '''
from fabric.api import *
from fabric.contrib.files import exists
from fabric.colors import red
import os
env.sitename = os.path.basename(os.getcwd())
def statictest():
"""
Work on staging environment
"""
env.settings = 'production'
env.path = '/var/www/html/test/%(sitename)s' % env
env.hosts = ['tags.animalmigration.org']
def static():
"""
Work on staging environment
"""
env.settings = 'production'
env.path = '/var/www/html/%(sitename)s' % env
env.hosts = ['tags.animalmigration.org ']
def setup_directories():
run('mkdir -p %(path)s' % env)
def setup():
setup_directories()
copy_working_dir()
def deploy():
copy_working_dir()
def copy_working_dir():
local('tar --exclude fabfile.py --exclude fabfile.pyc -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)
local('rm /tmp/deploy_%(sitename)s.tgz' % env)