Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Use Elasticsearch configuration file to avoid tricky environment variable names (#4992)

sarayourfriend5a3d3875b2b7
diff --git a/docker-compose.yml b/docker-compose.yml
index 43b9f9888..628b315b5 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -94,8 +94,12 @@ services:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
ports:
- "50292:9200"
- env_file:
- - docker/es/env.docker
+ environment:
+ # Elasticsearch will reserve 50-60% of available system memory
+ # if left to its own devices. Setting this to half a GB is sufficient
+ # for local testing and prevent ES from hogging such a significant
+ # amount of system memory.
+ ES_JAVA_OPTS: "-Xms512m -Xmx512m"
healthcheck:
test:
[
@@ -111,6 +115,7 @@ services:
hard: 65536
volumes:
- es-data:/usr/share/elasticsearch/data
+ - ./docker/es/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
volumes:
api-postgres:
diff --git a/docker/es/elasticsearch.yml b/docker/es/elasticsearch.yml
new file mode 100644
index 000000000..a46c3750a
--- /dev/null
+++ b/docker/es/elasticsearch.yml
@@ -0,0 +1,12 @@
+# Disable XPack
+# https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docker.html#_security_note
+xpack.security.enabled: false
+
+discovery.type: single-node
+
+network.host: 0.0.0.0
+network.bind_host: 0.0.0.0
+network.publish_host: 0.0.0.0
+
+http.cors.enabled: true
+http.cors.allow-origin: "/.*/"
diff --git a/docker/es/env.docker b/docker/es/env.docker
deleted file mode 100644
index 0b6f252e8..000000000
--- a/docker/es/env.docker
+++ /dev/null
@@ -1,14 +0,0 @@
-# Disable XPack
-# https://www.elastic.co/guide/en/elasticsearch/reference/5.3/docker.html#_security_note
-xpack.security.enabled="false"
-
-discovery.type="single-node"
-
-http.cors.enabled="true"
-http.cors.allow-origin="/.*/"
-
-# Elasticsearch will reserve 50-60% of available system memory
-# if left to its own devices. Setting this to half a GB is sufficient
-# for local testing and prevent ES from hogging such a significant
-# amount of system memory.
-ES_JAVA_OPTS="-Xms512m -Xmx512m"