-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathdocker-compose-elastic.yml
157 lines (145 loc) · 4.86 KB
/
docker-compose-elastic.yml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# This is a Docker Compose file that runs a local Elastic Stack comprised of
# Elasticsearch, Kibana and Elastic Distribution of OpenTelemetry (EDOT)
# Collector.
name: elastic-stack
configs:
# This is the minimal yaml configuration needed to listen on all interfaces
# for OTLP logs, metrics and traces, exporting to Elasticsearch.
edot-collector-config:
content: |
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
connectors:
elasticapm:
processors:
elastictrace:
exporters:
elasticsearch:
endpoint: http://elasticsearch:9200
user: elastic
password: elastic
mapping:
mode: otel
logs_dynamic_index:
enabled: true
metrics_dynamic_index:
enabled: true
traces_dynamic_index:
enabled: true
flush:
interval: 1s # improve responsiveness in example apps (default 30s)
service:
pipelines:
traces:
receivers: [otlp]
processors: [elastictrace]
exporters: [elasticapm, elasticsearch]
metrics:
receivers: [otlp]
processors: []
exporters: [elasticsearch]
metrics/aggregated:
receivers: [elasticapm]
processors: []
exporters: [elasticsearch]
logs:
receivers: [otlp]
processors: []
exporters: [elasticapm, elasticsearch]
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.0
container_name: elasticsearch
ports:
- 9200:9200
environment:
- node.name=elasticsearch
- cluster.name=docker-cluster
- discovery.type=single-node
- ELASTIC_PASSWORD=elastic
- bootstrap.memory_lock=true
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=false
- xpack.security.transport.ssl.enabled=false
- xpack.license.self_generated.type=trial
# Note that ELSER is recommended to have 2GB, but it is JNI (PyTorch).
# So, ELSER's memory is in addition to the heap and other overhead.
- ES_JAVA_OPTS=-Xms2g -Xmx2g
ulimits:
memlock:
soft: -1
hard: -1
healthcheck:
test: # readiness probe taken from kbn-health-gateway-server script
[
"CMD-SHELL",
"curl --max-time 1 -s http://localhost:9200 | grep -q 'missing authentication credentials'",
]
start_period: 10s
interval: 1s
timeout: 10s
retries: 120
elasticsearch_settings:
depends_on:
elasticsearch:
condition: service_healthy
image: docker.elastic.co/elasticsearch/elasticsearch:9.0.0
container_name: elasticsearch_settings
restart: 'no'
# gen-ai assistants in kibana save state in a way that requires system
# access, so set kibana_system's password to a known value.
command: >
bash -c '
echo "Setup the kibana_system password";
until curl --max-time 1 -s -u "elastic:elastic" \
-X POST http://elasticsearch:9200/_security/user/kibana_system/_password \
-d "{\"password\":\"elastic\"}" \
-H "Content-Type: application/json" | grep -q "^{}"; do sleep 5; done;
'
kibana:
image: docker.elastic.co/kibana/kibana:9.0.0
container_name: kibana
depends_on:
elasticsearch_settings:
condition: service_completed_successfully
ports:
- 5601:5601
environment:
- SERVERNAME=kibana
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
- ELASTICSEARCH_USERNAME=kibana_system
- ELASTICSEARCH_PASSWORD=elastic
# Non-default settings from here:
# https://github.com/elastic/apm-server/blob/main/testing/docker/kibana/kibana.yml
- MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED=true
- XPACK_SECURITY_ENCRYPTIONKEY=fhjskloppd678ehkdfdlliverpoolfcr
- XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY=fhjskloppd678ehkdfdlliverpoolfcr
- SERVER_PUBLICBASEURL=http://127.0.0.1:5601
healthcheck:
test: ["CMD-SHELL", "curl --max-time 1 -s http://localhost:5601/api/status | grep -q 'available'"]
retries: 300
interval: 1s
otel-collector:
image: docker.elastic.co/elastic-agent/elastic-otel-collector:9.0.0
container_name: otel-collector
depends_on:
elasticsearch:
condition: service_healthy
command: [
"--config=/etc/otelcol-contrib/config.yaml",
]
configs:
- source: edot-collector-config
target: /etc/otelcol-contrib/config.yaml
ports:
- "4317:4317" # grpc
- "4318:4318" # http
healthcheck:
test: ["CMD-SHELL", "bash -c 'echo -n > /dev/tcp/127.0.0.1/4317'"]
retries: 300
interval: 1s