-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
95 lines (90 loc) · 3.34 KB
/
Copy pathdocker-compose.yml
File metadata and controls
95 lines (90 loc) · 3.34 KB
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
---
version: '3'
services:
# The environment variable "TAG" is used throughout this file to
# specify the version of the images to run. The default is set in the
# '.env' file in this folder. It can be overridden with any normal
# technique for setting environment variables, for example:
#
# TAG=6.1.0-beta1 docker-compose up
#
# REF: https://docs.docker.com/compose/compose-file/#variable-substitution
#
# Also be sure to set the ELASTIC_VERSION variable. For released versions,
# ${TAG} and ${ELASTIC_VERSION} will be identical, but for pre-release
# versions, ${TAG} might contain an extra build identifier, like
# "6.1.0-beta1-3eab5b40", so a full invocation might look like:
#
# ELASTIC_VERSION=6.1.0-beta1 TAG=6.1.0-beta1-3eab5b40 docker-compose up
#
# Official Ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
# Docker Images: https://www.docker.elastic.co/
elasticsearch:
env_file:
- .env
image: docker.elastic.co/elasticsearch/elasticsearch:${TAG}
container_name: elk_elasticsearch
environment:
- 'cluster.name=monitoring'
- 'node.name=${ELASTIC_HOST_NAME}'
- 'network.bind_host=0.0.0.0'
- 'network.publish_host=${ELASTIC_HOST_IP}'
- 'bootstrap.memory_lock=true'
- 'discovery.zen.ping.unicast.hosts=${ELASTIC_CLUSTER}'
- 'discovery.zen.minimum_master_nodes=1'
- 'ELASTIC_PASSWORD=${ELASTIC_PASSWORD}'
- 'ES_JAVA_OPTS=-Xms2g -Xmx2g'
cap_add:
- IPC_LOCK
ulimits:
memlock:
soft: -1
hard: -1
ports: ['9200:9200','9300:9300']
volumes:
- ./data/elasticsearch:/usr/share/elasticsearch/data
kibana:
image: docker.elastic.co/kibana/kibana:${TAG}
container_name: elk_kibana
environment:
- ELASTICSEARCH_USERNAME=kibana
- ELASTICSEARCH_PASSWORD=${ELASTIC_PASSWORD}
ports: ['5601:5601']
depends_on: ['elasticsearch']
logstash:
image: docker.elastic.co/logstash/logstash:${TAG}
container_name: elk_logstash
environment:
- 'LS_HEAP_SIZE=2048m'
- 'xpack.monitoring.elasticsearch.password=${ELASTIC_PASSWORD}'
- 'xpack.security.enabled=true'
command: 'logstash -f /config-dir/logstash.conf -l /logs'
ports: ['5000:5000']
volumes:
- ./config/logstash:/config-dir
- ./data/logstash/logs:/logs
depends_on: ['elasticsearch', 'setup_logstash']
nginx:
image: nginx:latest
container_name: elk_nginx
volumes:
- ./config/certs:/etc/nginx/certs
- ./config/nginx:/etc/nginx/conf.d
- ./data/nginx:/var/log/nginx
ports: ['80:80','443:443']
links: ['kibana']
# Run a short-lived container to set up Logstash.
setup_logstash:
image: centos:7
container_name: elk_setup_logstash
volumes: ['./script/setup-logstash.sh:/usr/local/bin/setup-logstash.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-logstash.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}','xpack.security.enabled=true']
depends_on: ['elasticsearch']
setup_kibana:
image: centos:7
container_name: elk_setup_kibana
volumes: ['./script/setup-kibana.sh:/usr/local/bin/setup-kibana.sh:ro']
command: ['/bin/bash', '-c', 'cat /usr/local/bin/setup-kibana.sh | tr -d "\r" | bash']
environment: ['ELASTIC_PASSWORD=${ELASTIC_PASSWORD}']
depends_on: ['elasticsearch']