-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfabfile.py
36 lines (26 loc) · 841 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from fabric.api import sudo, env, settings, cd, shell_env
env.use_ssh_config = True
if not env.hosts:
env.hosts = ["oct-dev"]
folder = "/srv/oct-storage"
venv_folder = "/srv/.pyenv/versions/oct-storage"
www_user = "app"
def deploy():
with cd(folder), settings(
sudo_user=www_user,
sudo_prefix="sudo -H -E "
), shell_env(
SIMPLE_SETTINGS="oct_storage.config,instance.staging",
VIRTUAL_ENV=venv_folder,
PATH="{}:$PATH".format(os.path.join(venv_folder, 'bin'))
):
sudo('git checkout dev')
sudo('git pull')
sudo('{}/bin/pip install -r requirements.txt'.format(venv_folder))
sudo('make upgrade')
restart('oct-storage')
def restart(process):
sudo("supervisorctl restart %s" % process)