1
-
2
- version : ' 2.3'
3
1
volumes :
4
2
certs :
5
3
driver : local
6
-
7
4
services :
8
5
setup :
9
6
image : docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION}-amd64
@@ -38,12 +35,6 @@ services:
38
35
" - localhost\n"\
39
36
" ip:\n"\
40
37
" - 127.0.0.1\n"\
41
- " - name: es03\n"\
42
- " dns:\n"\
43
- " - es03\n"\
44
- " - localhost\n"\
45
- " ip:\n"\
46
- " - 127.0.0.1\n"\
47
38
> config/certs/instances.yml;
48
39
bin/elasticsearch-certutil cert --silent --pem -out config/certs/certs.zip --in config/certs/instances.yml --ca-cert config/certs/ca/ca.crt --ca-key config/certs/ca/ca.key;
49
40
unzip config/certs/certs.zip -d config/certs;
@@ -59,23 +50,41 @@ services:
59
50
environment :
60
51
- node.name=es01
61
52
- cluster.name=es-docker-cluster
62
- - discovery.seed_hosts=elasticsearch
53
+ - network.host="0.0.0.0"
54
+ - discovery.type=single-node
55
+ - xpack.license.self_generated.type=trial
56
+ - xpack.security.enabled=true
57
+ - xpack.security.authc.api_key.enabled=true
58
+ - xpack.security.authc.token.enabled=true
59
+ - xpack.security.http.ssl.enabled=false
60
+ # - xpack.security.http.ssl.enabled=true
61
+ # - xpack.security.http.ssl.key=certs/es01/es01.key
62
+ # - xpack.security.http.ssl.certificate=certs/es01/es01.crt
63
+ # - xpack.security.http.ssl.certificate_authorities=certs/ca/ca.crt
64
+ # - xpack.security.transport.ssl.enabled=true
65
+ # - xpack.security.transport.ssl.key=certs/es01/es01.key
66
+ # - xpack.security.transport.ssl.certificate=certs/es01/es01.crt
67
+ # - xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
68
+ # - xpack.security.transport.ssl.verification_mode=certificate
63
69
- bootstrap.memory_lock=true
64
- - " ES_JAVA_OPTS=-Xms1G -Xmx1G"
65
70
- " ELASTIC_USERNAME=${ELASTICSEARCH_USERNAME}"
66
71
- " ELASTIC_PASSWORD=${ELASTICSEARCH_PASSWORD}"
72
+ mem_limit : 4294967296 # 4g
73
+ healthcheck :
74
+ test : ["CMD-SHELL", "curl -s ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}@localhost:9200/_cluster/health | grep -q '\"status\":\"green\"'"]
75
+ start_period : 10s
76
+ interval : 10s
77
+ timeout : 10s
78
+ retries : 120
67
79
ulimits :
68
80
memlock :
69
81
soft : -1
70
82
hard : -1
71
- nofile :
72
- soft : 65536
73
- hard : 65536
74
83
volumes :
75
- - ./elasticsearch.yml :/usr/share/elasticsearch/config/elasticsearch.yml
84
+ - certs :/usr/share/elasticsearch/config/certs
76
85
ports :
77
86
- 127.0.0.1:9200:9200
78
-
87
+
79
88
elasticsearch-remote :
80
89
depends_on :
81
90
setup :
@@ -85,9 +94,12 @@ services:
85
94
environment :
86
95
- node.name=es02
87
96
- cluster.name=es-docker-cluster2
88
- - discovery.seed_hosts=elasticsearch
89
- - bootstrap.memory_lock=true
97
+ - network.host="0.0.0.0"
98
+ - discovery.type=single-node
99
+ - xpack.license.self_generated.type=trial
90
100
- xpack.security.enabled=true
101
+ - xpack.security.authc.api_key.enabled=true
102
+ - xpack.security.authc.token.enabled=true
91
103
- xpack.security.http.ssl.enabled=true
92
104
- xpack.security.http.ssl.key=certs/es02/es02.key
93
105
- xpack.security.http.ssl.certificate=certs/es02/es02.crt
@@ -97,23 +109,22 @@ services:
97
109
- xpack.security.transport.ssl.certificate=certs/es02/es02.crt
98
110
- xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
99
111
- xpack.security.transport.ssl.verification_mode=certificate
100
- - cluster.name="docker-cluster"
101
- - network.host="0.0.0.0"
102
- - xpack.security.authc.api_key.enabled="true"
103
- - xpack.license.self_generated.type="trial"
104
- - " ES_JAVA_OPTS=-Xms1G -Xmx1G"
112
+ - bootstrap.memory_lock=true
105
113
- " ELASTIC_USERNAME=${ELASTICSEARCH_USERNAME}"
106
114
- " ELASTIC_PASSWORD=${ELASTICSEARCH_PASSWORD}"
115
+ mem_limit : 4294967296 # 4g
116
+ healthcheck :
117
+ test : ["CMD-SHELL", "curl -s --cacert config/certs/ca/ca.crt https://${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}@localhost:9200/_cluster/health | grep -q '\"status\":\"green\"'"]
118
+ start_period : 10s
119
+ interval : 10s
120
+ timeout : 10s
121
+ retries : 120
107
122
ulimits :
108
123
memlock :
109
124
soft : -1
110
125
hard : -1
111
- nofile :
112
- soft : 65536
113
- hard : 65536
114
126
volumes :
115
127
- certs:/usr/share/elasticsearch/config/certs
116
- - ./elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
117
128
ports :
118
129
- 127.0.0.1:9201:9200
119
-
130
+
0 commit comments