Skip to content

Commit

Permalink
Use Elasticsearch configuration file to avoid tricky environment vari…
Browse files Browse the repository at this point in the history
…able names (#4992)

It appears that there is no way to pass allow-origin as an environment variable, as ES will not recognise the same option with an underscore, and provides no method to map hyphens. The configuration file is much more searchable against the docs anyway.
  • Loading branch information
sarayourfriend authored Sep 25, 2024
1 parent ade3169 commit 5a3d387
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
9 changes: 7 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
[
Expand All @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions docker/es/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -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: "/.*/"
14 changes: 0 additions & 14 deletions docker/es/env.docker

This file was deleted.

0 comments on commit 5a3d387

Please sign in to comment.