This repo will launch several containers:
- Traefik - a reverse proxy/load balancer
- Portainer - a container management system
- Prometheus - monitoring system & time series database
- Grafana - open platform for analytics and monitoring
- cadvisor - container resource usage and performance monitoring
- node-exporter - exporter for docker host machine metrics
- mailhog - Web and API based SMTP testing
In order to make use of features such as the mailhog
container, any relevant container must be connected to the
docker-stack
network - this can be performed via the Portainer interface, or by
running the following command:
docker network connect docker-stack <container name>
You must then configure your application appropriately, such as sending emails to mailhog:1025
or configuring
instrumentation in your application for collection via Prometheus.
Speaking of which...
First, add appropriate instrumentation and Prometheus exporters to your application. This could take any number of
forms depending on the project and is out of scope for this document, however once this has been configured you can
then merely add configuration to data/prometheus/prometheus.yaml
to periodically hit your monitoring endpoint
to scrape metrics:
[...]
scrape_configs:
[...]
- job_name: 'phoenix_app'
scrape_interval: 5s
static_configs:
- targets: ['docker-phoenix_app_1:4000']
Once Prometheus is successfully pulling the desired data points (you should start to see those defined by your instrumentation appearing in the Prometheus dashboard), you can begin using Grafana to create Dashboards for visualisation of your metrics.
Tool | URL | Localhost |
---|---|---|
Portainer | https://portainer.dev.localhost | https://localhost:6000 |
Prometheus | https://prometheus.dev.localhost | https://localhost:6001 |
Grafana | https://grafana.dev.localhost | https://localhost:6002 |
Mailhog | https://mailhog.dev.localhost | https://localhost:6003 |