-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathprovision-grafana.sh
28 lines (23 loc) · 936 Bytes
/
provision-grafana.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
#!/bin/bash
set -euxo pipefail
loki_ip_address="${1:-10.3.0.2}"
# see https://github.com/grafana/grafana/releases
# see https://hub.docker.com/r/grafana/grafana/tags
grafana_version="8.3.1"
mkdir -p grafana/datasources
cd grafana
# configure grafana.
# see https://grafana.com/docs/grafana/latest/administration/configure-docker/
# see https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources
# see https://grafana.com/docs/grafana/latest/datasources/loki/#configure-the-data-source-with-provisioning
sed -E "s,@@loki_base_url@@,http://$loki_ip_address:3100,g" /vagrant/grafana-datasources.yml \
>datasources/datasources.yml
# start grafana.
# see https://grafana.com/docs/grafana/latest/installation/docker/
docker run \
-d \
--restart unless-stopped \
--name grafana \
-p 3000:3000 \
-v $PWD/datasources:/etc/grafana/provisioning/datasources \
grafana/grafana:$grafana_version