-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
92 lines (66 loc) · 2.16 KB
/
deploy.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/sh
echo ""
echo ""
if [ "$EUID" -ne 0 ]
then echo "Please run script as root or with sudo!"
exit
fi
# Create needed folders
mkdir -p /appdata/telegraf && echo "Telegraf folder created successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
mkdir -p /appdata/grafana/etc-grafana && echo "Grafana folder 1 created successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
mkdir -p /appdata/grafana/var-lib-grafana && echo "Grafana folder 2 created successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
mkdir -p /appdata/influxdb && echo "InfluxDB folder created successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
chmod -R 776 /appdata/grafana && echo "Rights successfully altered to Grafana folder!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
# Get Telegraf configuration file
cp configuration/telegraf/telegraf.conf /appdata/telegraf/telegraf.conf && echo "Configuration file for Telegraf downloaded successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
# Get Grafana configuration file
cp configuration/grafana/grafana.ini /appdata/grafana/etc-grafana/grafana.ini && echo "Configuration file for Grafana downloaded successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
cp -r configuration/grafana/provisioning /appdata/grafana/ && echo "Provisioning configuration file for Grafana downloaded successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
cp nginx.conf /etc/nginx/sites-available/grafana-monitoring && echo "Nginx config copied successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
ln -s /etc/nginx/sites-available/grafana-monitoring /etc/nginx/sites-enabled/grafana-monitoring && echo "Symbolic link created successfully!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
nginx -t && service nginx restart && echo "Nginx config is OK!"
if [ $? -ne 0 ]; then
echo "Exitting because of error!"
exit 1
fi
docker-compose up -d