From 9f0da2a65a1252a9754afa2806d07fac30cd5e60 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Tue, 25 Feb 2025 15:12:35 +0000 Subject: [PATCH] Document elasticsearch container params. --- .../src/integrations/tests/utils/elasticsearch.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/server/src/integrations/tests/utils/elasticsearch.ts b/packages/server/src/integrations/tests/utils/elasticsearch.ts index a7229c3f60..a2ea22f73b 100644 --- a/packages/server/src/integrations/tests/utils/elasticsearch.ts +++ b/packages/server/src/integrations/tests/utils/elasticsearch.ts @@ -13,15 +13,26 @@ export async function getDatasource(): Promise { new GenericContainer(ELASTICSEARCH_IMAGE) .withExposedPorts(9200) .withEnvironment({ + // We need to set the discovery type to single-node to avoid the + // cluster waiting for other nodes to join before starting up. "discovery.type": "single-node", + // We disable security to avoid having to do any auth against the + // container, and to disable SSL. With SSL enabled it uses a self + // signed certificate that we'd have to ignore anyway. "xpack.security.enabled": "false", }) .withWaitStrategy( Wait.forHttp( + // Single node clusters never reach status green, so we wait for + // yellow instead. "/_cluster/health?wait_for_status=yellow&timeout=10s", 9200 ).withStartupTimeout(60000) ) + // We gave the container a tmpfs data directory. Without this, I found + // that the default data directory was very small and the container + // easily filled it up. This caused the cluster to go into a red status + // and stop responding to requests. .withTmpFs({ "/usr/share/elasticsearch/data": "rw" }) ) }