From 5fdb65b71a299119ef80e44745deb1974ce90e0a Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Tue, 6 Dec 2022 10:33:04 +0100 Subject: [PATCH] CI: deploy OpenSearch 1.x instead of Elasticsearch Change DevStack plugin to deploy OpenSearch 1.x instead of Elasticsearch when using the elasticsearch storage driver. This is in preparation for supporting OpenSearch instead of Elasticsearch. Note that CloudKitty does not work with OpenSearch 2.x yet, likely due to the removal of mapping types [1]. [1] https://opensearch.org/docs/2.0/breaking-changes/#remove-mapping-types-parameter Change-Id: I572cba384a9a16ee2bbfe07b5c316ed5abbb5681 --- devstack/plugin.sh | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 248ec857..f9a03c0b 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -301,27 +301,20 @@ function install_influx { sudo systemctl start influxdb || sudo systemctl restart influxdb } -function install_elasticsearch_ubuntu { - sudo apt install -qy openjdk-8-jre - local elasticsearch_file=$(get_extra_file https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.3.deb) - sudo dpkg -i --skip-same-version ${elasticsearch_file} -} - -function install_elasticsearch_fedora { - sudo yum install -y java-1.8.0-openjdk - local elasticsearch_file=$(get_extra_file https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.8.3.rpm) - sudo yum localinstall -y ${elasticsearch_file} -} - -function install_elasticsearch { - if is_ubuntu; then - install_elasticsearch_ubuntu - elif is_fedora; then - install_elasticsearch_fedora - else - die $LINENO "Distribution must be Debian or Fedora-based" - fi - sudo systemctl start elasticsearch || sudo systemctl restart elasticsearch +function install_opensearch { + OPENSEARCH_HOME=/usr/share/opensearch + local opensearch_file=$(get_extra_file "https://artifacts.opensearch.org/releases/bundle/opensearch/1.3.6/opensearch-1.3.6-linux-x64.tar.gz") + sudo mkdir -p $OPENSEARCH_HOME + sudo tar -xzpf ${opensearch_file} -C $OPENSEARCH_HOME --strip-components=1 + sudo mkdir -p $OPENSEARCH_HOME/data /var/log/opensearch + sudo chown -R $STACK_USER $OPENSEARCH_HOME /var/log/opensearch + cat - </dev/null +discovery.type: single-node +path.data: /usr/share/opensearch/data +path.logs: /var/log/opensearch +plugins.security.disabled: true +EOF + _run_under_systemd opensearch "$OPENSEARCH_HOME/bin/opensearch" } # install_cloudkitty() - Collect source and prepare @@ -332,7 +325,7 @@ function install_cloudkitty { if [ $CLOUDKITTY_STORAGE_BACKEND == 'influxdb' ]; then install_influx elif [ $CLOUDKITTY_STORAGE_BACKEND == 'elasticsearch' ]; then - install_elasticsearch + install_opensearch fi }