-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
34 lines (29 loc) · 1.02 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
import os
from fabric.api import local, run, cd, env, sudo, settings, lcd
from fabric.decorators import hosts
env.hosts = ['[email protected]']
code_dir = '/home/davidchuka/davidchuka-theproject'
def show_logs_django():
print("showing django logs")
with cd(code_dir):
run('docker-compose logs --follow django')
def show_logs_nginx():
print("showing nginx logs")
with cd(code_dir):
run('docker-compose logs --follow nginx')
def re_deploy():
with cd(code_dir):
run('git pull')
run('docker image prune -f')
run('docker-compose build --no-cache django')
run('docker-compose build --no-cache nginx')
run('docker-compose kill django nginx')
run('docker-compose rm -f django nginx')
run('docker-compose up -d nginx')
def django_shell():
with cd(code_dir):
run('docker-compose exec django sh')
def backup_db_to_dropbox():
with cd(code_dir):
run('chmod +x database-backup.sh')
run('./database-backup.sh')