Skip to content

Instantly share code, notes, and snippets.

@gesellix
Forked from cdelaitre/docker-compose-tick.yml
Created June 27, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gesellix/4138009de7a7df968cf2cb337742fbb9 to your computer and use it in GitHub Desktop.
Save gesellix/4138009de7a7df968cf2cb337742fbb9 to your computer and use it in GitHub Desktop.
Monitor Docker Swarm with TICK InfluxData Stack
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
# Kapacitor requires network access to Influxdb
depends_on:
- influxdb
# BACK
telegraf:
# Full tag list: https://hub.docker.com/r/library/telegraf/tags/
image: telegraf
environment:
HOSTNAME: "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:
@gesellix
Copy link
Author

(from https://gist.github.com/cdelaitre/85949d8b697359a319e30a678e23d8bd#gistcomment-2131758)

Requirements

  • a docker swarm with n managers, p workers

1/ Prepare configuration files

2/ Copy and Run the stack

  • on a manager :
    • copy the above file docker-compose-tick.yml
    • run command :

docker stack deploy --compose-file docker-compose-tick.yml tick

3/ Set up

Caution

  • influxdb and kapacitor components are not clustered

@Olegt0rr
Copy link

Olegt0rr commented Apr 13, 2022

Since remote cfg is available for telegraf, how to avoid hardcoding of node names?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment