Skip to content

Instantly share code, notes, and snippets.

@mcwnuq
Created August 21, 2019 17:56
Show Gist options
  • Save mcwnuq/1add9795f50927315a3eb4b71f2b720e to your computer and use it in GitHub Desktop.
Save mcwnuq/1add9795f50927315a3eb4b71f2b720e to your computer and use it in GitHub Desktop.
version: '3'
services:
# Define a Telegraf service
telegraf:
image: telegraf:1.4.0
volumes:
- ./etc/telegraf.conf:/etc/telegraf/telegraf.conf:ro
links:
- influxdb
ports:
- "8092:8092/udp"
- "8094:8094"
- "8125:8125/udp"
# Define an InfluxDB service
influxdb:
image: influxdb:1.3.5
volumes:
- ./data/influxdb:/var/lib/influxdb
ports:
- "8086:8086"
# Define a Chronograf service
chronograf:
image: chronograf:1.3.8
environment:
INFLUXDB_URL: http://influxdb:8086
KAPACITOR_URL: http://kapacitor:9092
ports:
- "8888:8888"
links:
- influxdb
- kapacitor
# Define a Kapacitor service
kapacitor:
image: kapacitor:1.3.3
environment:
KAPACITOR_HOSTNAME: kapacitor
KAPACITOR_INFLUXDB_0_URLS_0: http://influxdb:8086
links:
- influxdb
ports:
- "9092:9092"
# Define a service for using the influx CLI tool.
# docker-compose run influxdb-cli
influxdb-cli:
image: influxdb:1.3.5
entrypoint:
- influx
- -host
- influxdb
links:
- influxdb
# Define a service for using the kapacitor CLI tool.
# docker-compose run kapacitor-cli
kapacitor-cli:
image: kapacitor:1.3.3
entrypoint: bash
environment:
KAPACITOR_URL: http://kapacitor:9092
links:
- kapacitor
version: '3'
services:
# FRONT
chronograf:
# Full tag list: https://hub.docker.com/r/library/chronograf/tags/
image: chronograf
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
volumes:
# Mount for chronograf database
- chronograf-data:/var/lib/chronograf
ports:
# The WebUI for Chronograf is served on port 8888
- "8888:8888"
networks:
- influx
depends_on:
- kapacitor
- influxdb
# MIDDLE
kapacitor:
# Full tag list: https://hub.docker.com/r/library/kapacitor/tags/
image: kapacitor
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
volumes:
# Mount for kapacitor data directory
- kapacitor-data:/var/lib/kapacitor
# Mount for kapacitor configuration
- /etc/kapacitor/config:/etc/kapacitor
ports:
# The API for Kapacitor is served on port 9092
- "9092:9092"
networks:
- influx
depends_on:
- influxdb
# BACK
telegraf:
# Full tag list: https://hub.docker.com/r/library/telegraf/tags/
image: telegraf
deploy:
mode: global
restart_policy:
condition: on-failure
volumes:
# Mount for telegraf configuration
- /etc/telegraf:/etc/telegraf
# Mount for Docker API access
- /var/run/docker.sock:/var/run/docker.sock
networks:
- influx
depends_on:
- influxdb
# DATABASE
influxdb:
# Full tag list: https://hub.docker.com/r/library/influxdb/tags/
image: influxdb
deploy:
replicas: 1
placement:
constraints:
- node.role == manager
restart_policy:
condition: on-failure
volumes:
# Mount for influxdb data directory
- influxdb-data:/var/lib/influxdb
# Mount for influxdb configuration
- /etc/influxdb/config:/etc/influxdb
ports:
# The API for InfluxDB is served on port 8086
- "8086:8086"
networks:
- influx
networks:
influx:
volumes:
chronograf-data:
kapacitor-data:
influxdb-data:
influxdb:
image: influxdb:latest
container_name: influxdb
ports:
- "8083:8083"
- "8086:8086"
- "8090:8090"
volumes:
# Data persistency
# sudo mkdir -p /srv/docker/influxdb/data
- /srv/docker/influxdb/data:/var/lib/influxdb
telegraf:
image: telegraf:latest
container_name: telegraf
links:
- influxdb
volumes:
- ./telegraf.conf:/etc/telegraf/telegraf.conf:ro
grafana:
image: grafana/grafana:latest
container_name: grafana
ports:
- "3000:3000"
env_file:
- 'env.grafana'
links:
- influxdb
volumes:
# sudo mkdir -p /srv/docker/grafana/data; chown 472:472 /srv/docker/grafana/data
- /srv/docker/grafana/data:/var/lib/grafana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment