forked from practicalparticipation/iati-datastore
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfabfile.py
32 lines (27 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
from contextlib import contextmanager
from fabric import task
@contextmanager
def virtualenv(conn):
with conn.cd('~/iatidatastoreclassic'):
with conn.prefix('source .ve/bin/activate'):
with conn.prefix('source env.sh'):
yield
@task
def deploy(conn):
with virtualenv(conn):
# pull latest copy of code in version control
conn.run('git pull origin main')
# install dependencies
conn.run('pip install -r requirements.txt')
# run database migrations
conn.run('iati db upgrade')
# build the docs
conn.run('iati build-docs')
# create translations
conn.run('(cd iati_datastore/iatilib && pybabel compile -d translations)')
# build the query builder
conn.run('iati build-query-builder --deploy-url https://datastore.codeforiati.org')
# webserver
conn.run('sudo /etc/init.d/uwsgi reload')
# worker
conn.run('sudo /bin/systemctl restart iatidatastoreclassic-iatidatastoreclassic')