-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfabfile.py
31 lines (26 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
from fabric.api import *
env.hosts = ['smmpdb.ch.private.cam.ac.uk']
env.user = 'dsm38'
def prepare():
local('python manage.py collectstatic --noinput')
local('python manage.py test repo')
local('echo "another line" >> fillfile')
local('git add .')
local('git commit')
local('git push')
def deploy():
with cd('~/smmpdb'):
run('source /home/dsm38/.virtualenvs/smmpdb/bin/activate && git pull https://github.com/dsmurrell/smmpdb.git')
run('source /home/dsm38/.virtualenvs/smmpdb/bin/activate && sudo pip install -r requirements.txt')
run('source /home/dsm38/.virtualenvs/smmpdb/bin/activate && python manage.py migrate')
run('source /home/dsm38/.virtualenvs/smmpdb/bin/activate && python manage.py collectstatic --noinput')
#run('sudo pkill celery') this doesn't work... have to restart celery manually :(
#run('source /home/dsm38/.virtualenvs/smmpdb/bin/activate && celery -A smmpdb worker -l info &')
run('source /home/dsm38/.virtualenvs/smmpdb/bin/activate && sudo /etc/init.d/apache2 restart')
def both():
prepare()
deploy()
def bothwarn():
with settings(warn_only=True):
prepare()
deploy()