feat(traefik): add traefik annotation

This commit is contained in:
nyyu 2022-04-24 10:38:47 +02:00
parent 40d9875388
commit bf23c5b182
2 changed files with 31 additions and 9 deletions

View file

@ -11,13 +11,16 @@
## Prerequisites
* docker
* docker compose
* traefik with network
## Steps
1. Create .env file
> EXTERNAL_IP=XXX.XXX.XXX.XXX
>
> GRAFANA_PASSWORD=SECURE_PASSWORD
```bash
GRAFANA_PASSWORD=SECURE_PASSWORD
HOST_SUFFIX=xxx.local
TZ=Europe/Paris
```
2. Copy alertmanager.tmpl to alertmanager.yml
* Set telegram bot_token and chat_id

View file

@ -3,6 +3,8 @@ version: '3.8'
networks:
monitoring:
driver: bridge
traefik:
external: true
services:
grafana:
@ -21,8 +23,13 @@ services:
- GF_USERS_ALLOW_SIGN_UP=false
networks:
- monitoring
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.grafana.rule=Host(`grafana.${HOST_SUFFIX}`)"
- "traefik.http.routers.grafana.entrypoints=web"
prometheus:
image: prom/prometheus
image: prom/prometheus:v2.35.0
container_name: prometheus
restart: unless-stopped
volumes:
@ -36,30 +43,42 @@ services:
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.enable-lifecycle'
- "--web.external-url=http://${EXTERNAL_IP}:9090"
- "--web.external-url=http://prometheus.${HOST_SUFFIX}"
expose:
- 9090
networks:
- monitoring
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.prometheus.rule=Host(`prometheus.${HOST_SUFFIX}`)"
- "traefik.http.routers.prometheus.entrypoints=web"
alertmanager:
image: prom/alertmanager
image: prom/alertmanager:v0.24.0
container_name: alertmanager
restart: unless-stopped
volumes:
- ./conf/alertmanager:/etc/alertmanager
- ./data/alertmanager:/alertmanager
environment:
- TZ=${TZ}
ports:
- 9093:9093
command:
- '--config.file=/etc/alertmanager/alertmanager.yml'
- '--storage.path=/alertmanager'
- "--web.external-url=http://${EXTERNAL_IP}:9093"
- "--web.external-url=http://alertmanager.${HOST_SUFFIX}"
expose:
- 9093
networks:
- monitoring
- traefik
labels:
- "traefik.enable=true"
- "traefik.http.routers.alertmanager.rule=Host(`alertmanager.${HOST_SUFFIX}`)"
- "traefik.http.routers.alertmanager.entrypoints=web"
node-exporter:
image: prom/node-exporter
image: prom/node-exporter:v1.3.1
container_name: node-exporter
restart: unless-stopped
volumes:
@ -76,7 +95,7 @@ services:
networks:
- monitoring
blackbox_exporter:
image: prom/blackbox-exporter
image: prom/blackbox-exporter:v0.20.0
container_name: blackbox
restart: unless-stopped
expose: