-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.sh
More file actions
85 lines (74 loc) · 1.85 KB
/
Copy pathstart.sh
File metadata and controls
85 lines (74 loc) · 1.85 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
#!/usr/bin/env bash
usage() {
echo "usage: bash start.sh [ --rebuild_api_gateway [yes/NO] --rebuild_docker [yes/NO] \
--rebuild_frontend [yes/NO] --rebuild_backend_database [yes/NO] ]
The script will start the docker containers and configure the Kong endpoints
To rebuild all:
bash start.sh --rebuild_api_gateway yes --rebuild_docker yes --rebuild_frontend yes \
--rebuild_backend_database yes
To rebuild all without modifying the API DB:
bash start.sh --rebuild_api_gateway yes --rebuild_docker yes --rebuild_frontend yes
"
}
rebuild_api_gateway="no"
rebuild_docker="no"
rebuild_frontend="no"
rebuild_backend_database="no"
while [ "$1" != "" ]; do
case $1 in
--rebuild_api_gateway)
shift
rebuild_api_gateway=$1
;;
--rebuild_docker)
shift
rebuild_docker=$1
;;
--rebuild_frontend)
shift
rebuild_frontend=$1
;;
--rebuild_backend_database)
shift
rebuild_backend_database=$1
;;
--help)
usage
exit
;;
*)
usage
exit 1
;;
esac
shift
done
if [ ! "$BASH_VERSION" ]; then
echo "Please do not use sh to run this script, execute it with bash" 1>&2
exit 1
fi
if [ "$rebuild_backend_database" == "yes" ]; then
echo "Backend Postgres - Delete database and initialize"
cd ./backend/ || exit
sh ./setup_db.sh
cd ../
fi
if [ ! -d ./frontend/website-demo/build ] || [ "$rebuild_frontend" == "yes" ]; then
echo "Frontend - Build process started"
cd ./frontend/website-demo/nginx || exit
sh ./deploy.sh
cd ../../../
fi
if [ "$rebuild_docker" == "yes" ]; then
echo "DEPLOY - Rebuilding and pulling docker images"
docker compose build
docker compose pull
fi
echo "DEPLOY - Starting services"
docker compose up -d
cd ./api_gateway || exit
sh ./wait_for_kong.sh
if [ "$rebuild_api_gateway" == "yes" ]; then
echo "KONG - Configuring endpoints"
sh ./configure_endpoints.sh
fi