Refactor data-node download and assembly (#14963)

* Refactor data-node download and assembly

- Download OpenSearch aarch64 distribution in addition to x64
- Extract OpenSearch distribution into "target/opensearch/*" instead of
  "bin/download".
- Include OpenSearch distributions in "dist/" instead of "bin/" in
  assembly

* Fix data-node test container creation

* Adjust OpenSearch location for architecture dependent locations

* If the configured location exists, use it

Otherwise, check for architecture dependent distribution directories.

* Switch default config file to locations that work with the tarball

* Rename datanode.jar to graylog-datanode.jar

* Rename datanodectl to graylog-datanode.sh

* Include graylog-datanode.sh in assembly as bin/graylog-datanode

* Add a jvm.options config file

* Add a production log4j2.xml config file

* Use bundled JVM if it exists

* fixed docker image for datanode integration tests

---------

Co-authored-by: Tomas Dvorak <tomas.dvorak@graylog.com>
This commit is contained in:
Bernd Ahlers
2023-03-28 10:49:49 +02:00
committed by GitHub
parent f632418a4b
commit 120fae5221
10 changed files with 169 additions and 49 deletions

View File

@@ -49,6 +49,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
import static org.graylog2.shared.utilities.StringUtils.f;
/**
* Helper class to hold configuration of Graylog
*/
@@ -156,7 +158,19 @@ public class Configuration extends BaseConfiguration {
}
public String getOpensearchLocation() {
return opensearchLocation;
// If the configured location exists, just use it.
if (Files.exists(Path.of(opensearchLocation))) {
return opensearchLocation;
}
// Otherwise check if the architecture dependent distribution exists.
final var osArch = System.getProperty("os.arch");
return switch (osArch) {
case "amd64" -> f("%s-linux-x64", opensearchLocation);
case "aarch64" -> f("%s-linux-aarch64", opensearchLocation);
default ->
throw new UnsupportedOperationException("Unsupported OpenSearch distribution architecture: " + osArch);
};
}
public String getOpensearchVersion() {