-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-elk.yaml
94 lines (88 loc) · 2.26 KB
/
docker-compose-elk.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
version: '3.7'
services:
# Elasticsearch - db
elasticsearch:
image: elasticsearch:7.16.1
container_name: elastic
mem_limit: 2000M
mem_reservation: 2000M
environment:
discovery.type: single-node
ES_JAVA_OPTS: "-Xms512M -Xmx1g"
ports:
- "9200:9200"
- "9300:9300"
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 10s
timeout: 10s
retries: 3
networks:
- elastic
volumes:
- logs-elasticsearch:/usr/share/elasticsearch/data
# Kibana - dashboard
kibana:
image: kibana:7.16.1
container_name: kibana
mem_limit: 1024M
mem_reservation: 1024M
ports:
- "5601:5601"
depends_on:
elasticsearch:
condition: service_healthy
networks:
- elastic
environment:
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:5601/api/task_manager/_health || exit 1"]
interval: 10s
timeout: 10s
retries: 5
# Filebeat - log collector sidecar
filebeat:
image: docker.elastic.co/beats/filebeat-oss:7.16.1
container_name: filebeat
volumes:
- logs-chg-service:/logs # -> reads logs from these files
- ./docker/filebeat/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
networks:
- elastic
depends_on:
- elasticsearch
- kibana
command: ["--strict.perms=false", "-c", "/usr/share/filebeat/filebeat.yml"] # security disabled for test env
# User service
change_machine_service:
container_name: changemachine
depends_on:
- filebeat
build:
context: .
dockerfile: Dockerfile
ports:
- "3003:3003"
networks:
- elastic
environment:
- SRV_HOST=0.0.0.0
- SRV_PORT=3003
- SRV_PREFIX=
- SRV_LOG_FILE=/logs/fastapi.ndjson # <- writes logs to this file
healthcheck:
test:
- CMD-SHELL
- python -c 'import httpx; r = httpx.get("http://localhost:3003/health"); r.raise_for_status()'
interval: 10s
timeout: 5s
volumes:
- logs-chg-service:/logs
networks:
elastic:
name: changemachinenet
driver: bridge
volumes:
logs-chg-service:
logs-elasticsearch: