Skip to content

Commit c5dda51

Browse files
authored
feat(docker): docker-compose.yml to run Gossamer, Prometheus and Grafana (#2706)
- Tailor docker-compose.yml for local development and metrics viewing - Add Gossamer to `docker-compose.yml` - Add Grafana to `docker-compose.yml` - Move prometheus.yml to `docker/prometheus/` (so bind mount works on OSX, Windows) - Add Grafana configurations and provisioning to `docker/grafana` - Remove unneeded Prometheus commands - Do not map Prometheus server port, only expose to Grafana - Add `/docker` to `.dockerignore` - Set docker-compose.yml version to `'3'` for greater compatibility - `docker-compose build` builds Gossamer image - Add commented lines to persist Prometheus and Grafana data - Update using Prometheus document page
1 parent 03b7019 commit c5dda51

File tree

10 files changed

+1719
-52
lines changed

10 files changed

+1719
-52
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/.githooks
33
/.github
44
!/.github/workflows/staging
5+
/docker
56
/docs
67
/.deepsource.toml
78
/.dockerignore
@@ -12,5 +13,4 @@
1213
/docker-compose.yml
1314
/Dockerfile
1415
/Dockerfile.staging
15-
/prometheus.yml
1616
/README.md

docker-compose.yml

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,60 @@
1-
version: '3.7'
1+
# This docker-compose.yml configuration contains:
2+
# - a Gossamer node on the Kusama chain
3+
# - a Prometheus server scrapping metrics from Gossamer
4+
# - a Grafana server using the Prometheus server as source
5+
#
6+
# Prometheus and Grafana are both provisioned to give you a dashboard to play with.
7+
# They are tailored for local development, and Grafana gives you anonymous admin access.
8+
#
9+
# You can run all of the containers with: `docker-compose up`
10+
# Alternatively, you can run select containers with for example: `docker-compose up gossamer`
11+
#
12+
# To rebuild the Gossamer Docker image: `docker-compose build`
13+
14+
version: '3'
15+
16+
services:
17+
gossamer:
18+
image: chainsafe/gossamer
19+
build: .
20+
volumes:
21+
# Remove with: docker volume rm gossamer
22+
- gossamer:/data/gossamer
23+
command:
24+
- --basepath=/data/gossamer
25+
- --chain=kusama
26+
- --log=info
27+
- --publish-metrics
28+
- --metrics-address=:9876
29+
- --pprofserver
30+
ports:
31+
- 6060:6060/tcp # Pprof server
32+
- 7001:7001/tcp # Network port
33+
- 8545:8545/tcp # RPC HTTP port
34+
- 8546:8546/tcp # RPC Websocket port
35+
expose:
36+
- 9876/tcp # Prometheus metrics for Prometheus server
237

3-
services:
438
prometheus:
539
image: prom/prometheus
640
volumes:
7-
- ./prometheus.yml:/etc/prometheus/prometheus.yml
8-
command:
9-
- '--config.file=/etc/prometheus/prometheus.yml'
10-
- '--storage.tsdb.path=/prometheus'
11-
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
12-
- '--web.console.templates=/usr/share/prometheus/consoles'
41+
- ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
42+
# The following line can be uncommented to persist metrics data.
43+
# - gossamer-prometheus:/prometheus
44+
expose:
45+
- 9090/tcp # Prometheus metrics for Grafana
46+
47+
grafana:
48+
image: grafana/grafana-oss
1349
ports:
14-
- 9090:9090
15-
restart: always
50+
- 3000:3000/tcp # HTTP Web interface at http://localhost:3000/
51+
volumes:
52+
- ./docker/grafana/grafana.ini:/etc/grafana/grafana.ini:ro
53+
- ./docker/grafana/provisioning:/etc/grafana/provisioning:ro
54+
# The following line can be uncommented to persist modifications.
55+
# - gossamer-grafana:/var/lib/grafana
56+
57+
volumes:
58+
gossamer:
59+
gossamer-prometheus:
60+
gossamer-grafana:

docker/grafana/grafana.ini

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See https://github.com/grafana/grafana/blob/main/conf/sample.ini
2+
3+
[dashboards]
4+
min_refresh_interval = 5s
5+
default_home_dashboard_path = /etc/grafana/provisioning/dashboards/gossamer.json
6+
7+
[users]
8+
allow_sign_up = false
9+
10+
[auth.anonymous]
11+
enabled = true
12+
org_role = Admin

0 commit comments

Comments
 (0)