-
Notifications
You must be signed in to change notification settings - Fork 6
/
fabfile.py
36 lines (28 loc) · 925 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 fabric.api import runs_once, lcd, local, task, env, cd, run
from fabric.colors import green
from fabric.contrib.console import confirm
import requests
env.user = 'ubuntu'
env.hosts = ['imusify.com']
@task
def production():
env.user = 'ubuntu'
env.hosts = ['imusify.com']
env.branch = 'master'
env.server = 'production'
env.app = 'imusify-prod'
env.dist_dir = 'angular-app'
@task
def scp():
local('chmod -R 775 dist')
local('chmod 775 dist')
run('sudo chown ubuntu:ubuntu /home/{user}/imusify/{dist_dir}/ -Rf'.format(
user=env.user, dist_dir=env.dist_dir)
)
local('rsync -ru dist/* {user}@{host}:/home/{user}/imusify/{dist_dir}/'.format(
user=env.user, host=env.hosts[0], dist_dir=env.dist_dir)
)
run('sudo chown www-data:www-data /home/{user}/imusify/{dist_dir}/ -Rf'.format(
user=env.user, dist_dir=env.dist_dir)
)