Skip to content

Commit 5270ae8

Browse files
authored
Feature/docker (#3)
* ➕ username * ✈️ compose and prometheus configuration * ✔️ compose configuration * ✔️ remove compose option
1 parent 51325da commit 5270ae8

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ REPO_NAME_CONTAINS=string-to-match-repositories-with # Default: ""
2222
CRONTAB_SCHEDULE=crontab-schedule-to-get-data-from-github # Default: "0 * * * *"
2323
```
2424

25+
**_NOTE:_** You also can use your username if you don't belong to any organization. In this case, use "USERNAME" instead of "ORG_NAME".
26+
2527
Run the image:
2628
```
2729
$ docker run --env-file .env -it -p 8001:8001 ghcr.io/grafana/github-traffic
@@ -36,3 +38,35 @@ Profit!
3638

3739
Now you can collect those metrics as you would do with any other service. To visualize them, we provide an example/template Grafana dashboard: https://grafana.com/grafana/dashboards/15000
3840

41+
## Docker compose
42+
In addition, a docker-compose.yaml file is provided. This file also run Prometheus and Grafana.
43+
44+
**_NOTE:_** You've to create the .env file with you configuration.
45+
46+
Run compose:
47+
```zsh
48+
❯ docker-compose up -d
49+
Creating network "github-traffic_default" with the default driver
50+
Creating github-traffic_traffic_1 ... done
51+
Creating github-traffic_prometheus_1 ... done
52+
Creating github-traffic_grafana_1 ... done
53+
```
54+
55+
Now, you can access to:
56+
* Grafana: http://localhost:3000
57+
* Prometheus: http://localhost:9090
58+
* Github traffic: http://localhost:8001
59+
60+
Once you navigate to Grafana (http://localhost:3000), the user and password are admin/admin you have to configure a datasource to Prometheus (http://prometheus:9090) and import the dashboard with id 15000.
61+
62+
Remove containers:
63+
```zsh
64+
❯ docker-compose down
65+
Stopping github-traffic_grafana_1 ... done
66+
Stopping github-traffic_prometheus_1 ... done
67+
Stopping github-traffic_traffic_1 ... done
68+
Removing github-traffic_grafana_1 ... done
69+
Removing github-traffic_prometheus_1 ... done
70+
Removing github-traffic_traffic_1 ... done
71+
Removing network github-traffic_default
72+
```

docker-compose.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
services:
2+
grafana:
3+
image: 'grafana/grafana-oss'
4+
ports:
5+
- "3000:3000"
6+
links:
7+
- prometheus
8+
dns:
9+
- 8.8.8.8
10+
prometheus:
11+
image: 'prom/prometheus'
12+
volumes:
13+
- ./prometheus/:/etc/prometheus/
14+
command:
15+
- '--config.file=/etc/prometheus/prometheus.yaml'
16+
ports:
17+
- "9090:9090"
18+
links:
19+
- traffic
20+
traffic:
21+
image: 'ghcr.io/grafana/github-traffic'
22+
ports:
23+
- "8001:8001"
24+
env_file:
25+
- .env
26+
restart:
27+
on-failure
28+
dns:
29+
- 8.8.8.8

prometheus/prometheus.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
global:
2+
scrape_interval: 30s
3+
scrape_timeout: 10s
4+
5+
rule_files:
6+
- alert.yml
7+
8+
scrape_configs:
9+
- job_name: services
10+
metrics_path: /metrics
11+
static_configs:
12+
- targets:
13+
- 'traffic:8001'

0 commit comments

Comments
 (0)