Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opensearch to the toolchain #8

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

QuerthDP
Copy link

@QuerthDP QuerthDP commented Jan 24, 2025

Fixes #4

smoczy123 and others added 3 commits January 24, 2025 11:47
…lopment environment

Script install OpenSearch from a tarball. File tarbasll.md contains instructions on how to use the script correctly
@QuerthDP QuerthDP linked an issue Jan 24, 2025 that may be closed by this pull request
@@ -0,0 +1,77 @@
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.18.0/opensearch-2.18.0-linux-x64.tar.gz

Check failure

Code scanning / shellcheck

SC2148 Error

Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.
@@ -0,0 +1,77 @@
wget https://artifacts.opensearch.org/releases/bundle/opensearch/2.18.0/opensearch-2.18.0-linux-x64.tar.gz
tar -xvf opensearch-2.18.0-linux-x64.tar.gz
cd opensearch-2.18.0/

Check warning

Code scanning / shellcheck

SC2164 Warning

Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
curl -X GET https://localhost:9200 -u 'admin:admin' --insecure
curl -X GET https://localhost:9200/_cat/plugins?v -u 'admin:admin' --insecure

cd config/

Check warning

Code scanning / shellcheck

SC2164 Warning

Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

cd ..
export OPENSEARCH_JAVA_HOME=/jdk
cd config/

Check warning

Code scanning / shellcheck

SC2164 Warning

Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
EOF

cd ..
cd plugins/opensearch-security/tools

Check warning

Code scanning / shellcheck

SC2164 Warning

Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
OPENSEARCH_JAVA_HOME=~/scylladb/scripts/opensearch-2.18.0/jdk ./hash.sh

cd ../../../
cd config/opensearch-security

Check warning

Code scanning / shellcheck

SC2164 Warning

Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
@QuerthDP QuerthDP changed the title 4 add opensearch to the toolchain Add opensearch to the toolchain Jan 24, 2025
@@ -0,0 +1,27 @@
run script: bash tarball.sh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing OpenSearch should not require a new, manual process that is separate from our default flow for installing things. More specifically, this should be taken care of in ./install-dependencies.sh. Many things depend on this, including our frozen toolchain based on docker images (see tools/toolchain/dbuild).

await loop.run_in_executor(io_executor, partial(shutil.rmtree, directory, *args, **kwargs))


class OpenSearchServer:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of mirroring the code in test/pylib/scylla_cluster.py, I would recommend looking at our current support code for running minio instead - AFAICS we use it in tests which require access to the S3 API, minio has a compatible API.

I would take a look at test/pylib/minio_server.py. The MinioServer is used from the test.py initialization code, we have only one instance of it for the whole duration of a test.py execution - I think it will be completely fine for our purposes, we can share a single instance in all tests and make sure that names of the objects that we will use will be unique and/or namespaced somehow.

Minio is downloaded in ./install-dependencies.sh, and I think that it's where you should download OpenSearch as well. Minio is a single binary though, so it is installed right into /usr/bin, whereas we need something more complicated for OpenSearch. There is the /opt/scylladb/dependencies directory to which the install-dependencies.sh process downloads some binaries already, so I think we can use it for this purpose as well. Another example - we used to download some (build-time) dependencies to that repository and extract them - see https://github.com/scylladb/scylladb/pull/9151/files.

Comment on lines 229 to 233
@pytest.fixture(scope="function")
async def opensearch():
cluster = OpenSearchCluster(logger=logging.getLogger())
await cluster.install_and_start()
yield cluster
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a proof that this PR works and sets up an OpenSearch instance properly, the dummy test should attempt to send some request to the instance - something non-destructive, like e.g. list the current indexes or something like that.

Add download and unpack of OpenSearch library to install-dependencies.sh
OPEN_SEARCH_VERSION=2.18.0
declare -A OPEN_SEARCH_CHECKSUM=(
["x86_64"]=ae3cb4107b2e0cdbb9b98bb4e5f2f019b736b68e995442c718e459d39ff01df1
["aarch64"]= # TODO: Add the checksum for the "aarch64" architecture.

Check warning

Code scanning / shellcheck

SC2192 Warning

This array element has no value. Remove spaces after = or use "" for empty string.
Remove @smoczy123 changes in test_raft_service_levels.py and conftest.py,
feels unnecessary here.

Add minimal implementation of new OpenSearch test suite
(the most basic suite.yaml, surely to look into in the future),
and test.py OpensearchTestSuite and OpensearchTest classes
(still need to be adjusted properly, them being just copy of Topology* for now).

Add simple OpenSearch test creating index and listing indices.
The test to work needs a manual installation of OpenSearch instance,
and will pass only once, as the instance does not allow to recreate the index.

This is still hardly WIP, will be adjusted and rebased properly soon.
Bump OpenSearch version from 2.18.0 to 2.19.0.

Adjust installation script to allow the caller to run OpenSearch instance.

Fix simple test to be reusable.

Add very simple opensearch cluster management (start/stop).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add OpenSearch to the toolchain
4 participants