-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathdocker-compose.yml
174 lines (163 loc) · 6.22 KB
/
docker-compose.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
###########################################################################
# Storing EventStoreDB logs into ElasticSearch with Filebeat and Logstash
###########################################################################
# DISCLAIMER: This configuration is presented as docker-compose
# to simplify the developer environment setup.
# It aims to give the quick option to play with Elastic setup.
# It's NOT recommended to run setup through docker-compose on production.
###########################################################################
# map logs to disk location and share between containers
x-eventstore-volume-logs:
&eventstore-volume-logs
type: bind
source: ./logs
target: /var/log/eventstore
version: "3.8"
services:
#######################################################
# EventStoreDB
#######################################################
eventstoredb:
image: eventstore/eventstore:21.10.2-buster-slim
container_name: eventstoredb
# use this image if you're running ARM-based proc like Apple M1
# image: ghcr.io/eventstore/eventstore:21.10.0-alpha-arm64v8
environment:
- EVENTSTORE_CLUSTER_SIZE=1
- EVENTSTORE_RUN_PROJECTIONS=All
- EVENTSTORE_START_STANDARD_PROJECTIONS=true
- EVENTSTORE_EXT_TCP_PORT=1113
- EVENTSTORE_HTTP_PORT=2113
- EVENTSTORE_INSECURE=true
- EVENTSTORE_ENABLE_EXTERNAL_TCP=true
- EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=true
ports:
- '1113:1113'
- '2113:2113'
restart: unless-stopped
volumes:
- type: volume
source: eventstore-volume-data
target: /var/lib/eventstore
# external volume to be able to share EventStoreDB logs
# with Filebeat image
- <<: *eventstore-volume-logs
networks:
- esdb_network
#######################################################
# Filebeat to harvest logs from event store logs
#######################################################
filebeat:
# required to have a proper access to config file on Windows
entrypoint: "filebeat -e -strict.perms=false"
container_name: file_beat
image: docker.elastic.co/beats/filebeat:8.2.0
networks:
- es_network
# make sure that Filebeat is restarted
# in case ElasticSearch or EventStoreDB
# were not available yet
restart: unless-stopped
volumes:
# add Filebeat config file
- "./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro"
# get access to EventStoreDB logs through shared external volume
- <<: *eventstore-volume-logs
depends_on:
- eventstoredb
- logstash
#######################################################
# Logstash for more advanced log pipelines
# e.g. filtering, transformations, etc.
# this will split stats and regular logs
#######################################################
logstash:
# required to have a proper access to config file on windows
container_name: logstash
image: docker.elastic.co/logstash/logstash:8.2.0
networks:
- es_network
restart: unless-stopped
volumes:
# add Logstash config file
- "./logstash.conf:/usr/share/logstash/pipeline/logstash.conf:ro"
# make sure that LogStash is restarted
# in case ElasticSearch was not available yet
depends_on:
- elasticsearch
#######################################################
# Elastic Search to store logs
#######################################################
elasticsearch:
container_name: elasticsearch
image: docker.elastic.co/elasticsearch/elasticsearch:8.2.0
environment:
- discovery.type=single-node
- xpack.security.enabled=false
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elastic-data:/usr/share/elasticsearch/data
restart: unless-stopped
ports:
- "9200:9200"
- "9300:9300"
networks:
- es_network
healthcheck:
test:
[
"CMD-SHELL",
"curl --fail http://localhost:9200 || exit 1",
]
interval: 10s
timeout: 10s
retries: 120
#######################################################
# Kibana to browse logs
#######################################################
kibana:
container_name: kibana
image: docker.elastic.co/kibana/kibana:8.2.0
environment:
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
restart: unless-stopped
ports:
- "5601:5601"
networks:
- es_network
depends_on:
- elasticsearch
healthcheck:
test:
[
"CMD-SHELL",
"curl --fail http://localhost:5601 || exit 1",
]
interval: 10s
timeout: 10s
retries: 120
#######################################################
# Call curl once Kibana was started
# to create Kibana Data Views for ESDB logs
#######################################################
initializer:
image: curlimages/curl
restart: on-failure
depends_on:
- kibana
networks:
- es_network
command: ["sh","-c","sleep 1 && curl --fail -X POST 'kibana:5601/api/index_patterns/index_pattern' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'{ \"index_pattern\": { \"title\": \"eventstoredb-stats\" } }' && curl --fail -X POST 'kibana:5601/api/index_patterns/index_pattern' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'{ \"index_pattern\": { \"title\": \"eventstoredb-logs\" } }' || exit 1"]
networks:
es_network:
driver: bridge
esdb_network:
driver: bridge
volumes:
eventstore-volume-data:
elastic-data: