elastic-enterprise-search 8.6.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/certs/testnode.crt +17 -17
  3. data/.buildkite/certs/testnode.key +25 -25
  4. data/.buildkite/pipeline.yml +2 -7
  5. data/.buildkite/run-client.sh +6 -6
  6. data/.buildkite/run-elasticsearch.sh +3 -7
  7. data/{.ci → .buildkite}/run-local.sh +2 -2
  8. data/.buildkite/run-tests.sh +3 -3
  9. data/.github/workflows/testing.yml +1 -1
  10. data/Rakefile +8 -2
  11. data/docs/guide/release_notes/87.asciidoc +13 -0
  12. data/docs/guide/release_notes/index.asciidoc +2 -0
  13. data/lib/elastic/app-search/api/search.rb +1 -1
  14. data/lib/elastic/enterprise-search/version.rb +1 -1
  15. data/spec/integration/app-search/api_logs_spec.rb +0 -8
  16. data/spec/spec_helper.rb +1 -1
  17. metadata +5 -30
  18. data/.ci/.env +0 -9
  19. data/.ci/certs/README.md +0 -50
  20. data/.ci/certs/ca.crt +0 -20
  21. data/.ci/certs/ca.key +0 -27
  22. data/.ci/certs/testnode.crt +0 -21
  23. data/.ci/certs/testnode.key +0 -27
  24. data/.ci/certs/testnode_no_san.crt +0 -19
  25. data/.ci/certs/testnode_no_san.key +0 -27
  26. data/.ci/docker-compose.yml +0 -166
  27. data/.ci/functions/cleanup.sh +0 -67
  28. data/.ci/functions/imports.sh +0 -60
  29. data/.ci/functions/wait-for-container.sh +0 -36
  30. data/.ci/jobs/defaults.yml +0 -73
  31. data/.ci/jobs/elastic+enterprise-search-ruby+7.17.yml +0 -12
  32. data/.ci/jobs/elastic+enterprise-search-ruby+8.3.yml +0 -12
  33. data/.ci/jobs/elastic+enterprise-search-ruby+8.4.yml +0 -12
  34. data/.ci/jobs/elastic+enterprise-search-ruby+8.5.yml +0 -12
  35. data/.ci/jobs/elastic+enterprise-search-ruby+main.yml +0 -12
  36. data/.ci/jobs/elastic+enterprise-search-ruby+pull-request.yml +0 -19
  37. data/.ci/run-elasticsearch.sh +0 -127
  38. data/.ci/run-enterprise-search.sh +0 -72
  39. data/.ci/run-kibana.sh +0 -22
  40. data/.ci/run-repository.sh +0 -50
  41. data/.ci/run-stack.sh +0 -1
  42. data/.ci/run-tests +0 -27
  43. data/.ci/test-matrix.yml +0 -15
