Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: provide separate docker-compose files for OSX and Linux #2397

Merged
merged 2 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions dashboards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ go func() {

This exposes a metrics collection endpoint at http://localhost:5001/debug/metrics/prometheus. Note that this is the same endpoint that [Kubo](https://github.com/ipfs/kubo) uses, so if you want to gather metrics from Kubo, you can skip this step.

Dashboards can be inspected locally by running
On Linux, dashboards can be inspected locally by running:
```bash
docker-compose up
docker-compose -f docker-compose-linux.yml up
```
On macOS:
```bash
docker-compose -f docker-compose-osx.yml up
```

and opening Grafana at http://localhost:3000.
Expand All @@ -32,4 +36,4 @@ and opening Grafana at http://localhost:3000.

The following section is only relevant for creators of dashboards.

Due to a bug in Grafana, it's not possible to provision dashboards shared for external use directly. We need to apply the workaround described in https://github.com/grafana/grafana/issues/10786#issuecomment-568788499 (adding the a few lines in the dashboard JSON file).
Due to a bug in Grafana, it's not possible to provision dashboards shared for external use directly. We need to apply the workaround described in https://github.com/grafana/grafana/issues/10786#issuecomment-568788499 (adding a few lines in the dashboard JSON file).
34 changes: 34 additions & 0 deletions dashboards/docker-compose-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: "3.7"
services:
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
network_mode: "host"
extra_hosts: # define a host.docker.internal alias, so we can use the same datasources.yml and prometheus.yml on Linux and OSX
- "host.docker.internal:127.0.0.1"
grafana:
Comment on lines +10 to +12
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be the gateway address(172.17.0.1), right?
https://docs.docker.com/compose/compose-file/compose-file-v3/#extra_hosts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately that doesn't work. Kubo is only listening on 127.0.0.1 for the metrics endpoint.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I missed the line above it. This will work with this network_mode: "host"

image: grafana/grafana:latest
depends_on:
- prometheus
ports:
- "3000:3000"
network_mode: "host"
extra_hosts: # define a host.docker.internal alias, so we can use the same datasources.yml and prometheus.yml on Linux and OSX
- "host.docker.internal:127.0.0.1"
environment:
- GF_AUTH_DISABLE_LOGIN_FORM=true
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
volumes:
- ./dashboard.yml:/etc/grafana/provisioning/dashboards/main.yml
- ./datasources.yml:/etc/grafana/provisioning/datasources/prom.yml
- ./autonat/autonat.json:/var/lib/grafana/dashboards/autonat.json
- ./autorelay/autorelay.json:/var/lib/grafana/dashboards/autorelay.json
- ./eventbus/eventbus.json:/var/lib/grafana/dashboards/eventbus.json
- ./holepunch/holepunch.json:/var/lib/grafana/dashboards/holepunch.json
- ./identify/identify.json:/var/lib/grafana/dashboards/identify.json
- ./relaysvc/relaysvc.json:/var/lib/grafana/dashboards/relaysvc.json
- ./swarm/swarm.json:/var/lib/grafana/dashboards/swarm.json
File renamed without changes.