From ce843be45691789cd9401fcaecf8cfa85b644189 Mon Sep 17 00:00:00 2001
From: Dmitriy Kazimirov <dmitriy.kazimirov@viorsan.com>
Date: Wed, 2 Apr 2025 09:09:14 +0000
Subject: [PATCH] fix for elastic username/pass

---
 .env.example       | 12 +++++++++++-
 docker-compose.yml |  9 ++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/.env.example b/.env.example
index 0c0e8b8..fe0b8db 100644
--- a/.env.example
+++ b/.env.example
@@ -57,4 +57,14 @@ SMB_SHARE_PATH=./smb_share
 ADMIN_USER=admin
 
 # Admin password for API management (required, string)
-ADMIN_PASSWORD=securepassword123
\ No newline at end of file
+ADMIN_PASSWORD=securepassword123
+
+
+# ElasticSearch credentials
+# ===============
+
+# Elastic username
+ELASTICSEARCH_USERNAME = admin
+
+# Elastic password
+ELASTICSEARCH_PASSWORD = password
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
index 07d9d58..94b32c6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -9,6 +9,8 @@ services:
       - ELASTICSEARCH_HOST=booksearch_elastic
       - BASE_URL=${BASE_URL}
       - CPU_LIMIT=${CPU_LIMIT}
+      - ADMIN_USER=${ADMIN_USER}
+      - ADMIN_PASSWORD=${ADMIN_PASSWORD}
       - SNIPPET_CHAR_LIMIT=${SNIPPET_CHAR_LIMIT}
     volumes:
       - ${SMB_SHARE_PATH}:/books
@@ -29,11 +31,12 @@ services:
       - "9300:9300"
     environment:
       - discovery.type=single-node
-      - ELASTICSEARCH_USERNAME=admin
-      - ELASTICSEARCH_PASSWORD=password
+      - ELASTICSEARCH_USERNAME=${ELASTICSEARCH_USERNAME}
+      - ELASTICSEARCH_PASSWORD=${ELASTICSEARCH_PASSWORD}
+      - ELASTICSEARCH_PLUGINS=analysis-stempel
     restart: unless-stopped
     healthcheck:
-      test: ["CMD", "curl", "-f", "http://localhost:9200"]
+      test: ["CMD", "curl", "-f", "http://localhost:9200/_nodes/plugins?filter_path=nodes.*.plugins"]
       interval: 30s
       timeout: 10s
       retries: 5