Skip to content

Commit

Permalink
Add auto-provisioning of Grafana to dev Compose setup
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Jul 8, 2023
1 parent 561ef18 commit 0bcaed7
Show file tree
Hide file tree
Showing 7 changed files with 3,729 additions and 23 deletions.
10 changes: 8 additions & 2 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,14 @@ cd dev
docker compose -f docker-compose.yml -f docker-compose.postgres.yml -f docker-compose.monitoring.yml up -d
```

Prometheus should automatically discover the API server's metrics. To visualize them, follow the instructions
for setting up the sample Grafana dashboard in the [docs](https://docs.dependencytrack.org/getting-started/monitoring/#grafana-dashboard).
Prometheus will automatically discover the API server's metrics. Grafana is configured to provision Prometheus
as datasource, and import the [sample dashboard](https://docs.dependencytrack.org/getting-started/monitoring/#grafana-dashboard)
on startup.

To view the dashboard, visit http://localhost:3000 in your browser. The initial Grafana credentials are:

* Username: `admin`
* Password: `admin`

## DataNucleus Bytecode Enhancement

Expand Down
27 changes: 6 additions & 21 deletions dev/docker-compose.monitoring.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,41 +21,26 @@ services:

prometheus:
image: prom/prometheus:v2.37.8
entrypoint: /bin/sh
command:
- -c
- >-
echo -e "$$PROMETHEUS_CONFIG_FILE" > /etc/prometheus/prometheus.yml;
/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus
environment:
PROMETHEUS_CONFIG_FILE: |-
scrape_configs:
- job_name: dtrack-apiserver
scrape_interval: 15s
scheme: http
dns_sd_configs:
- names:
- apiserver
type: A
port: 8080
ports:
- "127.0.0.1:9090:9090"
volumes:
- "./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro"
- "prometheus-data:/prometheus"
restart: unless-stopped

grafana:
image: grafana/grafana-oss:9.5.2
image: grafana/grafana-oss:9.5.5
depends_on:
- prometheus
environment:
GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin"
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_BASIC_ENABLED: "false"
GF_SECURITY_ADMIN_USER: "admin"
GF_SECURITY_ADMIN_PASSWORD: "admin"
ports:
- "127.0.0.1:3000:3000"
volumes:
- "grafana-data:/var/lib/grafana"
- "./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro"
- "./monitoring/grafana/dashboards:/etc/dashboards:ro"
restart: unless-stopped

volumes:
Expand Down
Loading

0 comments on commit 0bcaed7

Please sign in to comment.