-
Notifications
You must be signed in to change notification settings - Fork 7
/
startup.sh
executable file
·84 lines (73 loc) · 2.01 KB
/
startup.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
WORKDIR=$(pwd)
function type_clone {
case "$TYPECLONE" in
ssh) WR="[email protected]:SoftwareCountry/WhiteRabbit.git";
CDMB="[email protected]:SoftwareCountry/ETL-CDMBuilder.git";
DQC="[email protected]:SoftwareCountry/DataQualityDashboard.git" ;;
https) WR="https://github.com/SoftwareCountry/WhiteRabbit.git";
CDMB="https://github.com/SoftwareCountry/ETL-CDMBuilder.git";
DQC="https://github.com/SoftwareCountry/DataQualityDashboard.git" ;;
esac
}
if [[ ! -f .first_run ]]; then
echo -e "Choose the cloning method: type \033[33mssh \033[0mor \033[33mhttps\033[0m:"
read TYPECLONE
case "$TYPECLONE" in
ssh) echo -n "ssh" > .first_run ;;
https) echo -n "https" > .first_run ;;
*) echo "Wrong type! Try relaunch. Exit..."; exit 1 ;;
esac
else
TYPECLONE=$(cat .first_run)
fi
type_clone "$TYPECLONE"
function git_clone {
case "$1" in
WhiteRabbit) git clone "$WR" ;;
CDMBuilder) git clone "$CDMB" ;;
DataQualityDashboard) git clone "$DQC";;
esac
}
function git_pull {
case "$1" in
WhiteRabbit) cd WhiteRabbit; git pull; cd - ;;
CDMBuilder) cd ETL-CDMBuilder; git pull; cd - ;;
DataQualityDashboard) cd DataQualityDashboard; git pull; cd - ;;
esac
}
function check_dirs {
cd "$WORKDIR"/..
if [[ ! -d "WhiteRabbit" ]]; then
git_clone "WhiteRabbit"
else
git_pull "WhiteRabbit"
fi
if [[ ! -d "ETL-CDMBuilder" ]]; then
git_clone "CDMBuilder"
else
git_pull "CDMBuilder"
fi
if [[ ! -d "DataQualityDashboard" ]]; then
git_clone "DataQualityDashboard"
else
git_pull "DataQualityDashboard"
fi
cd "$WORKDIR"
}
function clean_launch {
docker compose down;
docker volume rm -f perseus_perseusdb;
rm -rf ../WhiteRabbit ../DataQualityDashboard ../ETL-CDMBuilder;
}
if [[ "$#" -ne 1 ]]; then
echo -e "No params, use normal startup\nIf you want a 'clean launch', use --clean as an argument; it removes all data and restarts all applications."
fi
if [[ "$1" == "--clean" ]]; then
echo "Starting a clean launch..."
clean_launch;
fi
check_dirs;
docker compose build
docker compose up -d
exit 0