/
fabfile.py
36 lines (24 loc) · 850 Bytes
/
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
# -*- coding: utf-8 -*-
from __future__ import with_statement
from fabric.api import run, cd, env, sudo, execute
from fabric.context_managers import prefix
env.hosts = ['ubuntu@sentimos.com.br']
def check_if_beanstalk_tubes_are_empty():
with cd('/home/ubuntu/Como-nos-Sentimos'):
jobs = run('python check_beanstalk_tubes.py')
return jobs
def git_pull():
with cd('/home/ubuntu/Como-nos-Sentimos'):
run('git pull')
def reload_all():
jobs = check_if_beanstalk_tubes_are_empty()
if int(jobs) < 10:
sudo('service memcached restart')
sudo('supervisorctl restart all')
sudo('service nginx restart')
sudo('touch /etc/uwsgi/apps-enabled/cns_website.ini')
def supervisor_status():
sudo('supervisorctl status')
def atualiza():
execute(git_pull)
execute(reload_all)