forked from msimerson/Mail-Toaster-6
-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision-influxdb.sh
executable file
·60 lines (49 loc) · 1.12 KB
/
provision-influxdb.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
#!/bin/sh
# shellcheck disable=1091
. mail-toaster.sh || exit
export JAIL_START_EXTRA=""
export JAIL_CONF_EXTRA=""
install_influxdb()
{
tell_status "installing influxdb"
stage_pkg_install influxdb || exit
tell_status "Enable InfluxdDB"
stage_sysrc influxd_enable=YES
if [ ! -d "$STAGE_MNT/var/lib" ]; then
mkdir "$STAGE_MNT/var/lib"
chown 907:907 "$STAGE_MNT/var/lib"
fi
}
configure_influxdb()
{
local _conf="$STAGE_MNT/usr/local/etc/influxd.conf"
sed -i.bak \
-e '/dir =.*meta"/ s/\/var\/db\/influxdb/\/data\/db/' \
-e '/dir =.*data"/ s/\/var\/db\/influxdb/\/data\/db/' \
-e '/wal-dir =.*wal"/ s/\/var\/db\/influxdb/\/data\/db/' \
"$_conf"
if [ ! -d "$STAGE_MNT/data/db" ]; then
mkdir "$STAGE_MNT/data/db" || exit
chown 907:907 "$STAGE_MNT/data/db" || exit
fi
}
start_influxdb()
{
stage_exec service influxd start
}
test_influxdb()
{
tell_status "testing influxd"
sleep 5
stage_test_running influxd
sleep 5
stage_listening 8086
}
base_snapshot_exists || exit
create_staged_fs influxdb
start_staged_jail influxdb
install_influxdb
configure_influxdb
start_influxdb
test_influxdb
promote_staged_jail influxdb