From bbbd247653778e982c7f1bacbaa84ca6d0a3ab3e Mon Sep 17 00:00:00 2001 From: ItaloBC Date: Wed, 14 Jun 2017 14:19:47 -0400 Subject: [PATCH] ElasticSearch instance fails at loading (wrong) ElasticSearch (ES from now onwards) will fail to initialize since the parameters for its environment are not correct or absent. These are: * `cluster.name`: Name of the cluster itself * `bootstrap.memory_lock`: Needed for ES to [lock the JVM into swap instead of memory](https://www.elastic.co/guide/en/elasticsearch/reference/master/_memory_lock_check.html). * `"ES_JAVA_OPTS=-Xms256m -Xmx256m"`: [Initial and maximum HEAP size for JVM](https://www.elastic.co/guide/en/elasticsearch/reference/current/_heap_size_check.html). Since it's locked to disk, should be the same. Half the defaults (512m) for development. * `ulimits: memlock: soft (-1), hard (-1)`: [ES needs to have unlimited access to memory](https://www.elastic.co/guide/en/elasticsearch/reference/current/max-size-virtual-memory-check.html), otherwise it will feel sluggish. * `mem_limit: 512m`: Hard limit the memory available for the container. This can, and should, be changed using `.env` file variables, but it seems that this should suffice for basic ES development. --- docker-compose.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index ec9af2c..ff285fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -473,6 +473,15 @@ services: volumes: - elasticsearch-data:/usr/share/elasticsearch/data - elasticsearch-plugins:/usr/share/elasticsearch/plugins + environment: + - cluster.name=laradock-cluster + - bootstrap.memory_lock=true + - "ES_JAVA_OPTS=-Xms256m -Xmx256m" + ulimits: + memlock: + soft: -1 + hard: -1 + mem_limit: 512m ports: - "${ELASTICSEARCH_HOST_HTTP_PORT}:9200" - "${ELASTICSEARCH_HOST_TRANSPORT_PORT}:9300"