@@ -1,166 +0,0 @@
1
-
2
- version: "2.2"
3
-
4
- services:
5
- setup:
6
- image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
7
- volumes:
8
- - certs:/usr/share/elasticsearch/config/certs
9
- user: "0"
10
- command: >
11
- bash -c '
12
- if [ x${ELASTIC_PASSWORD} == x ]; then
13
- echo "Set the ELASTIC_PASSWORD environment variable in the .env file";
14
- exit 1;
15
- elif [ x${KIBANA_PASSWORD} == x ]; then
16
- echo "Set the KIBANA_PASSWORD environment variable in the .env file";
17
- exit 1;
18
- fi;
19
- if [ ! -f certs/ca.zip ]; then
20
- echo "Creating CA";
21
- bin/elasticsearch-certutil ca --silent --pem -out config/certs/ca.zip;
22
- unzip config/certs/ca.zip -d config/certs;
23
- fi;
24
- if [ ! -f certs/certs.zip ]; then
25
- echo "Creating certs";
26
- echo -ne \
27
- "instances:\n"\
28
- " - name: es01\n"\
29
- " dns:\n"\
30
- " - es01\n"\
31
- " - localhost\n"\
32
- " ip:\n"\
33
- " - 127.0.0.1\n"\
34
- > config/certs/instances.yml;
35
- 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;
36
- unzip config/certs/certs.zip -d config/certs;
37
- fi;
38
- echo "Setting file permissions"
39
- chown -R root:root config/certs;
40
- find . -type d -exec chmod 750 \{\} \;;
41
- find . -type f -exec chmod 640 \{\} \;;
42
- echo "Waiting for Elasticsearch availability";
43
- until curl -s --cacert config/certs/ca/ca.crt https://es01:9200 | grep -q "missing authentication credentials"; do sleep 30; done;
44
- echo "Setting kibana_system password";
45
- until curl -s -X POST --cacert config/certs/ca/ca.crt -u elastic:${ELASTIC_PASSWORD} -H "Content-Type: application/json" https://es01:9200/_security/user/kibana_system/_password -d "{\"password\":\"${KIBANA_PASSWORD}\"}" | grep -q "^{}"; do sleep 10; done;
46
- echo "All done!";
47
- '
48
- healthcheck:
49
- test: ["CMD-SHELL", "[ -f config/certs/es01/es01.crt ]"]
50
- interval: 1s
51
- timeout: 5s
52
- retries: 120
53
-
54
- es01:
55
- depends_on:
56
- setup:
57
- condition: service_healthy
58
- image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
59
- volumes:
60
- - certs:/usr/share/elasticsearch/config/certs
61
- - esdata01:/usr/share/elasticsearch/data
62
- ports:
63
- - ${ES_PORT}:9200
64
- environment:
65
- - node.name=es01
66
- - cluster.name=${CLUSTER_NAME}
67
- - cluster.initial_master_nodes=es01
68
- - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
69
- - bootstrap.memory_lock=true
70
- - xpack.security.enabled=true
71
- - xpack.security.http.ssl.enabled=true
72
- - xpack.security.http.ssl.key=certs/es01/es01.key
73
- - xpack.security.http.ssl.certificate=certs/es01/es01.crt
74
- - xpack.security.http.ssl.certificate_authorities=certs/ca/ca.crt
75
- - xpack.security.http.ssl.verification_mode=certificate
76
- - xpack.security.transport.ssl.enabled=true
77
- - xpack.security.transport.ssl.key=certs/es01/es01.key
78
- - xpack.security.transport.ssl.certificate=certs/es01/es01.crt
79
- - xpack.security.transport.ssl.certificate_authorities=certs/ca/ca.crt
80
- - xpack.security.transport.ssl.verification_mode=certificate
81
- - xpack.license.self_generated.type=trial
82
- mem_limit: ${MEM_LIMIT}
83
- ulimits:
84
- memlock:
85
- soft: -1
86
- hard: -1
87
- healthcheck:
88
- test:
89
- [
90
- "CMD-SHELL",
91
- "curl -s --cacert config/certs/ca/ca.crt https://localhost:9200 | grep -q 'missing authentication credentials'",
92
- ]
93
- interval: 10s
94
- timeout: 10s
95
- retries: 120
96
-
97
- kibana:
98
- depends_on:
99
- es01:
100
- condition: service_healthy
101
- image: docker.elastic.co/kibana/kibana:${STACK_VERSION}
102
- volumes:
103
- - certs:/usr/share/kibana/config/certs
104
- - kibanadata:/usr/share/kibana/data
105
- ports:
106
- - ${KIBANA_PORT}:5601
107
- environment:
108
- - SERVERNAME=kibana
109
- - ELASTICSEARCH_HOSTS=https://es01:9200
110
- - ELASTICSEARCH_USERNAME=kibana_system
111
- - ELASTICSEARCH_PASSWORD=${KIBANA_PASSWORD}
112
- - ELASTICSEARCH_SSL_CERTIFICATEAUTHORITIES=config/certs/ca/ca.crt
113
- - ENTERPRISESEARCH_HOST=http://enterprisesearch:${ENTERPRISE_SEARCH_PORT}
114
- mem_limit: ${MEM_LIMIT}
115
- healthcheck:
116
- test:
117
- [
118
- "CMD-SHELL",
119
- "curl -s -I http://localhost:5601 | grep -q 'HTTP/1.1 302 Found'",
120
- ]
121
- interval: 10s
122
- timeout: 10s
123
- retries: 120
124
-
125
- enterprisesearch:
126
- depends_on:
127
- es01:
128
- condition: service_healthy
129
- kibana:
130
- condition: service_healthy
131
- image: docker.elastic.co/enterprise-search/enterprise-search:${STACK_VERSION}
132
- volumes:
133
- - certs:/usr/share/enterprise-search/config/certs
134
- - enterprisesearchdata:/usr/share/enterprise-search/config
135
- ports:
136
- - ${ENTERPRISE_SEARCH_PORT}:3002
137
- environment:
138
- - SERVERNAME=enterprisesearch
139
- - secret_management.encryption_keys=[${ENCRYPTION_KEYS}]
140
- - allow_es_settings_modification=true
141
- - elasticsearch.host=https://es01:9200
142
- - elasticsearch.username=elastic
143
- - elasticsearch.password=${ELASTIC_PASSWORD}
144
- - elasticsearch.ssl.enabled=true
145
- - elasticsearch.ssl.certificate_authority=/usr/share/enterprise-search/config/certs/ca/ca.crt
146
- - kibana.external_url=http://kibana:5601
147
- mem_limit: ${MEM_LIMIT}
148
- healthcheck:
149
- test:
150
- [
151
- "CMD-SHELL",
152
- "curl -s -I http://localhost:3002 | grep -q 'HTTP/1.1 302 Found'",
153
- ]
154
- interval: 10s
155
- timeout: 10s
156
- retries: 120
157
-
158
- volumes:
159
- certs:
160
- driver: local
161
- enterprisesearchdata:
162
- driver: local
163
- esdata01:
164
- driver: local
165
- kibanadata:
166
- driver: local
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Shared cleanup routines between different steps
4
- #
5
- # Please source .ci/functions/imports.sh as a whole not just this file
6
- #
7
- # Version 1.0.0
8
- # - Initial version after refactor
9
-
10
- function cleanup_volume {
11
- if [[ "$(docker volume ls -q -f name=$1)" ]]; then
12
- echo -e "\033[34;1mINFO:\033[0m Removing volume $1\033[0m"
13
- (docker volume rm "$1") || true
14
- fi
15
- }
16
- function container_running {
17
- if [[ "$(docker ps -q -f name=$1)" ]]; then
18
- return 0;
19
- else return 1;
20
- fi
21
- }
22
- function cleanup_node {
23
- if container_running "$1"; then
24
- echo -e "\033[34;1mINFO:\033[0m Removing container $1\033[0m"
25
- (docker container rm --force --volumes "$1") || true
26
- fi
27
- if [[ -n "$1" ]]; then
28
- echo -e "\033[34;1mINFO:\033[0m Removing volume $1-${suffix}-data\033[0m"
29
- cleanup_volume "$1-${suffix}-data"
30
- fi
31
- }
32
- function cleanup_network {
33
- if [[ "$(docker network ls -q -f name=$1)" ]]; then
34
- echo -e "\033[34;1mINFO:\033[0m Removing network $1\033[0m"
35
- (docker network rm "$1") || true
36
- fi
37
- }
38
-
39
- function cleanup_trap {
40
- status=$?
41
- set +x
42
- if [[ "$DETACH" != "true" ]]; then
43
- echo -e "\033[34;1mINFO:\033[0m clean the network if not detached (start and exit)\033[0m"
44
- cleanup_all_in_network "$1"
45
- fi
46
- # status is 0 or SIGINT
47
- if [[ "$status" == "0" || "$status" == "130" ]]; then
48
- echo -e "\n\033[32;1mSUCCESS run-tests\033[0m"
49
- exit 0
50
- else
51
- echo -e "\n\033[31;1mFAILURE during run-tests\033[0m"
52
- exit ${status}
53
- fi
54
- };
55
- function cleanup_all_in_network {
56
-
57
- if [[ -z "$(docker network ls -q -f name="^$1\$")" ]]; then
58
- echo -e "\033[34;1mINFO:\033[0m $1 is already deleted\033[0m"
59
- return 0
60
- fi
61
- containers=$(docker network inspect -f '{{ range $key, $value := .Containers }}{{ printf "%s\n" .Name}}{{ end }}' $1)
62
- while read -r container; do
63
- cleanup_node "$container"
64
- done <<< "$containers"
65
- cleanup_network $1
66
- echo -e "\033[32;1mSUCCESS:\033[0m Cleaned up and exiting\033[0m"
67
- };
@@ -1,60 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Sets up all the common variables and imports relevant functions
4
- #
5
- # Version 1.0.1
6
- # - Initial version after refactor
7
- # - Validate STACK_VERSION asap
8
-
9
- function require_stack_version() {
10
- if [[ -z $STACK_VERSION ]]; then
11
- echo -e "\033[31;1mERROR:\033[0m Required environment variable [STACK_VERSION] not set\033[0m"
12
- exit 1
13
- fi
14
- }
15
-
16
- require_stack_version
17
-
18
- if [[ -z $es_node_name ]]; then
19
- # only set these once
20
- set -euo pipefail
21
- export TEST_SUITE=${TEST_SUITE-free}
22
- export SERVICE=${SERVICE-}
23
- export RUNSCRIPTS=${RUNSCRIPTS-}
24
- export DETACH=${DETACH-false}
25
- export CLEANUP=${CLEANUP-false}
26
-
27
- export es_node_name=instance
28
- export elastic_password=changeme
29
- export elasticsearch_image=elasticsearch
30
- export elasticsearch_url=https://elastic:${elastic_password}@${es_node_name}:9200
31
- if [[ $TEST_SUITE != "platinum" ]]; then
32
- export elasticsearch_url=http://${es_node_name}:9200
33
- fi
34
- export external_elasticsearch_url=${elasticsearch_url/$es_node_name/localhost}
35
- export elasticsearch_container="${elasticsearch_image}:${STACK_VERSION}"
36
-
37
- export suffix=rest-test
38
- export moniker=$(echo "$elasticsearch_container" | tr -C "[:alnum:]" '-')
39
- export network_name=${moniker}${suffix}
40
-
41
- export ssl_cert="${script_path}/certs/testnode.crt"
42
- export ssl_key="${script_path}/certs/testnode.key"
43
- export ssl_ca="${script_path}/certs/ca.crt"
44
-
45
- fi
46
-
47
- export script_path=$(dirname $(realpath -s $0))
48
- source $script_path/functions/cleanup.sh
49
- source $script_path/functions/wait-for-container.sh
50
- trap "cleanup_trap ${network_name}" EXIT
51
-
52
-
53
- if [[ "$CLEANUP" == "true" ]]; then
54
- cleanup_all_in_network $network_name
55
- exit 0
56
- fi
57
-
58
- echo -e "\033[34;1mINFO:\033[0m Creating network $network_name if it does not exist already \033[0m"
59
- docker network inspect "$network_name" > /dev/null 2>&1 || docker network create "$network_name"
60
-
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Exposes a routine scripts can call to wait for a container if that container set up a health command
4
- #
5
- # Please source .ci/functions/imports.sh as a whole not just this file
6
- #
7
- # Version 1.0.1
8
- # - Initial version after refactor
9
- # - Make sure wait_for_contiainer is silent
10
-
11
- function wait_for_container {
12
- set +x
13
- until ! container_running "$1" || (container_running "$1" && [[ "$(docker inspect -f "{{.State.Health.Status}}" ${1})" != "starting" ]]); do
14
- echo ""
15
- docker inspect -f "{{range .State.Health.Log}}{{.Output}}{{end}}" ${1}
16
- echo -e "\033[34;1mINFO:\033[0m waiting for node $1 to be up\033[0m"
17
- sleep 20;
18
- done;
19
-
20
- # Always show logs if the container is running, this is very useful both on CI as well as while developing
21
- if container_running $1; then
22
- docker logs $1
23
- fi
24
-
25
- if ! container_running $1 || [[ "$(docker inspect -f "{{.State.Health.Status}}" ${1})" != "healthy" ]]; then
26
- cleanup_all_in_network $2
27
- echo
28
- echo -e "\033[31;1mERROR:\033[0m Failed to start $1 in detached mode beyond health checks\033[0m"
29
- echo -e "\033[31;1mERROR:\033[0m dumped the docker log before shutting the node down\033[0m"
30
- return 1
31
- else
32
- echo
33
- echo -e "\033[32;1mSUCCESS:\033[0m Detached and healthy: ${1} on docker network: ${network_name}\033[0m"
34
- return 0
35
- fi
36
- }
@@ -1,73 +0,0 @@
1
- ---
2
-
3
- ##### GLOBAL METADATA
4
-
5
- - meta:
6
- cluster: clients-ci
7
-
8
- ##### JOB DEFAULTS
9
-
10
- - job:
11
- project-type: matrix
12
- logrotate:
13
- daysToKeep: 30
14
- numToKeep: 100
15
- properties:
16
- - github:
17
- url: https://github.com/elastic/enterprise-search-ruby/
18
- - inject:
19
- properties-content: HOME=$JENKINS_HOME
20
- concurrent: true
21
- node: flyweight
22
- scm:
23
- - git:
24
- name: origin
25
- credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
26
- reference-repo: /var/lib/jenkins/.git-references/enterprise-search-ruby.git
27
- branches:
28
- - ${branch_specifier}
29
- url: git@github.com:elastic/enterprise-search-ruby.git
30
- basedir: ''
31
- wipe-workspace: 'True'
32
- triggers:
33
- - github
34
- - timed: 'H 5,17 * * *'
35
- axes:
36
- - axis:
37
- type: slave
38
- name: label
39
- values:
40
- - linux
41
- - axis:
42
- type: yaml
43
- filename: .ci/test-matrix.yml
44
- name: STACK_VERSION
45
- - axis:
46
- type: yaml
47
- filename: .ci/test-matrix.yml
48
- name: RUBY_VERSION
49
- - axis:
50
- type: yaml
51
- filename: .ci/test-matrix.yml
52
- name: SERVICE
53
- yaml-strategy:
54
- exclude-key: exclude
55
- filename: .ci/test-matrix.yml
56
- wrappers:
57
- - ansicolor
58
- - timeout:
59
- type: absolute
60
- timeout: 120
61
- fail: true
62
- - timestamps
63
- - workspace-cleanup
64
- builders:
65
- - shell: |-
66
- #!/usr/local/bin/runbld
67
- .ci/run-tests
68
- publishers:
69
- - email:
70
- recipients: build-lang-clients@elastic.co
71
- - junit:
72
- results: "*-junit.xml"
73
- allow-empty-results: true
@@ -1,12 +0,0 @@
1
- ---
2
- - job:
3
- name: elastic+enterprise-search-ruby+7.17
4
- display-name: 'elastic / enterprise-search-ruby # 7.17'
5
- description: Testing the enterprise-search-ruby 7.17 branch.
6
- junit_results: "*-junit.xml"
7
- parameters:
8
- - string:
9
- name: branch_specifier
10
- default: refs/heads/7.17
11
- description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
12
- &lt;commitId&gt;, etc.)
@@ -1,12 +0,0 @@
1
- ---
2
- - job:
3
- name: elastic+enterprise-search-ruby+8.3
4
- display-name: 'elastic / enterprise-search-ruby # 8.3'
5
- description: Testing the enterprise-search-ruby 8.3 branch.
6
- junit_results: "*-junit.xml"
7
- parameters:
8
- - string:
9
- name: branch_specifier
10
- default: refs/heads/8.3
11
- description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
12
- &lt;commitId&gt;, etc.)
@@ -1,12 +0,0 @@
1
- ---
2
- - job:
3
- name: elastic+enterprise-search-ruby+8.4
4
- display-name: 'elastic / enterprise-search-ruby # 8.4'
5
- description: Testing the enterprise-search-ruby 8.4 branch.
6
- junit_results: "*-junit.xml"
7
- parameters:
8
- - string:
9
- name: branch_specifier
10
- default: refs/heads/8.4
11
- description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
12
- &lt;commitId&gt;, etc.)
@@ -1,12 +0,0 @@
1
- ---
2
- - job:
3
- name: elastic+enterprise-search-ruby+8.5
4
- display-name: 'elastic / enterprise-search-ruby # 8.5'
5
- description: Testing the enterprise-search-ruby 8.5 branch.
6
- junit_results: "*-junit.xml"
7
- parameters:
8
- - string:
9
- name: branch_specifier
10
- default: refs/heads/8.5
11
- description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
12
- &lt;commitId&gt;, etc.)
@@ -1,12 +0,0 @@
1
- ---
2
- - job:
3
- name: elastic+enterprise-search-ruby+main
4
- display-name: 'elastic / enterprise-search-ruby # main'
5
- description: Testing the enterprise-search-ruby main branch.
6
- junit_results: "*-junit.xml"
7
- parameters:
8
- - string:
9
- name: branch_specifier
10
- default: refs/heads/main
11
- description: the Git branch specifier to build (&lt;branchName&gt;, &lt;tagName&gt;,
12
- &lt;commitId&gt;, etc.)
@@ -1,19 +0,0 @@
1
- ---
2
- - job:
3
- name: elastic+enterprise-search-ruby+pull-request
4
- display-name: 'elastic / enterprise-search-ruby # pull-request'
5
- description: Testing of enterprise-search-ruby pull requests.
6
- junit_results: "*-junit.xml"
7
- scm:
8
- - git:
9
- branches:
10
- - ${ghprbActualCommit}
11
- refspec: +refs/pull/*:refs/remotes/origin/pr/*
12
- triggers:
13
- - github-pull-request:
14
- org-list:
15
- - elastic
16
- allow-whitelist-orgs-as-admins: true
17
- github-hooks: true
18
- status-context: clients-ci
19
- cancel-builds-on-update: true
@@ -1,127 +0,0 @@
1
- #!/usr/bin/env bash
2
- #
3
- # Launch one or more Elasticsearch nodes via the Docker image,
4
- # to form a cluster suitable for running the REST API tests.
5
- #
6
- # Export the STACK_VERSION variable, eg. '8.0.0-SNAPSHOT'.
7
- # Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
8
- # Export the NUMBER_OF_NODES variable to start more than 1 node
9
-
10
- # Version 1.2.0
11
- # - Initial version of the run-elasticsearch.sh script
12
- # - Deleting the volume should not dependent on the container still running
13
- # - Fixed `ES_JAVA_OPTS` config
14
- # - Moved to STACK_VERSION and TEST_VERSION
15
- # - Refactored into functions and imports
16
- # - Support NUMBER_OF_NODES
17
- # - Added 5 retries on docker pull for fixing transient network errors
18
-
19
- script_path=$(dirname $(realpath -s $0))
20
- source $script_path/functions/imports.sh
21
- set -euo pipefail
22
-
23
- echo -e "\033[34;1mINFO:\033[0m Take down node if called twice with the same arguments (DETACH=true) or on seperate terminals \033[0m"
24
- cleanup_node $es_node_name
25
-
26
- master_node_name=${es_node_name}
27
- cluster_name=${moniker}${suffix}
28
-
29
- declare -a volumes
30
- environment=($(cat <<-END
31
- --env node.name=$es_node_name
32
- --env cluster.name=$cluster_name
33
- --env cluster.initial_master_nodes=$master_node_name
34
- --env discovery.seed_hosts=$master_node_name
35
- --env cluster.routing.allocation.disk.threshold_enabled=false
36
- --env bootstrap.memory_lock=true
37
- --env node.attr.testattr=test
38
- --env path.repo=/tmp
39
- --env repositories.url.allowed_urls=http://snapshot.test*
40
- END
41
- ))
42
- if [[ "$TEST_SUITE" == "platinum" ]]; then
43
- environment+=($(cat <<-END
44
- --env ELASTIC_PASSWORD=$elastic_password
45
- --env xpack.license.self_generated.type=trial
46
- --env xpack.security.enabled=true
47
- --env xpack.security.http.ssl.enabled=true
48
- --env xpack.security.http.ssl.verification_mode=certificate
49
- --env xpack.security.http.ssl.key=certs/testnode.key
50
- --env xpack.security.http.ssl.certificate=certs/testnode.crt
51
- --env xpack.security.http.ssl.certificate_authorities=certs/ca.crt
52
- --env xpack.security.transport.ssl.enabled=true
53
- --env xpack.security.transport.ssl.key=certs/testnode.key
54
- --env xpack.security.transport.ssl.certificate=certs/testnode.crt
55
- --env xpack.security.transport.ssl.certificate_authorities=certs/ca.crt
56
- END
57
- ))
58
- volumes+=($(cat <<-END
59
- --volume $ssl_cert:/usr/share/elasticsearch/config/certs/testnode.crt
60
- --volume $ssl_key:/usr/share/elasticsearch/config/certs/testnode.key
61
- --volume $ssl_ca:/usr/share/elasticsearch/config/certs/ca.crt
62
- END
63
- ))
64
- fi
65
-
66
- cert_validation_flags=""
67
- if [[ "$TEST_SUITE" == "platinum" ]]; then
68
- cert_validation_flags="--insecure --cacert /usr/share/elasticsearch/config/certs/ca.crt --resolve ${es_node_name}:443:127.0.0.1"
69
- fi
70
-
71
- # Pull the container, retry on failures up to 5 times with
72
- # short delays between each attempt. Fixes most transient network errors.
73
- docker_pull_attempts=0
74
- until [ "$docker_pull_attempts" -ge 5 ]
75
- do
76
- docker pull docker.elastic.co/elasticsearch/"$elasticsearch_container" && break
77
- docker_pull_attempts=$((docker_pull_attempts+1))
78
- echo "Failed to pull image, retrying in 10 seconds (retry $docker_pull_attempts/5)..."
79
- sleep 10
80
- done
81
-
82
- NUMBER_OF_NODES=${NUMBER_OF_NODES-1}
83
- http_port=9200
84
- for (( i=0; i<$NUMBER_OF_NODES; i++, http_port++ )); do
85
- node_name=${es_node_name}$i
86
- node_url=${external_elasticsearch_url/9200/${http_port}}$i
87
- if [[ "$i" == "0" ]]; then node_name=$es_node_name; fi
88
- environment+=($(cat <<-END
89
- --env node.name=$node_name
90
- END
91
- ))
92
- echo "$i: $http_port $node_url "
93
- volume_name=${node_name}-${suffix}-data
94
- volumes+=($(cat <<-END
95
- --volume $volume_name:/usr/share/elasticsearch/data${i}
96
- END
97
- ))
98
-
99
- # make sure we detach for all but the last node if DETACH=false (default) so all nodes are started
100
- local_detach="true"
101
- if [[ "$i" == "$((NUMBER_OF_NODES-1))" ]]; then local_detach=$DETACH; fi
102
- echo -e "\033[34;1mINFO:\033[0m Starting container $node_name \033[0m"
103
- set -x
104
- docker run \
105
- --name "$node_name" \
106
- --network "$network_name" \
107
- --env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
108
- "${environment[@]}" \
109
- "${volumes[@]}" \
110
- --publish "$http_port":9200 \
111
- --ulimit nofile=65536:65536 \
112
- --ulimit memlock=-1:-1 \
113
- --detach="$local_detach" \
114
- --health-cmd="curl $cert_validation_flags --fail $elasticsearch_url/_cluster/health || exit 1" \
115
- --health-interval=2s \
116
- --health-retries=20 \
117
- --health-timeout=2s \
118
- --rm \
119
- docker.elastic.co/elasticsearch/"$elasticsearch_container";
120
-
121
- set +x
122
- if wait_for_container "$es_node_name" "$network_name"; then
123
- echo -e "\033[32;1mSUCCESS:\033[0m Running on: $node_url\033[0m"
124
- fi
125
-
126
- done
127
-