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

@@ -97,18 +97,18 @@ public class DatanodeContainerizedBackend {
.waitingFor(new LogMessageWaitStrategy()
.withRegEx(".*Graylog DataNode datanode up and running.\n")
.withStartupTimeout(Duration.ofSeconds(60)));
container.withFileSystemBind("target/datanode-" + datanodeVersion + ".jar", IMAGE_WORKING_DIR + "/datanode.jar")
container.withFileSystemBind("target/graylog-datanode-" + datanodeVersion + ".jar", IMAGE_WORKING_DIR + "/graylog-datanode.jar")
.withFileSystemBind("target/lib", IMAGE_WORKING_DIR + "/lib/");
customizer.onContainer(container);
return container;
}
private static ImageFromDockerfile createDockerImageFile(String opensearchVersion) {
final String opensearchTarArchive = "opensearch-" + opensearchVersion + ".tar.gz";
final String opensearchTarArchive = "opensearch-" + opensearchVersion + "-linux-x64.tar.gz";
return new ImageFromDockerfile("local/graylog-datanode:latest", false)
// the following command makes the opensearch tar.gz archive accessible in the docker build context, so it can
// be later used by the ADD command
.withFileFromPath(opensearchTarArchive, Path.of("bin", "download", opensearchTarArchive))
.withFileFromPath(opensearchTarArchive, Path.of("target", "downloads", opensearchTarArchive))
.withDockerfileFromBuilder(builder ->
builder.from("eclipse-temurin:17-jre-jammy")
.workDir(IMAGE_WORKING_DIR)
@@ -121,7 +121,7 @@ public class DatanodeContainerizedBackend {
.run("chown -R opensearch:opensearch " + IMAGE_WORKING_DIR)
.user("opensearch")
.expose(DATANODE_REST_PORT, DATANODE_OPENSEARCH_PORT)
.entryPoint("java", "-jar", "datanode.jar", "datanode", "-f", "datanode.conf")
.entryPoint("java", "-jar", "graylog-datanode.jar", "datanode", "-f", "datanode.conf")
.build());
}