-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun.sh
executable file
·92 lines (81 loc) · 1.43 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
82
83
84
85
86
87
88
89
90
91
92
#!/bin/sh
export COMPOSE_FILE_PATH="${PWD}/target/classes/docker/docker-compose.yml"
if [ -z "${M2_HOME}" ]; then
export MVN_EXEC="mvn"
else
export MVN_EXEC="${M2_HOME}/bin/mvn"
fi
start() {
docker volume create metadatawriter-acs-volume
docker volume create metadatawriter-db-volume
docker volume create metadatawriter-ass-volume
docker-compose -f "$COMPOSE_FILE_PATH" up --build -d
}
down() {
if [ -f "$COMPOSE_FILE_PATH" ]; then
docker-compose -f "$COMPOSE_FILE_PATH" down
fi
}
purge() {
docker volume rm -f metadatawriter-acs-volume
docker volume rm -f metadatawriter-db-volume
docker volume rm -f metadatawriter-ass-volume
}
build() {
$MVN_EXEC clean package
}
tail() {
docker-compose -f "$COMPOSE_FILE_PATH" logs -f
}
tail_all() {
docker-compose -f "$COMPOSE_FILE_PATH" logs --tail="all"
}
prepare_test() {
$MVN_EXEC verify -DskipTests=true
}
test() {
$MVN_EXEC verify
}
case "$1" in
build_start)
down
build
start
tail
;;
build_start_it_supported)
down
build
prepare_test
start
tail
;;
start)
start
tail
;;
stop)
down
;;
purge)
down
purge
;;
tail)
tail
;;
build_test)
down
build
prepare_test
start
test
tail_all
down
;;
test)
test
;;
*)
echo "Usage: $0 {build_start|build_start_it_supported|start|stop|purge|tail|build_test|test}"
esac