Skip to content

Commit

Permalink
feat(docker): docker-compose.yml to run Gossamer, Prometheus and Grafana
Browse files Browse the repository at this point in the history
- Tailor docker-compose.yml for local development
- Add Gossamer to `docker-compose.yml`
- Add Grafana to `docker-compose.yml`
- Move prometheus.yml to `docker/prometheus/`
- 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
  • Loading branch information
qdm12 committed Jul 26, 2022
1 parent 33ec0ac commit ea638c4
Show file tree
Hide file tree
Showing 10 changed files with 1,390 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.githooks
/.github
!/.github/workflows/staging
/docker
/docs
/.deepsource.toml
/.dockerignore
Expand All @@ -12,5 +13,4 @@
/docker-compose.yml
/Dockerfile
/Dockerfile.staging
/prometheus.yml
/README.md
65 changes: 55 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,60 @@
version: '3.7'
# This docker-compose.yml configuration contains:
# - a Gossamer node on the Kusama chain
# - a Prometheus server scrapping metrics from Gossamer
# - a Grafana server using the Prometheus server as source
#
# Prometheus and Grafana are both provisioned to give you a dashboard to play with.
# They are tailored for local development, and Grafana gives you anonymous admin access.
#
# You can run all of the containers with: `docker-compose up`
# Alternatively, you can run select containers with for example: `docker-compose up gossamer`
#
# To rebuild the Gossamer Docker image: `docker-compose build`

version: '3'

services:
gossamer:
image: chainsafe/gossamer
build: .
volumes:
# Remove with: docker volume rm gossamer
- gossamer:/data/gossamer
command:
- --basepath=/data/gossamer
- --chain=kusama
- --log=info
- --publish-metrics
- --metrics-address=:9876
- --pprofserver
ports:
- 6060:6060/tcp # Pprof server
- 7001:7001/tcp # Network port
- 8545:8545/tcp # RPC HTTP port
- 8546:8546/tcp # RPC Websocket port
expose:
- 9876/tcp # Prometheus metrics for Prometheus server

services:
prometheus:
image: prom/prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
- '--web.console.templates=/usr/share/prometheus/consoles'
- ./docker/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
# The following line can be uncommented to persist metrics data.
# - gossamer-prometheus:/prometheus
expose:
- 9090/tcp # Prometheus metrics for Grafana

grafana:
image: grafana/grafana-oss
ports:
- 9090:9090
restart: always
- 3000:3000/tcp # HTTP Web interface at http://localhost:3000/
volumes:
- ./docker/grafana/grafana.ini:/etc/grafana/grafana.ini:ro
- ./docker/grafana/provisioning:/etc/grafana/provisioning:ro
# The following line can be uncommented to persist modifications.
# - gossamer-grafana:/var/lib/grafana

volumes:
gossamer:
gossamer-prometheus:
gossamer-grafana:
12 changes: 12 additions & 0 deletions docker/grafana/grafana.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# See https://github.com/grafana/grafana/blob/main/conf/sample.ini

[dashboards]
min_refresh_interval = 5s
default_home_dashboard_path = /etc/grafana/provisioning/dashboards/gossamer.json

[users]
allow_sign_up = false

[auth.anonymous]
enabled = true
org_role = Admin
Loading

0 comments on commit ea638c4

Please sign in to comment.