-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstop.sh
executable file
·54 lines (47 loc) · 907 Bytes
/
stop.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
#!/bin/bash
set -e
set -o pipefail
usage() {
cat << EOF
Stops all services for the specified environment.
Options:
-e <env> --environment <env> The environment to stop. Choices are: int, prod
-h --help Prints this help message and exits
EOF
}
# defaults
# parameters
while [ -n "$1" ]; do
case $1 in
-e | --environment)
shift
ENVIRO=$1
;;
-h | --help)
usage
exit 0
;;
*)
echo -e "Unknown option $1...\n"
usage
exit 1
;;
esac
shift
done
case $ENVIRO in
int|prod)
ENVIRO_VALID=true
;;
*)
ENVIRO_VALID=false
echo "Please set environment with -e/--environment to one of: int, prod"
usage
exit 1
;;
esac
# stop the containers
docker compose -p consensus-chess-$ENVIRO \
-f compose.yaml -f compose.$ENVIRO.yaml \
--env-file environments/db-$ENVIRO.env \
down