-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfabfile.py
More file actions
28 lines (20 loc) · 880 Bytes
/
fabfile.py
File metadata and controls
28 lines (20 loc) · 880 Bytes
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
from fabric.api import *
# needs fabric3 installed
# pip install fabric3
env.user = 'dtat'
env.hosts = ['dtat.hampl.space']
def pack():
# build the package
local('python setup.py sdist --formats=gztar', capture=False)
def deploy():
# figure out the package name and version
dist = local('python setup.py --fullname', capture=True).strip()
filename = '%s.tar.gz' % dist
# upload the package to the temporary folder on the server
put('dist/%s' % filename, '/home/dtat/tmp/%s' % filename)
# install the package in the application's virtualenv with pip
sudo('/home/dtat/www/dtat_web_server/venv/bin/pip install /home/dtat/tmp/%s' % filename)
# remove the uploaded package
run('rm -r /home/dtat/tmp/%s' % filename)
#restart supervisor's subprocess
sudo('sudo supervisorctl restart dtat-web-server')