-
Notifications
You must be signed in to change notification settings - Fork 1
/
SCALE.prod.sh
executable file
·81 lines (71 loc) · 1.54 KB
/
SCALE.prod.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
79
80
81
#!/bin/bash
source ./deploy/utils.sh
# COLORS
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# PARSE INPUT ARGUMENTS
STATUS=0 # UP OR DOWN
UPORDOWN=DOWN
BACKEND=false
WORKERS=false
SINK=false
# Parse first parameter
if [[ "$1" = UP ]]; then
STATUS=1
UPORDOWN=$1
shift
elif [[ "$1" = DOWN ]]; then
STATUS=0
UPORDOWN=$1
shift
else
echo "Wrong parameter: $1"
exit 1
fi
while [[ $# -gt 0 ]]; do
# Parse subsequent parameters
key="$1"
# Exit if there are no additional parameters
if [[ -z "$key" ]]; then
echo "No additional parameters supplied. Exiting."
exit 1
fi
case "${key,,}" in
backend)
BACKEND=true
shift
;;
workers)
WORKERS=true
shift
;;
sink)
SINK=true
shift
;;
*)
printf "Ignoring input argument: $key \n"
shift # Shift removes from the list the argument
;;
esac
done
# Parse input variables from the ENV files
eval $(parse_yaml ./deploy/ENV.deploy.yml)
# BACKEND was set?
if [[ "$BACKEND" = true ]]; then
print_header "$UPORDOWN Backend"
# push changes
up_to_heroku $backend_APP_TYPE $STATUS $backend_GIT_HEROKU_REMOTE
fi
# WORKERS was set?
if [[ "$WORKERS" = true ]]; then
print_header "$UPORDOWN Workers"
# push changes
up_to_heroku $workers_APP_TYPE $STATUS $workers_GIT_HEROKU_REMOTE
fi
# SINK was set?
if [[ "$SINK" = true ]]; then
print_header "$UPORDOWN Sink"
# push changes
up_to_heroku $sink_APP_TYPE $STATUS $sink_GIT_HEROKU_REMOTE
fi