-
Notifications
You must be signed in to change notification settings - Fork 20
/
run.sh
executable file
·165 lines (144 loc) · 3.09 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/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 audit-share-acs-volume
docker volume create audit-share-db-volume
docker volume create audit-share-ass-volume
docker-compose -f "$COMPOSE_FILE_PATH" up --build -d
}
start_share() {
docker-compose -f "$COMPOSE_FILE_PATH" up --build -d audit-share-share
}
start_acs() {
docker-compose -f "$COMPOSE_FILE_PATH" up --build -d audit-share-acs
}
start_ass() {
docker volume create audit-share-ass-volume
docker-compose -f "$COMPOSE_FILE_PATH" up --build -d audit-share-ass
}
down() {
if [ -f "$COMPOSE_FILE_PATH" ]; then
docker-compose -f "$COMPOSE_FILE_PATH" down
fi
}
purge() {
docker volume rm -f audit-share-acs-volume
docker volume rm -f audit-share-db-volume
docker volume rm -f audit-share-ass-volume
}
purge_ass() {
docker-compose -f "$COMPOSE_FILE_PATH" kill audit-share-ass
yes | docker-compose -f "$COMPOSE_FILE_PATH" rm -f audit-share-ass
docker volume rm -f audit-share-ass-volume
}
build() {
$MVN_EXEC clean package
}
build_share() {
docker-compose -f "$COMPOSE_FILE_PATH" kill audit-share-share
yes | docker-compose -f "$COMPOSE_FILE_PATH" rm -f audit-share-share
$MVN_EXEC clean package -pl audit-share-share,audit-share-share-docker
}
build_acs() {
docker-compose -f "$COMPOSE_FILE_PATH" kill audit-share-acs
yes | docker-compose -f "$COMPOSE_FILE_PATH" rm -f audit-share-acs
$MVN_EXEC clean package -pl audit-share-platform,audit-share-platform-docker
}
tail() {
docker-compose -f "$COMPOSE_FILE_PATH" logs -f
}
tail_acs() {
docker-compose -f "$COMPOSE_FILE_PATH" logs -f audit-share-acs
}
tail_share() {
docker-compose -f "$COMPOSE_FILE_PATH" logs -f audit-share-share
}
tail_ass() {
docker-compose -f "$COMPOSE_FILE_PATH" logs -f audit-share-ass
}
tail_all() {
docker-compose -f "$COMPOSE_FILE_PATH" logs --tail="all"
}
ssh_acs() {
docker exec -it docker_audit-share-acs_1 /bin/bash
}
ssh_share() {
docker exec -it docker_audit-share-share_1 /bin/bash
}
ssh_ass() {
docker exec -it docker_audit-share-ass_1 /bin/bash
}
case "$1" in
build_start)
down
build
start
tail
;;
start)
start
tail
;;
stop)
down
;;
restart)
down
start
tail
;;
reset)
down
purge
build
start
tail
;;
purge)
down
purge
;;
tail)
tail
;;
tail_acs)
tail_acs
;;
tail_share)
tail_share
;;
tail_ass)
tail_ass
;;
reload_share)
build_share
start_share
tail_share
;;
reload_acs)
build_acs
start_acs
tail_acs
;;
ssh_acs)
ssh_acs
;;
ssh_ass)
ssh_ass
;;
ssh_share)
ssh_share
;;
reindex_ass)
purge_ass
start_ass
tail_ass
;;
*)
echo "Usage: $0 {build_start|start|stop|restart|reset|purge|tail|tail_acs|tail_share|tail_ass|reload_share|reload_acs|ssh_acs|ssh_ass|ssh_share|reindex_ass}"
esac