From 89960f0dd5ec81505c7602a1f37c1005d0ecafbb Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Fri, 21 Feb 2020 15:19:04 -0800 Subject: [PATCH] Updated Docker Compose (markdown) --- Docker-Compose.md | 66 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/Docker-Compose.md b/Docker-Compose.md index 8f27860..47adf5d 100644 --- a/Docker-Compose.md +++ b/Docker-Compose.md @@ -8,7 +8,7 @@ This page includes multiple docker-compose.yml setups for you to run. There are - [Nginx as proxy pass](#nginx-proxy-pass) - [Nginx with LetEncrypt SSL Cert](#nginx-proxy-pass-with-ssl-letencrypt) ### Metrics - - Grafana with Prometheus + - [Grafana with Prometheus](#grafana-dashboard-with-prometheus) --- # Docker Volumes @@ -173,4 +173,68 @@ nginx-ssl: environment: DEFAULT_EMAIL: info@mydomain.com NGINX_PROXY_CONTAINER: nginx +``` + +# Grafana Dashboard with Prometheus +Grafana is an awesome metric visualizer that allows you to create some awesome dashboards. We've already created a [Grafana Dashboard](https://grafana.com/grafana/dashboards/6950) that you can easy import! Checkout the [Grafana Wiki](https://github.com/hunterlong/statping/wiki/Prometheus-Exporter) and the [Prometheus Exporter Wiki](https://github.com/hunterlong/statping/wiki/Prometheus-Exporter) for more details. + +##### `prometheus.yml` config file +This file should be mounted to `/etc/prometheus/prometheus.yml` in the Prometheus container. +```yaml +global: + scrape_interval: 30s + evaluation_interval: 30s + +scrape_configs: + - job_name: 'statping' + scrape_interval: 30s + bearer_token: 'SECRET API KEY HERE' + static_configs: + - targets: ['statping:8080'] +``` +> Be sure to replace `SECRET API KEY HERE` with your API Secret on the Settings page. + +##### `docker-compose.yml` file for Statping, Grafana and Prometheus +```yaml +statping: + container_name: statping + image: hunterlong/statping + restart: always + volumes: + - statping_data:/app + environment: + DB_CONN: sqlite + LETSENCRYPT_HOST: demo.statping.com + VIRTUAL_HOST: demo.statping.com + VIRTUAL_PORT: 8080 + +prometheus: + container_name: prometheus + image: prom/prometheus:v2.0.0 + restart: always + ports: + - 9090:9090 + volumes: + - prometheus.yml:/etc/prometheus/prometheus.yml # config file is above ^ + - prometheus_data:/prometheus + links: + - statping + depends_on: + - statping + +grafana: + container_name: grafana + image: grafana/grafana + restart: always + ports: + - 3000:3000 + volumes: + - grafana_data:/var/lib/grafana + environment: + - GF_SECURITY_ADMIN_PASSWORD=password123 + - GF_USERS_ALLOW_SIGN_UP=false + depends_on: + - prometheus + links: + - prometheus ``` \ No newline at end of file