Skip to content

Instantly share code, notes, and snippets.

@lorello
Created August 22, 2023 14:48
Show Gist options
  • Select an option

  • Save lorello/3fa77038f79ed710f9198e77b7586aad to your computer and use it in GitHub Desktop.

Select an option

Save lorello/3fa77038f79ed710f9198e77b7586aad to your computer and use it in GitHub Desktop.
Logging su ElasticSearch da docker swarm
version: '3.8'
services:
elastic-firenze:
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
networks:
- internal
environment:
- node.name=es01
#- cluster.name=es-docker-cluster
#- discovery.seed_hosts=es02,es03
#- cluster.initial_master_nodes=es01,es02,es03
- discovery.type=single-node
- bootstrap.memory_lock=true
- xpack.security.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- es01:/usr/share/elasticsearch/data
ports:
- 9200:9200
kibana-firenze:
image: docker.elastic.co/kibana/kibana:7.17.4
networks:
- traefik_public
- internal
environment:
# Config reference https://www.elastic.co/guide/en/kibana/master/settings.html
- ELASTICSEARCH_HOSTS=http://elastic-firenze:9200
- SERVER_PUBLICBASEURL=https://elastic-firenze.swarm.aaahoy.com
deploy:
update_config:
parallelism: 1
order: start-first
delay: 10s
failure_action: rollback
monitor: 300s
rollback_config:
parallelism: 1
delay: 10s
failure_action: pause # default: pause or continue
monitor: 300s # default: 5s
order: start-first
restart_policy:
condition: any
delay: 20s # default: 5s, between attempts
max_attempts: 50
window: 300s # time to decide if the restart has been sucessfull
resources:
reservations:
#cpus: '0.1'
memory: 64M
limits:
cpus: '0.2'
memory: 2048M
labels:
traefik.enable: 'true'
traefik.docker.network: "traefik_public"
traefik.http.services.elastic-firenze.loadbalancer.server.port: 5601
#traefik.http.services.elastic-firenze.loadbalancer.healthcheck.path: /status
#traefik.http.services.elastic-firenze.loadbalancer.healthcheck.interval: 30s
traefik.http.routers.elastic-firenze.rule: 'Host(`elastic-firenze.swarm.aaahoy.com`)'
traefik.http.routers.elastic-firenze.entrypoints: 'https'
volumes:
es01:
networks:
traefik_public:
external: true
internal:
driver: overlay
version: "3.8"
services:
whoami:
image: containous/whoami
networks:
- traefik_public
- internal
#ports:
# - 9080:80
deploy:
labels:
# traefik common
- traefik.enable=true
- traefik.docker.network=traefik_public
- "traefik.http.routers.whoami.rule=Host(`whoami.swarm.aaahoy.com`)"
- "traefik.http.routers.whoami.entrypoints=https"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
varnish:
image: registry.gitlab.com/opencontent/varnish
logging:
driver: elastic/elastic-logging-plugin:8.9.1
options:
# ogni nodo docker ha questo ip per definizione
hosts: "http://172.18.0.1:9200"
# user: elastic
# password: elastic_password
index: "elastic-log-driver-%{+yyyy.MM.dd}"
depends_on:
- whoami
#ports:
# - 9081:80
networks:
- traefik_public
- internal
- lel_internal
#volumes:
#- /srv/data/varnish/default.vcl:/etc/varnish/default.vcl
environment:
VARNISH_BACKEND_HOST: 'whoami'
VARNISH_BACKEND_PORT: '80'
VARNISH_BACKEND_PROBE_URL: '/health'
VARNISH_BACKEND_PROBE_THRESHOLD: 2
VARNISH_BACKEND_PROBE_WINDOW: 3
VARNISHD_MEMORY_SIZE: '16m'
VARNISH_SECRET: 'sssshhhh'
deploy:
labels:
- traefik.enable=true
- traefik.docker.network=traefik_public
- "traefik.http.routers.varnish.rule=Host(`varnish.swarm.aaahoy.com`)"
- "traefik.http.routers.varnish.entrypoints=https"
- "traefik.http.services.varnish.loadbalancer.server.port=6081"
networks:
traefik_public:
external: true
internal:
driver: overlay
lel_internal:
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment