-
Notifications
You must be signed in to change notification settings - Fork 1
/
manage
executable file
·68 lines (62 loc) · 1.63 KB
/
manage
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
#!/usr/bin/env bash
# Script based off: https://github.com/bcgov/von-network/blob/main/manage
set -eo pipefail
function print_usage {
cat <<EOF
Manage infrastructure for the Identity Management framework.
Instantiates Orion Database Node, VON-network for Indy nodes and PostgreSQL storage for individual nodes.
Usage:
[set]up:
Instantiate all infrastructure related services.
sub-option: 'node' when passed, runs only node specific setup
[tear]down:
Stop all infrastructure related services.
sub-option: 'node' when passed, runs only node specific teardown
restart:
Runs 'teardown' and then 'setup', restarting the infrastructure.
sub-option: 'node' when passed, runs only node specific restart
clean:
Cleanup docker related files, needs to be done periodically in development because of unused volumes.
help:
Print the usage.
EOF
}
ZRT_NETWORK=ba-arminveres-23
cmd=$1
option=$2
# export DOCKERHOST=172.24.254.31
if [[ -z "$DOCKERHOST" ]]; then
DOCKERHOST="$(./scripts/get_zerotier_addr.sh $ZRT_NETWORK)"
export DOCKERHOST
fi
if [[ -n $option && $option != 'node' ]]; then
echo "Unknown sub-option $option"
echo
print_usage
exit 1
fi
case $cmd in
setup | up)
./scripts/setup.sh "$option"
;;
teardown | down)
./scripts/teardown.sh "$option"
;;
restart)
./scripts/teardown.sh "$option" && ./scripts/setup.sh "$option"
;;
clean)
printf "Cleaning Docker ...\n\n"
printf "ATTENTION: This invokes docker system prune, running system wide cleaning\n\n"
docker system prune
;;
help)
print_usage
;;
*)
echo "Unknown Option $cmd"
echo
print_usage
exit 1
;;
esac