Skip to content

Instantly share code, notes, and snippets.

@fabiocruzcoelho
Created December 21, 2017 17:57
Show Gist options
  • Save fabiocruzcoelho/6b35c7f6a32dfa86b2e169d9c123fa5d to your computer and use it in GitHub Desktop.
Save fabiocruzcoelho/6b35c7f6a32dfa86b2e169d9c123fa5d to your computer and use it in GitHub Desktop.
# docker-compose.yml com traefik para cluster docker swarm
version: "3"
services:
grafana:
image: monitoringartist/grafana-xxl:latest
ports:
- "3000:3000"
networks:
- traefik-net
volumes:
- /data-docker/grafana:/var/lib/grafana
# service deployment
deploy:
mode: replicated
replicas: 1
labels:
- "traefik.port=3000"
- "traefik.docker.network=traefik-net"
- "traefik.frontend.rule=Host:grafana.doman.com.br"
- "traefik.backend.loadbalancer.sticky=true"
# service resource management
resources:
# Hard limit - Docker does not allow to allocate more
limits:
cpus: '0.25'
memory: 512M
# Soft limit - Docker makes best effort to return to it
reservations:
cpus: '0.25'
memory: 256M
# service restart policy
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# service update configuration
update_config:
parallelism: 2
delay: 10s
failure_action: continue
monitor: 60s
max_failure_ratio: 0.3
# placement constraint - in this case on 'worker' nodes only
placement:
constraints: [node.role == manager]
networks:
traefik-net:
driver: overlay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment