-
Notifications
You must be signed in to change notification settings - Fork 7
/
deploy.sh
executable file
·51 lines (39 loc) · 1.33 KB
/
deploy.sh
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
39
40
41
42
43
44
45
# -----------------------------------------------------------------------------
# Automatic deployment develop.pk-db.com
# -----------------------------------------------------------------------------
# source deploy.sh 2>&1 | tee ./deploy.log
# - !necessary to have cached git credentials for pulling updates
# - !sudo required for some commands
# - !virtualenv must be updated manually
# FIXME: ensure no merge conflicts
# FIXME: run in cronjob (sudo cron)
# FIXME: logging of all output for debugging
# FIXME: logging of study uploads and errors for dayly report
#
# -----------------------------------------------------------------------------
echo "-------------------------"
echo "UPDATE PKDB"
echo "-------------------------"
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
cd $DIR
echo $DIR
# pull latest changes
git pull
# set environment variables
set -a && source .env.production
# backup
./backup.sh
# deploy
./docker-purge.sh
# create info nodes & upload study (from server locally)
cd ../pkdb_data
git pull
# FIXME: how to set environment variables in shell
set -a && source .env.production
echo "-------------------------"
echo "UPLOAD DATA"
echo "-------------------------"
$HOME/envs/pkdb_data/bin/upload_nodes
# run upload and allow disconnect of connection
# FIXME: add logging
nohup $HOME/envs/pkdb_data/bin/upload_studies &