diff --git a/config/elasticsearch/.env b/config/elasticsearch/.env index c191fee..08bd145 100644 --- a/config/elasticsearch/.env +++ b/config/elasticsearch/.env @@ -1,3 +1,6 @@ ELASTIC_PASSWORD=default discovery.type=single-node -xpack.security.enabled=false \ No newline at end of file +xpack.security.enabled=true +xpack.security.authc.anonymous.username=anonymous_user +xpack.security.authc.anonymous.roles=read_all +xpack.security.authc.anonymous.authz_exception=false \ No newline at end of file diff --git a/config/elasticsearch/roles.yml b/config/elasticsearch/roles.yml new file mode 100644 index 0000000..d2552d6 --- /dev/null +++ b/config/elasticsearch/roles.yml @@ -0,0 +1,4 @@ +read_all: + indices: + - names: [ "*" ] + privileges: [ "read", "view_index_metadata" ] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index f2af39d..72a972f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -32,9 +32,11 @@ services: ports: - "9200:9200" # also known as /es (nginx) - "9300:9300" + volumes: + - ./config/elasticsearch/roles.yml:/usr/share/elasticsearch/config/roles.yml:ro env_file: config/elasticsearch/.env healthcheck: - test: curl 127.0.0.1:9200/_cluster/health | grep -e "green" + test: curl 127.0.0.1:9200/_cluster/health -u elastic:default | grep -e "green" start_period: 30s start_interval: 5s timeout: 3s