forked from tutumcloud/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
20 lines (13 loc) · 856 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash
cd grafana-${GRAFANA_VERSION}
function create_db {
curl --cookie-jar /tmp/cookiefile 'http://localhost/login' -H 'Content-Type: application/json;charset=UTF-8' --data-binary '{"user":"admin","email":"","password":"admin"}'
curl --cookie /tmp/cookiefile 'http://localhost/api/datasources' -X PUT -H 'Content-Type: application/json;charset=utf-8' --data '{"name":"influxdb","type":"influxdb_08","url":"http://'${INFLUXDB_HOST}':'${INFLUXDB_PORT}'","access":"proxy","isDefault":true,"database":"'${INFLUXDB_NAME}'","user":"'${INFLUXDB_USER}'","password":"'${INFLUXDB_PASS}'"}'
echo -e "Created InfluxDB datasources."
}
if [ -f "/.pre_db_created" ]; then
echo "=> Data sources had been created before, skipping ..."
else
(sleep 60 && create_db && touch "/.pre_db_created")&
fi
./bin/grafana-server -config="/grafana.ini"