forked from ucscXena/ucsc-xena-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy
executable file
·29 lines (25 loc) · 897 Bytes
/
deploy
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
#!/bin/bash
set -o nounset
set -o errexit
USER=ubuntu
BUILD_DJANGO=build-django
npm run build:prod -- --bail
# deploy
rsync -a --delete --rsync-path='sudo rsync' build/ ${USER}@${HOST}:/var/www/html
# copy to clean load directory, so we can rsync --delete
rm -rf ${BUILD_DJANGO}
mkdir ${BUILD_DJANGO}
cp -a manage.py server bookmarks ties ${BUILD_DJANGO}
rsync -a --delete ${BUILD_DJANGO}/ ${USER}@${HOST}:/var/www/backend/django
requirements=$(cat requirements.txt)
requirements=$(echo ${requirements}) # drop carriage returns
ssh -l${USER} ${HOST} <<-ENDSSH
#set -o nounset # 'activate' accesses unbound vars
set -o errexit
cp ~/settings/site_settings.py /var/www/backend/django/server/site_settings.py
. /var/www/backend/virtualenv/bin/activate
pip install ${requirements}
cd /var/www/backend/django
python ./manage.py migrate
sudo apache2ctl restart
ENDSSH