Skip to content

Commit e5dc164

Browse files
author
Carlos León
committed
Bootstrap container with grafanalib
1 parent 9090896 commit e5dc164

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,7 @@ docker-swarm.box
127127
*.tfvars
128128
join.sh
129129
output-virtualbox-iso
130+
131+
# Ignore grafanalib output
132+
/graphs/__pycache__/
133+
/graphs/*.json

graphs/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM python:3.4-alpine
2+
3+
MAINTAINER Container Solutions [email protected]
4+
5+
# Install basic dependencies
6+
RUN apk add -U curl git parallel
7+
8+
# Silence parallel citation notice
9+
RUN mkdir /root/.parallel && \
10+
touch /root/.parallel/will-cite
11+
12+
# Install pip
13+
RUN curl https://bootstrap.pypa.io/get-pip.py | python
14+
15+
# Install grafanalib
16+
RUN pip install git+https://github.com/weaveworks/grafanalib@82556ddfbbd6134837d280a7999d35c45cc3c87e
17+
18+
WORKDIR /opt/code
19+
20+
CMD ["/bin/sh", "-c"]

graphs/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Grafana Dashboards
2+
We have included a set of dashboards for Grafana in this demo application.
3+
Most of the source of these dashboards look exactly the same. For the sake of
4+
keeping our code DRY, we have decided to generate our dashboards using [grafanalib](https://github.com/weaveworks/grafanalib).
5+
6+
7+
# Requirements
8+
If you don't have Python installed on your computer but do have Docker, then Docker and Make will
9+
make your life easier today:
10+
11+
| what | version |
12+
| ------ | --------- |
13+
| make | `>= 4.1` |
14+
| docker | `>= 17` |
15+
16+
# Getting Started
17+
18+
## The Base Image
19+
All the tooling required to generate the dashboards is inside a container. Build it with like this:
20+
21+
```
22+
docker build -t weaveworks/grafanalib .
23+
```
24+
25+
## Generating Dashboards
26+
Make sure that you run the following commands from within the `graphs/` directory:
27+
28+
```
29+
docker run --rm -it -v ${PWD}:/opt/code weaveworks/grafanalib /bin/sh -c 'ls /opt/code/*.dashboard.py | parallel generate-dashboard -o {.}.json {}'
30+
```

0 commit comments

Comments
 (0)