forked from osamhack2021/ai_web_RISKOUT_BTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·81 lines (62 loc) · 1.83 KB
/
run.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
#!/bin/bash
web_docker_secret="./WEB(BE)/web-docker-env"
web_drf_secret="./WEB(BE)/drf/secrets.json"
crawler_twitter_secret="./WEB(BE)/crawler/crawler/model/twitter/secrets.py"
# Check if the credential file exists.
if [ -s $web_docker_secret ] ; then
:
else
echo "[!] The '$web_docker_secret' file does not exist or is empty!"
exit
fi
if [ -s $web_drf_secret ] ; then
:
else
echo "[!] The '$web_drf_secret' file does not exist or is!"
exit
fi
if [ -s $crawler_twitter_secret ] ; then
:
else
echo "[!] The '$crawler_twitter_secret' file does not exist or is empty!"
while true; do
read -p "Do you want to exclude Twitter from crawling list? (Y/N) : " yn
case $yn in
[Yy]* )
break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
fi
# Build & Run NLP Server
echo [+] Building NLP Server...
cd "./AI(BE)"
sudo docker-compose up --build -d
cd ../
echo [+] NLP Server started!
# Build & Run Analyzer
echo [+] Building Analyzer Server...
cd "./WEB(BE)"
sudo docker-compose -f analyzer-docker-compose.yml up --build -d
cd ../
# Wait until crawling and analyzing done
echo [+] Wait until crawling and analyzing done... \(This might take tens of minutes to complete.\)
until [ "`sudo docker inspect -f {{.State.Status}} analyzer_service`" = "exited" ]; do
sleep 5;
done;
echo [+] Crawling and analyzing done!
# Build React
echo [+] Building React...
mkdir -p "./WEB(BE)/drf/build"
mkdir -p "./WEB(BE)/drf/staticfiles"
cd "./WEB(FE)/frontend"
yarn
yarn build
rm -rf "../../WEB(BE)/drf/build/"
cp -r ./build "../../WEB(BE)/drf/"
cd "../../WEB(BE)"
# Build & Run Django Server
echo [+] Building Django server...
sudo docker-compose -f web-docker-compose.yml --env-file web-docker-env up --build -d
echo [+] Django Server started!