-
Notifications
You must be signed in to change notification settings - Fork 0
/
provendb-docker.sh
executable file
·78 lines (69 loc) · 2.19 KB
/
provendb-docker.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
# Startup script for running provenDB from docker compose
# usage: provendb-docker.sh [reset|load|stop]
#
#
#
#
export PROVENDB_DB='provendb'
export MONGOADMIN_URI=mongodb://pdbroot:click123@localhost:27027/provendb?authSource=admin
export PROVENDB_URI=mongodb://pdbuser:click123@localhost:27018/provendb
cd ~/git/provendb-docker-compose
. .env
if [ "$#" -eq 0 ];then
echo "Usage: $0 start|stop|load|reset|pull|reset"
exit 1
fi
pdreset() {
docker volume rm `docker volume ls | grep provendb-data|awk '{print $2}'`
}
pdpull() {
docker-compose pull
#docker pull asia.gcr.io/provendb/provendb-verify:latest
az login
az acr login --name provendbDev
docker pull provendbdev.azurecr.io/provendb-verify:latest
docker pull provendbdev.azurecr.io/provendb-verify:latest
}
pdstop() {
docker-compose -f docker-compose.yml -f docker-compose.standalone.yml stop && docker-compose -f docker-compose.yml -f docker-compose.standalone.yml down
}
pdquickStart() {
docker-compose -f docker-compose.yml -f docker-compose.standalone.yml up -d
}
pdstart() {
docker-compose -f docker-compose.yml -f docker-compose.standalone.yml up -d
sleep 30
echo "db.runCommand({setLogLevel:'info'});"|provendbShell.sh mongodb://pdbuser:click123@localhost:${PORT_PROXY}/${PROVENDB_DB}
}
while [ $# -gt 0 ];do
if [ "$1" = "reset" ];then
pdstop
pdstop
pdreset
pdquickStart
sleep 60
pdstop
pdstart
elif [ "$1" = "pull" ];then
pdpull
elif [ "$1" = "load" ];then
pdstop
pdreset
docker-compose -f docker-compose.yml -f docker-compose.standalone.yml up -d mongo
sleep 60
echo "Dropping database"
echo "db.getSiblingDB(\"$PROVENDB_DB\").dropDatabase();"|mongo $MONGOADMIN_URI
mongorestore --uri $MONGOADMIN_URI --nsFrom '$prefix$.$suffix$' --nsTo "$PROVENDB_DB.\$suffix\$" --numParallelCollections 4 --gzip --drop --archive=$HOME/git/provendb-tests/data/testDB/dump.gz
pdstart
elif [ "$1" = "stop" ];then
pdstop
elif [ "$1" = "start" ];then
pdstart
elif [ "$1" = "restart" ];then
pdstop
pdstart
fi
shift
done
sleep 15
docker exec -it $(docker ps|grep proxy|cut -f1 -d' ') mongo mongodb://pdbuser:click123@localhost:27018/provendb