-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·81 lines (66 loc) · 2.12 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
declare project_dir=$(dirname $0)
declare dc_main=${project_dir}/docker/docker-compose.yml
declare dc_platform=${project_dir}/docker/docker-compose-platform.yml
declare dc_elk=${project_dir}/docker/docker-compose-elk.yml
declare dc_monitoring=${project_dir}/docker/docker-compose-monitoring.yml
declare dc_test=${project_dir}/docker/docker-compose-test.yml
declare moviebuffs="moviebuffs"
declare sonarqube="sonarqube"
declare elk="elasticsearch logstash kibana"
declare monitoring="prometheus grafana"
function restart() {
stop
start
}
function start() {
echo "Starting ${moviebuffs}...."
build_api
docker-compose -f ${dc_main} up --build --force-recreate -d ${moviebuffs}
docker-compose -f ${dc_main} logs -f
}
function stop() {
echo "Stopping ${moviebuffs}...."
docker-compose -f ${dc_main} stop
docker-compose -f ${dc_main} rm -f
}
function start_all() {
echo "Starting ${moviebuffs} and dependencies...."
build_api
docker-compose -f ${dc_main} -f ${dc_elk} -f ${dc_monitoring} up --build --force-recreate -d
docker-compose -f ${dc_main} -f ${dc_elk} -f ${dc_monitoring} logs -f
}
function stop_all() {
echo 'Stopping all....'
docker-compose -f ${dc_main} -f ${dc_elk} -f ${dc_monitoring} stop
docker-compose -f ${dc_main} -f ${dc_elk} -f ${dc_monitoring} rm -f
}
function build_api() {
./mvnw clean install -DskipTests
}
function sonar() {
echo 'Starting sonarqube....'
docker-compose -f ${dc_platform} up --build --force-recreate -d ${sonarqube}
docker-compose -f ${dc_platform} logs -f
}
function elk() {
echo 'Starting ELK....'
docker-compose -f ${dc_elk} up --build --force-recreate -d ${elk}
docker-compose -f ${dc_elk} logs -f
}
function monitoring() {
echo 'Starting Prometheus, Grafana....'
docker-compose -f ${dc_monitoring} up --build --force-recreate -d ${monitoring}
docker-compose -f ${dc_monitoring} logs -f
}
function hubtest() {
echo 'Run API from DockerHub....'
docker-compose -f ${dc_test} up -d
docker-compose -f ${dc_test} logs -f
}
action="start"
if [[ "$#" != "0" ]]
then
action=$@
fi
eval ${action}