-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun-elasticsearch.sh
executable file
·71 lines (59 loc) · 1.78 KB
/
run-elasticsearch.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
#!/bin/bash
set -euxo pipefail
if [[ -z $STACK_VERSION ]]; then
echo -e "\033[31;1mERROR:\033[0m Required environment variable [STACK_VERSION] not set\033[0m"
exit 1
fi
docker network create elastic
mkdir -p /es/plugins/
mkdir -p /es/config/
docker run --rm \
--network=elastic \
--entrypoint=tar \
docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION} \
-c -C /usr/share/elasticsearch/ config | tar x -C /es/
chown -R 1000:1000 /es/
if [[ ! -z $PLUGINS ]]; then
docker run --rm \
--network=elastic \
-v /es/plugins/:/usr/share/elasticsearch/plugins/ \
-v /es/config/:/usr/share/elasticsearch/config/ \
--entrypoint=/usr/share/elasticsearch/bin/elasticsearch-plugin \
docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION} \
install ${PLUGINS/\\n/ } --batch
fi
ls -lha /es
ls -lha /es/plugins
ls -lha /es/config
docker run \
--rm \
--env "node.name=es1" \
--env "cluster.name=docker-elasticsearch" \
--env "cluster.initial_master_nodes=es1" \
--env "discovery.seed_hosts=es1" \
--env "cluster.routing.allocation.disk.threshold_enabled=false" \
--env "bootstrap.memory_lock=true" \
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
--env "xpack.security.enabled=false" \
--env "xpack.license.self_generated.type=basic" \
--ulimit nofile=65536:65536 \
--ulimit memlock=-1:-1 \
--publish "9200:9200" \
--network=elastic \
--name="es1" \
-v /es/plugins/:/usr/share/elasticsearch/plugins/ \
-v /es/config/:/usr/share/elasticsearch/config/ \
docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
docker run \
--network elastic \
--rm \
appropriate/curl \
--max-time 120 \
--retry 120 \
--retry-delay 1 \
--retry-connrefused \
--show-error \
--silent \
http://es1:9200
sleep 10
echo "Elasticsearch up and running"