-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrun.sh
executable file
·81 lines (62 loc) · 1.82 KB
/
run.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
# Variables for log colors
YELLOW="\033[0;33m"
GREEN="\033[0;32m"
NC="\033[0m"
cloneZabbix() {
echo -e "${GREEN}$(date +%d/%m/%Y) - $(date +%T) - Clone Zabbix repo ${NC}"
echo
cd zabbix
[ ! -d "./zabbix-docker" ] && git clone https://github.com/zabbix/zabbix-docker
cd ..
}
buildAndRunZabbix() {
echo -e "${GREEN}$(date +%d/%m/%Y) - $(date +%T) - Build & Run Zabbix ${NC}"
echo
cd zabbix/zabbix-docker
docker-compose -f docker-compose_v3_alpine_pgsql_latest.yaml up -d --build
cd ../..
}
buildAndRunBromeliaHss() {
echo -e "${GREEN}$(date +%d/%m/%Y) - $(date +%T) - Build & Run Bromélia HSS ${NC}"
echo
cd hss_app
docker-compose -f docker-compose.yaml up -d --build
cd ..
}
buildAndRunBromeliaHssWithZabbix() {
echo -e "${GREEN}$(date +%d/%m/%Y) - $(date +%T) - Build & Run Bromélia HSS with Zabbix${NC}"
echo
cd hss_app
docker-compose -f docker-compose.zabbix.yaml up -d --build
cd ..
}
includeZabbixInstallation() {
echo -e "${YELLOW}$(date +%d/%m/%Y) - $(date +%T) - Start Bromélia HSS installation ${NC}"
echo
cloneZabbix
buildAndRunZabbix
buildAndRunBromeliaHssWithZabbix
echo -e "${YELLOW}$(date +%d/%m/%Y) - $(date +%T) - End Bromélia HSS installation ${NC}"
exit 1
}
defaultInstallation() {
echo -e "${YELLOW}$(date +%d/%m/%Y) - $(date +%T) - Start Bromélia HSS installation ${NC}"
echo
buildAndRunBromeliaHss
echo -e "${YELLOW}$(date +%d/%m/%Y) - $(date +%T) - End Bromélia HSS installation ${NC}"
exit 1
}
main() {
echo $1
#: Bromélia installation with Zabbix
if [[ "$1" == "include-zabbix" ]]; then
includeZabbixInstallation
fi
#: Default installation
if [[ "$1" == "default" ]]; then
defaultInstallation
fi
defaultInstallation
}
main "$1"