-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinoa-startup.sh
executable file
·92 lines (76 loc) · 2.39 KB
/
inoa-startup.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
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
ENV_FILE=.env
if [ ! -f "$ENV_FILE" ]; then
echo "ERROR: Can't start INOA without local configuration."
echo "$ENV_FILE does not exist. Please create it from .env.template and configure at least your local IP."
exit 1;
fi
# shellcheck source=/dev/null
source $ENV_FILE
INOA_LOCAL_UI=""
CLEAN=""
############################################################
# Help #
############################################################
Help()
{
# Display Help
echo "Start local INOA Developer Setup."
echo
echo "Syntax: ./inoa-startup.sh [-c|m|u|h]"
echo "options:"
echo "c Clean build before start."
echo "m Start some simulated Satellites to generate some traffic."
echo "u Start local UI for developing Ground Control."
echo "h Print help message."
echo
}
CleanBuild() {
mvn clean install -DskipITs "${MVN_ARGS[@]}"
}
LaunchK3S() {
if [ "${CLEAN}" ]; then
echo "Clean up before..."
CleanBuild || { echo "Clean Build failed!" ; exit 1; }
fi
# shellcheck disable=SC2145
echo "MVN_ARGS=${MVN_ARGS[@]}"
### Launch the INOA Cloud services in k3s via Maven
mvn pre-integration-test "${MVN_ARGS[@]}" -pl ./test/ || { echo "Pre-Integration-Test failed!" ; exit 1; }
echo "INOA configured and started for INOA_DOMAIN=${INOA_DOMAIN}"
xdg-open "http://help.${INOA_DOMAIN}:8080"
}
### Start Ground Control locally for development Maybe: optional?
LaunchUI() {
if [ "${INOA_LOCAL_UI}" ]; then
cd app || exit
yarn start &
fi
}
echo "Starting INOA with: -Dinoa.domain=${INOA_DOMAIN}"
############################################################
# Process the input options. Add options as needed. #
############################################################
# Get the options
# while getopts ":chmu" option; do
while getopts ":chmu" option; do
case $option in
h) # display Help
Help
exit;;
c) # clean before launch
export CLEAN="1";;
m)
export MCNOISE_REPLICAS=10;;
u) # Launch local UI
export INOA_LOCAL_UI=1;;
*) # Invalid options
echo "Invalid options given."
Help
exit;;
esac
done
MVN_ARGS=("-DskipTests=true" "-Dk3s.failIfExists=false" "-Dk3s.kubeconfig=${KUBECONFIG}" "-Dinoa.domain=${INOA_DOMAIN}" "-Dmcnoise.replicas=${MCNOISE_REPLICAS}")
LaunchK3S
LaunchUI
echo "Happy IoT-ing"