-
Notifications
You must be signed in to change notification settings - Fork 13
/
run.sh
executable file
·75 lines (61 loc) · 1.96 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
#!/usr/bin/env bash
declare project_dir=$(dirname $0)
declare dc_main=${project_dir}/docker-compose.yml
declare dc_tools=${project_dir}/docker-compose-tools.yml
function restart() {
stop_all
start_all
}
function start() {
echo "Starting $1...."
build_api
docker-compose -f ${dc_main} up -d $1
docker-compose -f ${dc_main} logs -f
}
function stop() {
echo "Stopping $1...."
docker-compose -f ${dc_main} stop
docker-compose -f ${dc_main} rm -f
}
function start_infra() {
echo "Starting zipkin-server postgresql kafka redis config-server naming-server ...."
docker compose -f ${dc_main} up -d zipkin-server postgresql kafka redis config-server naming-server
docker compose -f ${dc_main} logs -f
}
function start_infra_full() {
echo "Starting grafana promtail postgresql kafka redis config-server naming-server...."
docker compose -f ${dc_tools} up -d grafana promtail postgresql kafka redis config-server naming-server
docker compose -f ${dc_tools} logs -f
}
function start_services() {
echo "Starting api-gateway catalog-service inventory-service order-service payment-service ...."
docker compose -f ${dc_main} up -d api-gateway catalog-service inventory-service order-service payment-service
docker compose -f ${dc_main} logs -f
}
function start_all() {
echo "Starting all services...."
build_api
docker-compose -f ${dc_main} up -d
docker-compose -f ${dc_main} logs -f
}
function stop_all() {
echo 'Stopping all services....'
docker-compose -f ${dc_main} stop
docker-compose -f ${dc_main} down
docker-compose -f ${dc_main} rm -f
}
function stop_all_full() {
echo 'Stopping all services....'
docker-compose -f ${dc_tools} stop
docker-compose -f ${dc_tools} down
docker-compose -f ${dc_tools} rm -f
}
function build_api() {
./mvnw clean spotless:apply spring-boot:build-image -DskipTests
}
action="start_all"
if [[ "$#" != "0" ]]
then
action=$@
fi
eval ${action}