-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
38 lines (29 loc) · 935 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
37
38
# encoding: utf-8
"""
Fabfile to drive development and deployment of ephemer-otree
Usage: fab deploy --hosts=...
original authors : [email protected], [email protected]
"""
from fabric import task
PROJECT_NAME = "ephemer-otree"
GIT_REPO_URL = f"[email protected]:io-craft-org/{PROJECT_NAME}.git"
@task
def upgrade(cnx):
"""Upgrade requirements to last version on server for site"""
cnx.run(
f"cd www/{PROJECT_NAME} "
f"&& git pull "
f"&& source ./venv/bin/activate "
f"&& pip install --upgrade --requirement requirements.txt"
)
@task
def deploy(cnx):
"""Deploy new version of project to server for site"""
cnx.run(
f"cd ./www "
f"&& git clone {GIT_REPO_URL} "
f"&& cd ./{PROJECT_NAME} "
f"&& python3 -m venv venv "
f"&& source ./venv/bin/activate "
f"&& pip install --requirement requirements.txt "
)