Document elasticsearch container params.

This commit is contained in:
Sam Rose 2025-02-25 15:12:35 +00:00
parent 48674833fc
commit 9f0da2a65a
No known key found for this signature in database
1 changed files with 11 additions and 0 deletions

View File

@ -13,15 +13,26 @@ export async function getDatasource(): Promise<Datasource> {
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" })
)
}