-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
189 lines (175 loc) · 5.18 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
version: '3.7'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}
volumes:
- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro,z
# Uncomment after completing basic security settings
# - ./elasticsearch/config/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12:ro,z
# - ./elasticsearch/config/elastic-stack-ca.p12:/usr/share/elasticsearch/config/elastic-stack-ca.p12:ro,z
- elasticsearch:/usr/share/elasticsearch/data:z
environment:
node.name: "{{ .Node.Hostname }}"
discovery.seed_hosts: elasticsearch
cluster.initial_master_nodes: ${NODE_LIST}
ES_JAVA_OPTS: -Xmx512m -Xms512m
ELASTIC_PASSWORD: "changeme"
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
resources:
limits:
memory: 2G
networks:
- monitor_network
fleet:
image: docker.elastic.co/beats/elastic-agent:${ELASTIC_VERSION}
user: root
# Uncomment after create certificates
# volumes:
# - ./fleet-server/fleet-server.crt:/usr/share/elasticsearch-agent/cert/fleet-server.crt:ro,z
# - ./fleet-server/fleet-server.key:/usr/share/elasticsearch-agent/cert/fleet-server.key:ro,z
# - ./fleet-server/ca.crt:/usr/share/elasticsearch-agent/cert/ca.crt:ro,z
environment:
FLEET_URL: https://<Host Server IP>:8220
FLEET_SERVER_ENABLE: 1
FLEET_SERVER_POLICY: fleet-server-policy
FLEET_SERVER_ELASTICSEARCH_HOST: http://elasticsearch:9200
FLEET_SERVER_SERVICE_TOKEN: <SERVICE TOKEN>
# Uncomment after create certificates
# FLEET_SERVER_CERT: /usr/share/elasticsearch-agent/cert/fleet-server.crt
# FLEET_SERVER_CERT_KEY: /usr/share/elasticsearch-agent/cert/fleet-server.key
# ELASTICSEARCH_CA: /usr/share/elasticsearch-agent/cert/ca.crt
# CERTIFICATE_AUTHORITIES: /usr/share/elasticsearch-agent/cert/ca.crt
deploy:
placement:
constraints: [ node.role == manager ]
ports:
- "8220:8220"
networks:
- monitor_network
elastic-alert:
image: jertel/elastalert2:2.9.0
volumes:
- ./elastic-alert/config.yml:/opt/elastalert/config.yml
- ./elastic-alert/rules:/opt/elastalert/rules
environment:
TZ: Asia/Seoul
ports:
- "8230:8230"
depends_on:
- elasticsearch
networks:
- monitor_network
deploy:
placement:
constraints: [ node.role == manager ]
nginx:
image: nginx:1
ports:
- "9200:9200"
volumes:
- ./nginx/server.conf:/etc/nginx/conf.d/default.conf
deploy:
placement:
constraints: [ node.role == manager ]
networks:
- monitor_network
logstash:
image: docker.elastic.co/logstash/logstash:${ELASTIC_VERSION}
volumes:
- ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro,Z
- ./logstash/pipeline:/usr/share/logstash/pipeline:ro,Z
ports:
- "5000:5000/tcp"
- "5000:5000/udp"
- "9600:9600"
environment:
LS_JAVA_OPTS: -Xmx256m -Xms256m
deploy:
mode: global
restart_policy:
condition: on-failure
delay: 5s
networks:
- monitor_network
kibana:
image: docker.elastic.co/kibana/kibana:${ELASTIC_VERSION}
volumes:
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml:ro,Z
ports:
- "5601:5601"
networks:
- monitor_network
deploy:
placement:
constraints: [node.role == manager]
prometheus:
image: prom/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.retention=24h'
volumes:
- ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
networks:
- monitor_network
deploy:
placement:
constraints: [node.role == manager]
grafana:
image: grafana/grafana
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=password
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana:/var/lib/grafana
- ./grafana:/etc/grafana/provisioning
ports:
- "3000:3000"
networks:
- monitor_network
deploy:
placement:
constraints: [node.role == manager]
node-exporter:
image: prom/node-exporter
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- "--path.procfs=/host/proc"
- "--path.sysfs=/host/sys"
- --collector.filesystem.ignored-mount-points
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
ports:
- "9100:9100"
deploy:
mode: global
networks:
- monitor_network
cadvisor:
image: google/cadvisor
ports:
- "8080:8080"
volumes:
- /:/rootfs:ro
- /var/run:/var/run:rw
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
deploy:
mode: global
networks:
- monitor_network
networks:
monitor_network:
external: true
volumes:
elasticsearch:
grafana: