-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.sh
More file actions
executable file
·111 lines (89 loc) · 2.17 KB
/
reset.sh
File metadata and controls
executable file
·111 lines (89 loc) · 2.17 KB
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
#!/bin/sh
show_help() {
echo "mp-stack reset script"
echo "Use this script to start or rebuild the environment."
echo "Usage: ./reset.sh [OPTIONS]"
echo " Options:"
echo " --no-rebuild do not rebuild docker images"
echo " --volumes delete and recreate volumes to rebuild databases"
}
log() {
echo
echo "*** $1"
}
wd=$(pwd)
bn=$(basename $wd)
if [ "$bn" != "mp-stack" ]; then
log "must be run from the mp-stack directory"
exit 1
fi
export MP_STACK_HOME=$wd
# parse options
volumes=false
rebuild=true
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
--no-rebuild)
rebuild=false
shift
;;
--volumes)
volumes=true
shift
;;
*) # unknown option
show_help
exit 1
;;
esac
done
# stop and delete all containers
log "stopping containers"
docker-compose stop
log "removing containers"
docker-compose rm -f
# delete and recreate volumes
if [ "$volumes" == "true" ]; then
log "deleting and recreating volumes"
docker volume rm data-volume
docker volume create --name=data-volume
fi
# rebuild docker images
if [ "$rebuild" == "true" ]; then
log "rebuilding images"
docker build --tag stellar-base ./stellar-base
docker-compose build
fi
# start the system
log "starting postgres container"
docker-compose up -d postgres
log "waiting for postgres to accept connections"
until pg_isready -h localhost -p 5641 >/dev/null; do
sleep 1
done
log "starting stellar core"
docker-compose up -d stellar-core
log "waiting for stellar core to accept connections"
while ! nc -z localhost 11625 >/dev/null 2>/dev/null; do
sleep 1
done
while ! nc -z localhost 11626 >/dev/null 2>/dev/null; do
sleep 1
done
log "starting stellar horizon"
docker-compose up -d stellar-horizon
log "waiting for stellar horizon to accept connections"
while ! nc -z localhost 8000 >/dev/null 2>/dev/null; do
sleep 1
done
log "starting stellar bridge"
docker-compose up -d stellar-bridge
log "starting stellar compliance"
docker-compose up -d stellar-compliance
log "starting web auth server"
docker-compose up -d web-auth-server
log "starting transfer server"
docker-compose up -d transfer-server
log "starting web server"
docker-compose up -d web-server