forked from elastic/elasticsearch-php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_es_docker.sh
executable file
·76 lines (70 loc) · 3.14 KB
/
run_es_docker.sh
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
#!/bin/sh
if [ -z $STACK_VERSION ]; then
echo "No STACK_VERSION specified";
exit 1;
fi
if [ "$TEST_SUITE" != "free" ] && [ "$TEST_SUITE" != "platinum" ]; then
echo "TEST_SUITE must be free or platinum";
exit 1;
fi
if [ "$TEST_SUITE" = "free" ]; then
docker pull docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
docker network create esnet;
docker run \
--rm \
--publish 9200:9200 \
--ulimit nofile=65536:65536 \
--ulimit memlock=-1:-1 \
--env "node.attr.testattr=test" \
--env "path.repo=/tmp" \
--env "repositories.url.allowed_urls=http://snapshot.*" \
--env "discovery.type=single-node" \
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
--env "action.destructive_requires_name=false" \
--network=esnet \
--name=elasticsearch \
--health-interval=2s \
--health-retries=20 \
--health-timeout=2s \
--detach \
docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
docker run --network esnet --rm appropriate/curl --max-time 120 --retry 120 --retry-delay 1 --retry-connrefused --show-error --silent http://elasticsearch:9200
else
repo=$(pwd)
testnodecrt="/util/certs/testnode.crt"
testnodekey="/util/certs/testnode.key"
cacrt="/util/certs/ca.crt"
docker pull docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
docker network create esnet;
docker run \
--rm \
--publish 9200:9200 \
--env "node.attr.testattr=test" \
--env "path.repo=/tmp" \
--env "repositories.url.allowed_urls=http://snapshot.*" \
--env "discovery.type=single-node" \
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
--env "action.destructive_requires_name=false" \
--env "ELASTIC_PASSWORD=changeme" \
--env "xpack.security.enabled=true" \
--env "xpack.license.self_generated.type=trial" \
--env "xpack.security.http.ssl.enabled=true" \
--env "xpack.security.http.ssl.verification_mode=certificate" \
--env "xpack.security.http.ssl.key=certs/testnode.key" \
--env "xpack.security.http.ssl.certificate=certs/testnode.crt" \
--env "xpack.security.http.ssl.certificate_authorities=certs/ca.crt" \
--env "xpack.security.transport.ssl.enabled=true" \
--env "xpack.security.transport.ssl.key=certs/testnode.key" \
--env "xpack.security.transport.ssl.certificate=certs/testnode.crt" \
--env 'indices.lifecycle.history_index_enabled=false' \
--env "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt" \
--env "xpack.ml.max_model_memory_limit=2gb" \
--volume "$repo$testnodecrt:/usr/share/elasticsearch/config/certs/testnode.crt" \
--volume "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \
--volume "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \
--network=esnet \
--name=elasticsearch \
--detach \
docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
docker run --network esnet --rm appropriate/curl --max-time 120 --retry 120 --retry-delay 1 --retry-connrefused --show-error --silent --insecure https://elastic:changeme@elasticsearch:9200
fi