-
Notifications
You must be signed in to change notification settings - Fork 3
/
start.sh
54 lines (45 loc) · 1.16 KB
/
start.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
#!/bin/bash
start_statsd(){
result=$(docker run -d\
-e INFLUXDB_HOST='influxdb' -e INFLUXDB_PORT='8086' \
-e INFLUXDB_NAME='demo' -e INFLUXDB_USER='root' \
-e INFLUXDB_PASS='root' \
--name statsd \
-p 8125:8125/udp\
--link influxdb:influxdb\
eloycoto/statsd-influxdb)
}
start_influxdb(){
mkdir -p /opt/influxdb
mkdir -p /opt/log
result=$(docker run -d\
-e PRE_CREATE_DB="demo" -e INFLUXDB_INIT_PWD="root"\
--name influxdb \
-p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099\
-v /opt/influxdb/:/data/ \
-v /opt/log:/var/log \
tutum/influxdb)
echo $result
}
start_grafana(){
mkdir -p /opt/grafana/data
result=$(docker run -d \
-p 3000:3000 \
-v /opt/grafana/data:/opt/grafana/data \
--name grafana\
--link influxdb:influxdb\
grafana/grafana)
}
kill_stop(){
docker stop $1
docker rm $1
}
function main(){
kill_stop influxdb
start_influxdb
kill_stop statsd
start_statsd
kill_stop grafana
start_grafana
}
main