Skip to content

Commit

Permalink
add es 8.5.3,8.9,8.11 (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogyo210 authored Jan 8, 2024
1 parent 63bab40 commit 37c519a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
14 changes: 8 additions & 6 deletions sem-service
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ sem_services['memcached']="1.5 1.6"
sem_services['mysql']="5.5 5.6.51 5.6 5.6.50 5.7.13 5.7.25 5.7.27 5.7.31 5.7.32 5.7.33 5.7 5 8.0.16 8.0.22 8.0.23 8.0 8"
sem_services['redis']="2.8.23 2.8 2 3.2.4 3.2.12 3.2 3 4.0.12 4.0.14 4.0 4 5.0.6 5.0.9 5.0 5 6.0.5 6.0.8 6.0 6.2.1 6.2 6.2.7 6 7.0.5 7"
sem_services['mongo']="3.2.1 3.2 3.6.20 3.6 3 4.0.20 4.0 4.1.13 4.1 4.2.10 4.2.13 4.2 4.4.1 4.4.4 4.4 4 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.0.9 5.0 5 6.0.8 6.0 6"
sem_services['elasticsearch']="1.7.6 1.7 1 2.4.6 2.4 2 5.4.3 5.4 5.5.2 5.5 5.6.16 5.6 5 6.5.1 6.5.4 6.5 6.6 6.8.1 6.8.13 6.8 6 7.1.1 7.1 7.2.0 7.2 7.2.1 7.2 7.3.1 7.3.2 7.3 7.4.2 7.4 7.5.0 7.5.1 7.5.2 7.5 7.6.0 7.6.2 7.6 7.7.0 7.7.1 7.7 7.8.1 7.8 7.9.0 7.9.2 7.9.3 7.9 7.10.0 7.11.2 7.11 7.12.0 7.12 7.17.7 7 8.5.1"
sem_services['elasticsearch']="1.7.6 1.7 1 2.4.6 2.4 2 5.4.3 5.4 5.5.2 5.5 5.6.16 5.6 5 6.5.1 6.5.4 6.5 6.6 6.8.1 6.8.13 6.8 6 7.1.1 7.1 7.2.0 7.2 7.2.1 7.2 7.3.1 7.3.2 7.3 7.4.2 7.4 7.5.0 7.5.1 7.5.2 7.5 7.6.0 7.6.2 7.6 7.7.0 7.7.1 7.7 7.8.1 7.8 7.9.0 7.9.2 7.9.3 7.9 7.10.0 7.11.2 7.11 7.12.0 7.12 7.17.7 7 8.5.1 8.5.3 8.9.2 8.11.3"
sem_services['postgres']="9.4.26 9.4 9.5.15 9.5.23 9.5 9.6.6 9.6.11 9.6.18 9.6.19 9.6 9 10.0 10.5 10.6 10.7 10.11 10.12 10.13 10.14 10.16 10 11.0 11.2 11.5 11.6 11.7 11.8 11.9 11.11 11 12.1 12.2 12.3 12.4 12.6 12 13.0 13.2 13 14 15.1 15 16"
sem_services['rabbitmq']="3.6.16 3.6 3.8.2 3.8.9 3.8.14 3.8 3"
sem_services['cassandra']="3.11.3 3.11.8 3.11 3"
Expand Down Expand Up @@ -201,11 +201,13 @@ service::start_mongodb() {
}

service::start_elasticsearch() {
service_version="${1:-6.5}"
service_version=$1
shift
local service_image="${registry_host}/elasticsearch"

docker_params=( "$@" )
service::pull_image "$service_image:$service_version"
docker_output=$(docker run --net=host --rm --name elasticsearch -e "discovery.type=single-node" -d "$service_image":"$service_version")
docker_output=$(docker run "${docker_params[@]}" "$service_image":"$service_version")
# run only if previous command exited successfully
docker_status=$(sem-dockerize 9200 elasticsearch)
if [ "$docker_status" == "0" ]; then
Expand Down Expand Up @@ -340,9 +342,9 @@ service::start() {
;;
"elasticsearch" )
shift
service_version="${service_version:-6.5}"
service::check_version 'elasticsearch' "${service_version%% *}"
service::duration service::start_elasticsearch "${service_version}" total "${service_name}"
IFS=" " read -r -a version_and_args <<< "$(sem-service-check-params elasticsearch "$@")"
service::check_version 'elasticsearch' "${version_and_args[0]}"
service::duration service::start_elasticsearch "${version_and_args[@]}" total "${service_name}"
exit 0
;;
"opensearch" )
Expand Down
21 changes: 21 additions & 0 deletions sem-service-check-params
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,23 @@ params-check::mongodb () {
echo "$service_version $default_params"
}

params-check::elasticsearch () {

local defaultEnv='-e discovery.type=single-node '

sudo mkdir -p /var/tmp/elasticsearch && sudo chmod -R 0777 /var/tmp/elasticsearch
service_version="6.5"
params=""
if [ "${1:0:1}" == "-" ];then
defaultEnv=" $defaultEnv ${@} "
else
service_version="${1:-$service_version}"
defaultEnv=" $defaultEnv ${@:2} "
fi
default_params="--net=host --rm --name elasticsearch -d $defaultEnv -v /var/tmp/elasticsearch:/use/share/elasticsearch/data "
echo "$service_version $default_params"
}

params-check::main () {
case "$1" in
"mysql" )
Expand All @@ -195,6 +212,10 @@ params-check::main () {
shift
params-check::mongodb $@
;;
"elasticsearch" )
shift
params-check::elasticsearch $@
;;
* )
shift
echo "$@"
Expand Down
25 changes: 21 additions & 4 deletions tests/sem_service/elasticsearch
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,41 @@ IFS=$'\n\t'
sem-service start elasticsearch
sleep 5
curl -XGET '0.0.0.0:9200/_cluster/health?pretty' -s | grep green

sem-service status elasticsearch
curl -XGET '0.0.0.0:9200' -s | grep 6.5

sem-service stop elasticsearch

sem-service start elasticsearch 6.6
sleep 5
curl -XGET '0.0.0.0:9200/_cluster/health?pretty' -s| grep green

sem-service stop elasticsearch

sem-service start elasticsearch 7.9
sleep 5
curl -XGET '0.0.0.0:9200' -s | grep 7.9

sem-service stop elasticsearch

sem-service start elasticsearch 7.10.0
sleep 5
curl -XGET '0.0.0.0:9200' -s | grep 7.10
sem-service stop elasticsearch
sleep 5

sem-service start elasticsearch 8.5.3 -e "xpack.security.enabled=false" -e "xpack.security.enrollment.enabled=false"
sleep 5
curl -XGET '0.0.0.0:9200' -s | grep 8.5.3
sem-service stop elasticsearch
sleep 5

sem-service start elasticsearch 8.9.2 -e "xpack.security.enabled=false" -e "xpack.security.enrollment.enabled=false"
sleep 10
curl -XGET '0.0.0.0:9200' -s | grep 8.9.2
sem-service stop elasticsearch
sleep 5

sem-service start elasticsearch 8.11.3 -e "xpack.security.enabled=false" -e "xpack.security.enrollment.enabled=false"
sleep 10
curl -XGET '0.0.0.0:9200' -s | grep 8.11.3
sem-service stop elasticsearch

cat /tmp/toolbox_semservice

0 comments on commit 37c519a

Please sign in to comment.