|
version: "3" |
|
|
|
services: |
|
proxy: |
|
image: traefik:v2.3 |
|
container_name: "traefik" |
|
volumes: |
|
- ./traefik/traefik.yml:/etc/traefik/traefik.yml |
|
- /var/run/docker.sock:/var/run/docker.sock:ro |
|
ports: |
|
- "80:80" |
|
- "8080:8080" |
|
- "1883:1883" |
|
networks: |
|
- iotstack # create using `docker network create iotstack` |
|
|
|
grafana: |
|
image: grafana/grafana |
|
container_name: "grafana" |
|
volumes: |
|
- grafana_data:/var/lib/grafana |
|
networks: |
|
- iotstack |
|
environment: |
|
- GF_SERVER_PROTOCOL=http |
|
# we serve the grafana dashboards as: http://<My_IP_ADDRESS>/grafana |
|
- GF_SERVER_ROOT_URL=http://127.0.0.1:3000/grafana |
|
# This Environment Variable provides the complete frontend as sub path when using path prefix |
|
- GF_SERVER_SERVE_FROM_SUB_PATH=true |
|
labels: |
|
# enable Grafana for Reverse Proxy |
|
- "traefik.enable=true" |
|
- "traefik.docker.network=iotstack" |
|
# Serve Grafana as a Path Prefix i.e. http://<IP>/grafana |
|
- "traefik.http.routers.grafana-router.rule=PathPrefix(`/grafana`)" |
|
# via the HTTP (port 80) entrypoint |
|
- "traefik.http.routers.grafana-router.entryPoints=web" |
|
# add a middleware to strip the prefix `/grafana` once the URL is hit |
|
- "traefik.http.routers.grafana-router.middlewares=grafana-mw" |
|
- "traefik.http.middlewares.grafana-mw.stripprefix.prefixes=/grafana" |
|
- "traefik.http.routers.grafana-router.service=grafana" |
|
- "traefik.http.services.grafana.loadbalancer.server.port=3000" |
|
|
|
influxdb: |
|
image: influxdb |
|
container_name: "influxdb" |
|
volumes: |
|
- influxdb_data:/var/lib/influxdb |
|
networks: |
|
- iotstack |
|
labels: |
|
# Currently InfluxDB's HTTP Endpoint is unable via POSTMAN |
|
# Need to check this! (disable for now) |
|
- "traefik.enable=true" |
|
- "traefik.docker.network=iotstack" |
|
- "traefik.http.routers.influxdb-router.rule=PathPrefix(`/influxdb`)" |
|
- "traefik.http.routers.influxdb-router.entrypoints=web" |
|
# Not sure if Middleware is needed |
|
- "traefik.http.routers.influxdb-router.middlewares=influxdb-mw" |
|
- "traefik.http.middlewares.influxdb-mw.stripprefix.prefixes=/influxdb" |
|
- "traefik.http.routers.influxdb-router.service=influxdb" |
|
- "traefik.http.services.influxdb.loadbalancer.server.port=8086" |
|
|
|
mosquitto: |
|
image: eclipse-mosquitto |
|
container_name: "mosquitto" |
|
networks: |
|
- iotstack |
|
restart: always |
|
volumes: |
|
- mosquitto_data:/mosquitto/ |
|
labels: |
|
- "traefik.enable=true" |
|
- "traefik.docker.network=iotstack" |
|
# Entrypoint via MQTT port (1883) |
|
- "traefik.tcp.routers.mqtt-router.entrypoints=mqtt" |
|
# See Docs: https://doc.traefik.io/traefik/routing/routers/#rule_1 |
|
- "traefik.tcp.routers.mqtt-router.rule=HostSNI(`*`)" |
|
- "traefik.tcp.routers.mqtt-router.service=mosquitto" |
|
- "traefik.tcp.services.mosquitto.loadbalancer.server.port=1883" |
|
|
|
telegraf: |
|
image: telegraf |
|
container_name: "telegraf" |
|
links: |
|
- influxdb |
|
volumes: |
|
- ./telegraf/telegraf.tiguitto.toml:/etc/telegraf/telegraf.conf:ro |
|
networks: |
|
- iotstack |
|
labels: |
|
- "traefik.enable=false" |
|
|
|
networks: |
|
iotstack: |
|
external: true |
|
|
|
volumes: |
|
grafana_data: |
|
influxdb_data: |
|
mosquitto_data: |