Skip to content

Commit 3bad62f

Browse files
feat: Add simple grafana dashboard that can be used when running sidecar (#1856)
Also includes minor tweaks to the compose file. The node is now pruned more to keep the volume size small and maintainable. cAdvisor, grafan, loki, and prometheus were also added to the docker compose file so we can easily create a local grafana dashboard
1 parent 3683c4d commit 3bad62f

File tree

6 files changed

+835
-6
lines changed

6 files changed

+835
-6
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,6 @@ yarn-error.log
4040

4141
# Benchmarks
4242
/benchmarks.txt
43+
44+
# Metrics
45+
metrics/grafana/data/

docker-compose.yml

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,80 @@
1-
version: "3.8"
21
services:
32
polkadot:
43
container_name: polkadot
54
image: docker.io/parity/polkadot:latest
65
volumes:
7-
- ~/polkadot-data:/data
8-
# ports:
9-
# - "9944:9944"
10-
command: '--chain polkadot --unsafe-rpc-external --rpc-cors=all'
6+
- polkadot-data:/data
7+
ports:
8+
- "9944:9944"
9+
command: --base-path /data --chain polkadot --sync warp --state-pruning 256 --blocks-pruning 256 --database paritydb --unsafe-rpc-external --rpc-cors=all
1110

1211
sidecar:
13-
# build: .
12+
container_name: sidecar
1413
image: docker.io/parity/substrate-api-sidecar:latest
14+
build: .
1515
read_only: true
16+
restart: on-failure
1617
ports:
1718
- "8080:8080"
19+
- "9100:9100"
1820
environment:
1921
SAS_SUBSTRATE_URL: ws://polkadot:9944
22+
# SAS_SUBSTRATE_URL: wss://rpc.polkadot.io
23+
SAS_EXPRESS_BIND_HOST: "0.0.0.0"
24+
SAS_METRICS_ENABLED: "true"
25+
SAS_METRICS_PROM_HOST: "0.0.0.0"
26+
SAS_METRICS_LOKI_HOST: loki
27+
depends_on:
28+
- polkadot
29+
- loki
30+
31+
loki:
32+
container_name: loki
33+
image: grafana/loki:latest
34+
ports:
35+
- "3100:3100"
36+
command: -config.file=/etc/loki/local-config.yaml
37+
38+
cadvisor:
39+
container_name: cadvisor
40+
image: gcr.io/cadvisor/cadvisor:latest
41+
privileged: true
42+
ports:
43+
- "8081:8080"
44+
volumes:
45+
- /var/run:/var/run:ro
46+
- /sys:/sys:ro
47+
- /var/lib/docker/:/var/lib/docker:ro
48+
49+
prometheus:
50+
container_name: prometheus
51+
image: prom/prometheus:latest
52+
volumes:
53+
- ./metrics/prometheus.yml:/etc/prometheus/prometheus.yml:ro
54+
ports:
55+
- "9090:9090"
56+
command:
57+
- "--config.file=/etc/prometheus/prometheus.yml"
58+
- "--storage.tsdb.path=/prometheus"
59+
depends_on:
60+
- sidecar
61+
- cadvisor
62+
63+
grafana:
64+
container_name: grafana
65+
image: grafana/grafana:latest
66+
user: "${UID:-1000}:${GID:-1000}"
67+
volumes:
68+
- ./metrics/grafana/data:/var/lib/grafana
69+
- ./metrics/grafana/provisioning:/etc/grafana/provisioning:ro
70+
ports:
71+
- "3000:3000"
72+
environment:
73+
GF_SECURITY_ADMIN_USER: admin
74+
GF_SECURITY_ADMIN_PASSWORD: admin
75+
GF_USERS_ALLOW_SIGN_UP: "false"
76+
depends_on:
77+
- prometheus
78+
79+
volumes:
80+
polkadot-data:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: 1
2+
3+
providers:
4+
- name: "default"
5+
orgId: 1
6+
folder: ""
7+
type: file
8+
disableDeletion: false
9+
updateIntervalSeconds: 10
10+
options:
11+
path: /etc/grafana/provisioning/dashboards

0 commit comments

Comments
 (0)