Skip to content

Commit

Permalink
improve docker-compose for monitoring stack (#1461)
Browse files Browse the repository at this point in the history
  • Loading branch information
LesnyRumcajs authored Mar 4, 2022
1 parent a1b592a commit c54baa2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
17 changes: 7 additions & 10 deletions .maintain/monitoring/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@

1. `forest` node running locally
2. `docker` & `docker-compose` must be available in the `$PATH`
- https://docs.docker.com/engine/install/ubuntu/
- https://docs.docker.com/compose/install/
3. Ports `3000` (for `grafana`) and `9090` (for `prometheus`) have to be free.

## Run

To run the metrics stack, use the provided Docker compose file to instantiate the `prometheus` and `grafana` processes.
To run the metrics stack, use the provided Docker compose file to spawn the `prometheus` and `grafana` containers.

``` sh
# Set up directory to persist Prometheus data
$ sudo mkdir /var/lib/forest
$ sudo chmod -R 777 /var/lib/forest
$ sudo docker-compose up --build --force-recreate -d
```

This will create a `grafana` process which is preloaded with dashboards which render metrics collected by the `prometheus` process from the `forest` node running locally. The time series database managed by Prometheus will persist data to mounted volume which maps to `/var/lib/forest`on the host.
This will create a `grafana` container which is preloaded with dashboards which render metrics collected by the `prometheus` container from the `forest` node running locally. The time series database managed by Prometheus will persist data to volume `monitoring_prometheus_data`.

Once the metrics stack is running, open up the `grafana` webapp to view the predefined dashboards.
Once the metrics stack is running, open up the `grafana` webapp to view the predefined dashboards. Use the default Grafana credentials: `admin`/`admin`.

## Reload Dashboards

Assuming your user is in `docker` group.

``` sh
$ sudo docker-compose down
$ sudo docker-compose up --build --force-recreate -d
$ docker-compose up --build --force-recreate -d
```

32 changes: 17 additions & 15 deletions .maintain/monitoring/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,32 @@
# - Prometheus server
# - Grafana server

version: "3.7"
version: "3.8"

volumes:
prometheus_data: {}

services:
prometheus:
image: prom/prometheus
entrypoint:
- "/bin/prometheus"
- "--log.level=debug"
- "--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"
network_mode: host
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
volumes:
- ./prometheus/:/etc/prometheus/
- /var/lib/forest/prometheus/:/prometheus/
restart: always
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus/
network_mode: host
restart: unless-stopped

grafana:
image: grafana/grafana
user: "104"
depends_on:
- prometheus
network_mode: host
volumes:
- ./grafana/provisioning/:/etc/grafana/provisioning
- ./grafana/dashboards/:/etc/grafana/provisioning/dashboard-definitions
restart: always
network_mode: host
restart: unless-stopped

0 comments on commit c54baa2

Please sign in to comment.