-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-local.sh
More file actions
executable file
·133 lines (106 loc) · 3.18 KB
/
Copy pathsetup-local.sh
File metadata and controls
executable file
·133 lines (106 loc) · 3.18 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
echo ""
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " Medaware Local Development"
echo " Setup"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo ""
if ! command -v git; then
echo "Please make sure 'git' is installed before invoking this script."
exit
fi
if ! command -v wget; then
echo "Please make sure 'wget' is installed before invoking this script."
exit
fi
if ! command -v docker; then
echo "Please make sure 'docker' is installed before invoking this script."
exit
fi
if ! command -v npm; then
echo "Please make sure 'npm' is installed before invoking this script."
exit
fi
if ! wget -q --spider http://www.gentoo.org; then
echo "Please connect to the internet before invoking this script."
exit
fi
MEDAWARE_PATH="$(pwd)"
MEDAWARE_DIR="medaware"
if [ -d "${MEDAWRE_DIR}" ]; then
echo "The directory '${MEDAWARE_DIR}' already exists. Aborting."
exit
fi
function fail_reset() {
printf "\n\n ** Failed setting up the Medaware environment. Cleaning up .. **\n\n"
cd "${MEDAWARE_PATH}" || exit
rm -rf "${MEDAWARE_DIR}"
exit
}
function dependency() {
if [ "$#" -ne 3 ]; then
echo "== Internal error: dependency: Invalid number of function parameters =="
fail_reset
fi
git clone "$1" "$2"
cd "$2" || fail_reset
git fetch origin "$3"
git checkout "$3"
if [ ! -f "gradlew" ]; then
echo "== Error: dependency: Could not find gradle wrapper in the dependency folder of dependency '$2' =="
fail_reset
fi
if ! ./gradlew publish; then
echo "== Error: dependency: Building '$2' failed. =="
fail_reset
fi
echo "++ OK: Dependency installed: $2 ++"
cd "${MEDAWARE_PATH}/${MEDAWARE_DIR}" || fail_reset
}
mkdir "${MEDAWARE_DIR}"
cd "${MEDAWARE_DIR}" || fail_reset
echo ""
echo "##############################"
echo " Installing MaW Dependencies"
echo "##############################"
echo ""
dependency "https://github.com/Medaware-org/anterogradia" "anterogradia" "stable"
dependency "https://github.com/Medaware-org/antg-avis" "avis" "main"
echo ""
echo "##############################"
echo " Setting up Services"
echo "##############################"
echo ""
git clone https://github.com/Medaware-org/staging-env services
cd services || fail_reset
docker container stop maw-minio && docker container remove maw-minio
docker container stop maw-catalyst-db && docker container remove maw-catalyst-db
docker compose up -d
cd "${MEDAWARE_PATH}/${MEDAWARE_DIR}" || fail_reset
echo ""
echo "##############################"
echo " Installing Catalyst"
echo "##############################"
echo ""
git clone https://github.com/Medaware-org/catalyst catalyst
cd catalyst || fail_reset
git submodule init
git submodule update
if ! ./gradlew build --refresh-dependencies -x test; then
echo "== Error: Could not build Catalyst =="
fail_reset
fi
cd "${MEDAWARE_PATH}/${MEDAWRE_DIR}" || fail_reset
echo ""
echo "##############################"
echo " Install Tangential"
echo "##############################"
echo ""
git clone https://github.com/Medaware-org/tangential tangential
cd tangential || fail_reset
npm i
echo ""
echo "##############################"
echo " -= Done =-"
echo "##############################"
echo ""