Skip to content

Commit 3052be1

Browse files
committed
Prepare docker-compose services (Elasticsearch, Logstash, Kibana)
1 parent 4cc5579 commit 3052be1

2 files changed

Lines changed: 77 additions & 0 deletions

File tree

docker/.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
COMPOSE_PROJECT_NAME=spring_boot_kibana_demo
2+
ELK_VERSION=7.6.1
3+
4+
# Note that there is currently no known way to change the default Elasticsearch username!
5+
ELASTIC_USER=elastic
6+
ELASTIC_PASSWORD=changeme

docker/docker-compose.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
version: '3.2'
2+
services:
3+
elasticsearch:
4+
image: elasticsearch:$ELK_VERSION
5+
volumes:
6+
- elasticsearch:/usr/share/elasticsearch/data
7+
environment:
8+
ES_JAVA_OPTS: "-Xmx256m -Xms256m"
9+
# Note: currently there doesn't seem to be a way to change the default user for Elasticsearch
10+
ELASTIC_PASSWORD: $ELASTIC_PASSWORD
11+
# Use single node discovery in order to disable production mode and avoid bootstrap checks
12+
# see https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html
13+
discovery.type: single-node
14+
# X-Pack security needs to be enabled for Elasticsearch to actually authenticate requests
15+
xpack.security.enabled: "true"
16+
ports:
17+
- "9200:9200"
18+
- "9300:9300"
19+
healthcheck:
20+
test: "wget -q -O - http://$ELASTIC_USER:$ELASTIC_PASSWORD@localhost:9200/_cat/health"
21+
interval: 1s
22+
timeout: 30s
23+
retries: 300
24+
networks:
25+
- internal
26+
restart: unless-stopped
27+
# https://www.elastic.co/guide/en/logstash/current/docker-config.html
28+
logstash:
29+
image: logstash:$ELK_VERSION
30+
ports:
31+
- "5000:5000"
32+
- "9600:9600"
33+
environment:
34+
LS_JAVA_OPTS: "-Xmx256m -Xms256m"
35+
ELASTIC_USER: $ELASTIC_USER
36+
ELASTIC_PASSWORD: $ELASTIC_PASSWORD
37+
XPACK_MONITORING_ELASTICSEARCH_USERNAME: $ELASTIC_USER
38+
XPACK_MONITORING_ELASTICSEARCH_PASSWORD: $ELASTIC_PASSWORD
39+
XPACK_MONITORING_ELASTICSEARCH_HOSTS: "elasticsearch:9200"
40+
XPACK_MONITORING_ENABLED: "true"
41+
volumes:
42+
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro
43+
networks:
44+
- internal
45+
restart: unless-stopped
46+
depends_on:
47+
- elasticsearch
48+
49+
# https://www.elastic.co/guide/en/kibana/current/docker.html
50+
kibana:
51+
image: kibana:${ELK_VERSION}
52+
environment:
53+
ELASTICSEARCH_USERNAME: $ELASTIC_USER
54+
ELASTICSEARCH_PASSWORD: $ELASTIC_PASSWORD
55+
# Because Elasticsearch is running in a containerized environment
56+
# (setting this to false will result in CPU stats not being correct in the Monitoring UI):
57+
XPACK_MONITORING_UI_CONTAINER_ELASTICSEARCH_ENABLED: "true"
58+
ports:
59+
- "5601:5601"
60+
networks:
61+
- internal
62+
restart: unless-stopped
63+
depends_on:
64+
- elasticsearch
65+
- logstash
66+
67+
networks:
68+
internal:
69+
70+
volumes:
71+
elasticsearch:

0 commit comments

Comments
 (0)