-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
56 lines (50 loc) · 1.64 KB
/
install.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
# Linux and MacOS
#!/bin/bash
# Paths to the .env files
influx_env="./InfluxDB-SA-FMS/influx.env"
sensorsimulation_env="./sensor-simulator/sensor-simulator.env"
nodered_env="./Node-RED-SA-FMS/nodered.env"
telegraf_env="./Telegraf-SA-FMS/telegraf.env"
grafana_env="./Grafana-SA-FMS/grafana.env"
maildev_env="./MailDev-SA-FMS/maildev.env"
output_env="./se4iot-SA-FMS.env"
# Check if the combined .env file already exists
if [ -f "$output_env" ]; then
echo "The file $output_env already exists."
read -p "Do you want to overwrite it? (y/n): " response
if [[ "$response" != "y" && "$response" != "Y" ]]; then
echo "Operation cancelled."
exit 0
fi
fi
# Verify if the individual .env files exist
if [ ! -f "$influx_env" ]; then
echo "Error: The file $influx_env does not exist."
exit 1
fi
if [ ! -f "$sensorsimulation_env" ]; then
echo "Error: The file $sensorsimulation_env does not exist."
exit 1
fi
if [ ! -f "$nodered_env" ]; then
echo "Error: The file $nodered_env does not exist."
exit 1
fi
if [ ! -f "$telegraf_env" ]; then
echo "Error: The file $telegraf_env does not exist."
exit 1
fi
if [ ! -f "$grafana_env" ]; then
echo "Error: The file $grafana_env does not exist."
exit 1
fi
if [ ! -f "$maildev_env" ]; then
echo "Error: The file $maildev_env does not exist."
exit 1
fi
# Combine the .env files into one
cat "$influx_env" "$sensorsimulation_env" "$nodered_env" "$telegraf_env" "$grafana_env" "$maildev_env" > "$output_env"
echo "Combined .env files into $output_env"
# Execute docker compose build and up
docker compose build --no-cache
docker compose up -d --scale telegraf-SA-FMS=2