-
Notifications
You must be signed in to change notification settings - Fork 24
/
fabfile.py
48 lines (38 loc) · 1.19 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
# -*- coding: utf-8 -*-
u"""
.. module:: fabfile
Be aware, that becaus fabric doesn't support py3k You need to execute this
particular script using Python 2.
"""
import contextlib
from fabric.api import cd
from fabric.api import env
from fabric.api import prefix
from fabric.api import run
env.user = 'root'
env.hosts = ['volontuloapp.org']
env.forward_agent = True
def update():
u"""Function defining all steps required to properly update application."""
# Django app refresh:
with contextlib.nested(
cd('/var/www/volontuloapp_org'),
prefix('workon volontuloapp_org')
):
run('git checkout master')
run('git pull')
run('pip install -r requirements/production.txt')
# Gulp frontend refresh:
with contextlib.nested(
cd('/var/www/volontuloapp_org/apps/volontulo')
):
run('npm install .')
run('./node_modules/.bin/gulp build')
# Django site refresh:
with contextlib.nested(
cd('/var/www/volontuloapp_org'),
prefix('workon volontuloapp_org')
):
run('python manage.py migrate --traceback'
' --settings=volontulo_org.settings.production')
run('service apache2 restart')