forked from sivaprasadreddy/spring-boot-microservices-series
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·54 lines (43 loc) · 1.19 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
#!/bin/bash
declare project_dir=$(dirname $0)
declare dc_main=${project_dir}/docker-compose.yml
function restart() {
stop_all
start_all
}
function start() {
echo "Starting $1...."
build_api
docker-compose -f ${dc_main} up --build --force-recreate -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 mysqldb rabbitmq setup-vault config-server service-registry hystrix-dashboard...."
docker-compose -f ${dc_main} up --build --force-recreate -d mysqldb rabbitmq setup-vault config-server service-registry hystrix-dashboard
docker-compose -f ${dc_main} logs -f
}
function start_all() {
echo "Starting all services...."
build_api
docker-compose -f ${dc_main} up --build --force-recreate -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} rm -f
}
function build_api() {
./mvnw clean package -DskipTests
}
action="start_all"
if [[ "$#" != "0" ]]
then
action=$@
fi
eval ${action}