Skip to content

Commit 89996e7

Browse files
author
Jonathan Chauncey
committed
feat(grafana2): Add support for grafana 2
1 parent 9dd343c commit 89996e7

10 files changed

Lines changed: 2210 additions & 0 deletions

grafana/Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
SHORT_NAME ?= grafana
2+
BUILD_TAG ?= git-$(shell git rev-parse --short HEAD)
3+
DEIS_REGISTRY ?= ${DEV_REGISTRY}
4+
IMAGE_PREFIX ?= deis
5+
IMAGE_LATEST := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:latest
6+
IMAGE := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${BUILD_TAG}
7+
8+
info:
9+
@echo "Build tag: ${BUILD_TAG}"
10+
@echo "Registry: ${DEIS_REGISTRY}"
11+
@echo "Image: ${IMAGE}"
12+
13+
docker-build:
14+
docker build -t $(IMAGE_LATEST) rootfs
15+
docker tag -f $(IMAGE_LATEST) $(IMAGE)
16+
17+
docker-push:
18+
docker push ${IMAGE}
19+
20+
kube-delete: update-manifests
21+
-kubectl delete -f manifests/deis-monitor-grafana-svc.yaml
22+
-kubectl delete -f manifests/deis-monitor-grafana-proxy-pod.yaml
23+
-kubectl delete -f manifests/deis-monitor-grafana-rc.tmp.yaml
24+
25+
kube-create: update-manifests
26+
kubectl create -f manifests/deis-monitor-grafana-svc.yaml
27+
kubectl create -f manifests/deis-monitor-grafana-rc.tmp.yaml
28+
kubectl create -f manifests/deis-monitor-grafana-proxy-pod.yaml
29+
30+
kube-update: update-manifests
31+
kubectl delete -f manifests/deis-monitor-grafana-rc.tmp.yaml
32+
kubectl create -f manifests/deis-monitor-grafana-rc.tmp.yaml
33+
34+
update-manifests:
35+
sed 's#\(image:\) .*#\1 $(IMAGE)#' manifests/deis-monitor-grafana-rc.yaml > manifests/deis-monitor-grafana-rc.tmp.yaml

grafana/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Grafana
2+
3+
## Description
4+
[Grafana](http://grafana.org/) is a graphing application built for time series data. It natively supports influxdb and provides great dashboarding support.
5+
6+
## Deployment
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: deis-monitor-grafana-proxy
5+
namespace: deis
6+
labels:
7+
heritage: deis
8+
spec:
9+
containers:
10+
- name: grafana
11+
image: gcr.io/google_containers/proxy-to-service:v2
12+
args: [ "tcp", "3500", "deis-monitor-grafana.deis.svc.cluster.local" ]
13+
ports:
14+
- name: http-ui
15+
protocol: TCP
16+
containerPort: 3500
17+
hostPort: 3500
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: v1
2+
kind: ReplicationController
3+
metadata:
4+
name: deis-monitor-grafana
5+
namespace: deis
6+
labels:
7+
heritage: deis
8+
spec:
9+
replicas: 1
10+
selector:
11+
app: deis-monitor-grafana
12+
template:
13+
metadata:
14+
labels:
15+
app: deis-monitor-grafana
16+
spec:
17+
containers:
18+
- name: deis-monitor-grafana
19+
image: grafana/grafana:2.6.0
20+
imagePullPolicy: Always
21+
env:
22+
- name: "INFLUXDB_URLS"
23+
value: http://$(DEIS_MONITOR_INFLUXDB_SERVICE_HOST):$(DEIS_MONITOR_INFLUXDB_PORT_8086_TCP_PORT)
24+
- name: "KUBERNETES_DOCKER_ENDPOINT"
25+
value: "unix:///var/run/docker.sock"
26+
- name: "BIND_PORT"
27+
value: "3500"
28+
ports:
29+
- containerPort: 3500
30+
name: ui
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: deis-monitor-grafana
5+
namespace: deis
6+
labels:
7+
heritage: deis
8+
app: deis-monitor-grafana
9+
spec:
10+
ports:
11+
- port: 3500
12+
name: ui
13+
targetPort: ui
14+
selector:
15+
app: deis-monitor-grafana

grafana/rootfs/Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM grafana/grafana:2.6.0
2+
3+
RUN apt-get update && \
4+
apt-get install -y curl && \
5+
rm /etc/grafana/grafana.ini
6+
7+
ADD https://github.com/arschles/envtpl/releases/download/0.1.1/envtpl_linux_amd64 /usr/share/grafana/envtpl
8+
9+
COPY dashboards /usr/share/grafana/dashboards
10+
COPY start-grafana /usr/share/grafana/start-grafana
11+
COPY grafana.ini.tpl /usr/share/grafana/grafana.ini.tpl
12+
13+
RUN chmod +x /usr/share/grafana/envtpl && \
14+
chmod +x /usr/share/grafana/start-grafana && \
15+
chmod 644 /usr/share/grafana/grafana.ini.tpl
16+
17+
EXPOSE 3000
18+
WORKDIR /usr/share/grafana
19+
ENTRYPOINT ["./start-grafana"]

0 commit comments

Comments
 (0)