-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy_script.sh
54 lines (41 loc) · 1.16 KB
/
deploy_script.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
46
47
48
49
50
51
52
53
54
#!/bin/bash
## gets run on host server
APP_NAME="ddw-analyst-ui"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
APP_DIR=$SCRIPT_DIR'/'$APP_NAME
REPOSITORY="[email protected]:devinit/"$APP_NAME".git"
echo "clone current branch if not exists"
if [ -d $APP_DIR ]; then
cd $APP_DIR
{
# Move back to root directory
echo "Cloning new content from develop"
git fetch
git stash
git checkout develop
git reset --hard origin/develop
} || {
echo "Failed to update from git repository"
exit 20;
}
else
{
git clone -b develop $REPOSITORY
} || {
echo "Failed to perform git clone on $REPOSITORY with branch develop"
exit 20;
}
fi
cd ~/ddw-analyst-ui || exit
echo "Building docker"
docker-compose build db
docker-compose build --no-cache web
docker-compose build nginx
docker-compose build rabbitmq
docker-compose build --no-cache celery
docker-compose build --no-cache spotlights
docker-compose down --remove-orphans
docker-compose up -d
docker-compose exec -T web python manage.py migrate
echo "Fetch CSV Files"
docker-compose exec -T web python manage.py update_csv_files --validate