forked from algorand/algorand-sdk-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathup.sh
More file actions
executable file
·79 lines (66 loc) · 1.87 KB
/
up.sh
File metadata and controls
executable file
·79 lines (66 loc) · 1.87 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
#!/usr/bin/env bash
#
# Bring up the SDK test environment.
set -e
rootdir=`dirname $0`
pushd $rootdir/.. > /dev/null
# Defaults
TYPE_OVERRIDE=""
DAEMON_FLAG="-d"
SKIP_BUILD=0
SHOW_HELP=0
ENV_FILE=".up-env"
PARALLEL="--parallel"
show_help() {
echo "Manage bringing up the SDK test environment."
echo
echo "Usage: up.sh [options]"
echo
echo "Options:"
echo " -f <FILE> Override the environment file."
echo " -t <TYPE> Override the installation type specified in the environment file."
echo " Valid types: ['channel', 'type']"
echo " -s Skip rebuilding the docker image."
echo " -i Start the docker environment in interactive mode."
echo " -h Provide this help information."
echo " -p Disable parallel build mode. Probably only useful when editing the test environment."
}
# Parse arguments
while getopts "pf:t:sih" opt; do
case "$opt" in
f) ENV_FILE=$OPTARG; ;;
i) unset DAEMON_FLAG; ;;
s) SKIP_BUILD=1; ;;
t) TYPE_OVERRIDE=$OPTARG; ;;
h) show_help; exit 0 ;;
p) unset PARALLEL; ;;
esac
done
# Verify there are no positional parameters with getopt/getopts
shift "$((OPTIND-1))"
if [[ "$1" != "" ]]; then
echo "No positional arguments should be provided, found '$@'"
echo
show_help
exit
fi
# Load environment.
source $ENV_FILE
# Choose which dockerfile to use.
TYPE=${TYPE_OVERRIDE:-$TYPE}
if [[ $TYPE == "channel" ]] || [[ $TYPE == "source" ]]; then
export TYPE="$TYPE"
else
echo "Unknown environment: $TYPE"
exit 1
fi
echo "Bringing up network with '$TYPE' configuration."
# Make sure it isn't running
./scripts/down.sh
# Remove the containers to allow re-running stateful tests.
docker-compose rm --force
# When developing, it's often useful to skip the build phase.
if [[ $SKIP_BUILD -eq 0 ]]; then
docker-compose build --no-cache $PARALLEL
fi
docker-compose up $DAEMON_FLAG