-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
ElasticSearch: Fix missing JRE in 5.x and 6.x #12286
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
Conversation
@@ -669,7 +670,7 @@ def os_user(self): | |||
return constants.OS_USER_OPENSEARCH | |||
|
|||
def _ensure_installed(self): | |||
elasticsearch_package.install(self.version) | |||
elasticsearch_package.install(self.version, target=InstallTarget.VAR_LIBS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
target
uses InstallTarget.VAR_LIBS
as a default anyway, but it is made explicit here because get_java_env_vars()
method below needs it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Unfortunately, this is not necessarily the case... If the installer is used by lpm
, the InstallTarget.STATIC_LIBS
will be used. So this will actually break when the package is installed at Docker build time. But this can easily be fixed by just making the get_java_env_vars
independent of it (see comment below) 😉
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 8m 29s ⏱️ - 1h 41m 41s Results for commit 9cdaea9. ± Comparison against base commit f269fe2. This pull request removes 4051 tests.
♻️ This comment has been updated with latest results. |
# `discovery.type` had a different meaning in 5.x | ||
if not self.version.startswith("Elasticsearch_5."): | ||
settings["discovery.type"] = "single-node" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required because ES refuses to start if any config is invalid or unknown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @viren-nadkarni willing to give it a try once is released, I'm facing the same issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for jumping on this! Perfect implementation on the package installer to dynamically select the right installer for the version! 💯
It really only needs a small fix on the installer (see comments), then we are good to go! 🚀
@@ -669,7 +670,7 @@ def os_user(self): | |||
return constants.OS_USER_OPENSEARCH | |||
|
|||
def _ensure_installed(self): | |||
elasticsearch_package.install(self.version) | |||
elasticsearch_package.install(self.version, target=InstallTarget.VAR_LIBS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: Unfortunately, this is not necessarily the case... If the installer is used by lpm
, the InstallTarget.STATIC_LIBS
will be used. So this will actually break when the package is installed at Docker build time. But this can easily be fixed by just making the get_java_env_vars
independent of it (see comment below) 😉
@@ -233,6 +236,12 @@ class ElasticsearchPackageInstaller(PackageInstaller): | |||
def __init__(self, version: str): | |||
super().__init__("elasticsearch", version) | |||
|
|||
def get_java_env_vars(self, target: InstallTarget) -> dict[str, str]: | |||
install_dir = self._get_install_dir(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue: This is the root of the issue outlined in the comment above. Here you really shouldn't use the target where the package is "about to be installed if it's not yet installed", but you should use get_installed_dir
instead, which dynamically detects the installation directory where the package has already been installed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant suggestion, this will simplify everything. Fixed in 7eb8868
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Thanks for acting on the comment! Nice and clean! 🚀 💯
7eb8868
to
9cdaea9
Compare
Background
In #11462, we changed the ElasticSearch/OpenSearch installers to use the bundled JRE. However, based on #12231, it was identified that ElasticSearch 5.x and 6.x builds do not have a bundled JRE and instead require a separate JRE installation.
Changes
This PR introduces a specialised package installer for ElasticSearch 5.x and 6.x which manages the Java dependency through standardised approach.
Tests
Tested manually locally. On the CI, automated tests run only against the latest versions, which was also why this went undetected.
Related
Closes: #12231