forked from MassBank/MassBank-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·51 lines (48 loc) · 1.38 KB
/
install.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
#!/bin/bash
CURRENT_UID=$(id -u):$(id -g)
export CURRENT_UID
usage () {
echo "Usage: install.sh <operation> <instance>"
echo " <operation> ... start, stop, deploy or refresh"
echo " <instance> ... 0 to 9"
}
case $2 in
[0-9])
TAG=$2
export TAG
;;
*)
usage
exit 1
;;
esac
case $1 in
start)
docker-compose -f compose/full-service.yml -p $TAG pull
docker-compose -f compose/full-service.yml -p $TAG run --rm maven mvn -Duser.home=/var/maven -f /project package
docker-compose -f compose/full-service.yml -p $TAG up -d tomcat
echo "Wait 20s for database to be ready..."
sleep 20
docker-compose -f compose/full-service.yml -p $TAG \
run --rm dbupdate \
/project/MassBank-lib/target/MassBank-lib-0.0.1-default/MassBank-lib-0.0.1/bin/RefreshDatabase
;;
stop)
docker-compose -f compose/full-service.yml -p $TAG rm -s
;;
refresh)
docker-compose -f compose/full-service.yml -p $TAG \
run --rm dbupdate \
/project/MassBank-lib/target/MassBank-lib-0.0.1-default/MassBank-lib-0.0.1/bin/RefreshDatabase
;;
deploy)
docker-compose -f compose/full-service.yml -p $TAG pull
docker-compose -f compose/full-service.yml -p $TAG run --rm maven mvn -Duser.home=/var/maven -f /project package
docker-compose -f compose/full-service.yml -p $TAG rm -s tomcat
docker-compose -f compose/full-service.yml -p $TAG up -d tomcat
;;
*)
usage
exit 1
;;
esac